@palettelab/cli 0.3.50 → 0.3.51
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +19 -1
- package/lib/bundler.js +22 -2
- package/lib/cli.js +8 -1
- package/lib/commands/version.js +20 -0
- package/package.json +1 -1
- package/template-fallback/package.json +1 -1
- package/template-fallback/templates/dashboard/package.json +1 -1
- package/template-fallback/templates/database/package.json +1 -1
- package/template-fallback/templates/external-service/package.json +1 -1
- package/template-fallback/templates/frontend-only/package.json +1 -1
- package/template-fallback/templates/next/package.json +1 -1
- package/template-fallback/templates/palette-app/package.json +1 -1
package/README.md
CHANGED
|
@@ -21,6 +21,13 @@ npx @palettelab/cli <command>
|
|
|
21
21
|
pltt <command>
|
|
22
22
|
```
|
|
23
23
|
|
|
24
|
+
Check the installed CLI version with:
|
|
25
|
+
|
|
26
|
+
```bash
|
|
27
|
+
pltt version
|
|
28
|
+
pltt --version
|
|
29
|
+
```
|
|
30
|
+
|
|
24
31
|
## Quick Start: Build And Test A Palette App
|
|
25
32
|
|
|
26
33
|
Use this flow when a developer wants to create an app, run it locally, then test
|
|
@@ -667,6 +674,16 @@ pltt login --env staging --url https://sandbox.pltt.ai --token <publish-token>
|
|
|
667
674
|
pltt dev --sandbox --env staging
|
|
668
675
|
```
|
|
669
676
|
|
|
677
|
+
### `pltt version`
|
|
678
|
+
|
|
679
|
+
Show the installed `pltt` CLI version.
|
|
680
|
+
|
|
681
|
+
```bash
|
|
682
|
+
pltt version
|
|
683
|
+
pltt version --json
|
|
684
|
+
pltt --version
|
|
685
|
+
```
|
|
686
|
+
|
|
670
687
|
### `pltt doctor`
|
|
671
688
|
|
|
672
689
|
Check local tooling and common setup problems.
|
|
@@ -787,7 +804,8 @@ through Palette's broker permission and install checks.
|
|
|
787
804
|
|
|
788
805
|
## Global Flags
|
|
789
806
|
|
|
790
|
-
- `--json` emits machine-readable output for `package`, `publish`, `status`, `logs`, and `
|
|
807
|
+
- `--json` emits machine-readable output for `package`, `publish`, `status`, `logs`, `test`, and `version`.
|
|
808
|
+
- `-v, --version` prints the installed `pltt` CLI version.
|
|
791
809
|
- `--env <name>` selects a configured publish/status/logs environment.
|
|
792
810
|
- `-y, --yes` skips production publish confirmation.
|
|
793
811
|
|
package/lib/bundler.js
CHANGED
|
@@ -247,6 +247,25 @@ function currentSearchParams() {
|
|
|
247
247
|
return new URLSearchParams(window.location.search)
|
|
248
248
|
}
|
|
249
249
|
|
|
250
|
+
function preserveCurrentPreviewParams(path, pluginId) {
|
|
251
|
+
if (typeof window === "undefined" || !pluginId || /^https?:\\/\\//i.test(path)) return path
|
|
252
|
+
|
|
253
|
+
const currentParams = new URLSearchParams(window.location.search)
|
|
254
|
+
const previewPublishId = currentParams.get("preview_publish_id")
|
|
255
|
+
const previewToken = currentParams.get("preview_token")
|
|
256
|
+
if (!previewPublishId || !previewToken) return path
|
|
257
|
+
|
|
258
|
+
const [beforeHash, hash = ""] = path.split("#", 2)
|
|
259
|
+
const [pathname, query = ""] = beforeHash.split("?", 2)
|
|
260
|
+
if (pathname !== "/apps/" + pluginId && !pathname.startsWith("/apps/" + pluginId + "/")) return path
|
|
261
|
+
|
|
262
|
+
const params = new URLSearchParams(query)
|
|
263
|
+
params.set("preview_publish_id", previewPublishId)
|
|
264
|
+
params.set("preview_token", previewToken)
|
|
265
|
+
const serialized = params.toString()
|
|
266
|
+
return pathname + (serialized ? "?" + serialized : "") + (hash ? "#" + hash : "")
|
|
267
|
+
}
|
|
268
|
+
|
|
250
269
|
function renderRoute(route) {
|
|
251
270
|
const page = createElement(route.page)
|
|
252
271
|
return (route.layouts || []).reduceRight((children, Layout) => createElement(Layout, null, children), page)
|
|
@@ -284,8 +303,9 @@ export function PaletteAppRouter({ routes, notFound: NotFound }) {
|
|
|
284
303
|
const osPath = inPalettePath && platform.pluginId
|
|
285
304
|
? "/apps/" + platform.pluginId + (pathname === "/" ? "" : pathname) + (queryPart ? "?" + queryPart : "")
|
|
286
305
|
: next
|
|
287
|
-
|
|
288
|
-
|
|
306
|
+
const preservedOsPath = preserveCurrentPreviewParams(osPath, platform.pluginId)
|
|
307
|
+
if (replace && typeof window !== "undefined") window.history.replaceState(null, "", preservedOsPath)
|
|
308
|
+
else platform.navigate(preservedOsPath)
|
|
289
309
|
}, [platform])
|
|
290
310
|
const state = useMemo(() => ({
|
|
291
311
|
pathname: location.pathname,
|
package/lib/cli.js
CHANGED
|
@@ -12,6 +12,7 @@ const status = require("./commands/status")
|
|
|
12
12
|
const logs = require("./commands/logs")
|
|
13
13
|
const secrets = require("./commands/secrets")
|
|
14
14
|
const services = require("./commands/services")
|
|
15
|
+
const version = require("./commands/version")
|
|
15
16
|
|
|
16
17
|
const COMMANDS = {
|
|
17
18
|
init: { run: init, help: "Scaffold a new plugin directory from the template" },
|
|
@@ -55,6 +56,7 @@ const COMMANDS = {
|
|
|
55
56
|
run: services,
|
|
56
57
|
help: "Inspect / pull / scaffold OS-broker services (list, pull, scaffold)",
|
|
57
58
|
},
|
|
59
|
+
version: { run: version, help: "Show the installed pltt CLI version" },
|
|
58
60
|
}
|
|
59
61
|
|
|
60
62
|
function printHelp() {
|
|
@@ -65,7 +67,8 @@ function printHelp() {
|
|
|
65
67
|
console.log(` ${name.padEnd(8)} ${help}`)
|
|
66
68
|
}
|
|
67
69
|
console.log("\nGlobal flags:")
|
|
68
|
-
console.log(" --json Emit machine-readable JSON output (status, logs, package, publish, test)")
|
|
70
|
+
console.log(" --json Emit machine-readable JSON output (status, logs, package, publish, test, version)")
|
|
71
|
+
console.log(" -v, --version Show the installed pltt CLI version")
|
|
69
72
|
console.log("\nPublish flags:")
|
|
70
73
|
console.log(" --env <name> Target environment from ~/.palette/config.json (default: local)")
|
|
71
74
|
console.log(" -y, --yes Skip interactive confirmation for production pushes")
|
|
@@ -108,6 +111,10 @@ function printHelp() {
|
|
|
108
111
|
|
|
109
112
|
async function run(argv) {
|
|
110
113
|
const cmd = argv[0]
|
|
114
|
+
if (cmd === "--version" || cmd === "-v") {
|
|
115
|
+
version(argv.slice(1))
|
|
116
|
+
return
|
|
117
|
+
}
|
|
111
118
|
if (!cmd || cmd === "--help" || cmd === "-h" || cmd === "help") {
|
|
112
119
|
printHelp()
|
|
113
120
|
return
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict"
|
|
2
|
+
|
|
3
|
+
const pkg = require("../../package.json")
|
|
4
|
+
|
|
5
|
+
function version(args = []) {
|
|
6
|
+
if (args.includes("--json")) {
|
|
7
|
+
console.log(
|
|
8
|
+
JSON.stringify({
|
|
9
|
+
name: pkg.name,
|
|
10
|
+
bin: "pltt",
|
|
11
|
+
version: pkg.version,
|
|
12
|
+
}),
|
|
13
|
+
)
|
|
14
|
+
return
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
console.log(`pltt ${pkg.version}`)
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
module.exports = version
|
package/package.json
CHANGED