@palettelab/cli 0.2.0 → 0.3.0
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/lib/commands/dev.js +20 -0
- package/package.json +1 -1
package/lib/commands/dev.js
CHANGED
|
@@ -20,6 +20,11 @@ function ensureDocker() {
|
|
|
20
20
|
}
|
|
21
21
|
}
|
|
22
22
|
|
|
23
|
+
function tryPullImage(image) {
|
|
24
|
+
const res = spawnSync("docker", ["pull", image], { stdio: "inherit" })
|
|
25
|
+
return res.status === 0
|
|
26
|
+
}
|
|
27
|
+
|
|
23
28
|
async function run(args, { cwd }) {
|
|
24
29
|
const manifest = loadManifest(cwd)
|
|
25
30
|
const pluginId = manifest.id
|
|
@@ -31,6 +36,21 @@ async function run(args, { cwd }) {
|
|
|
31
36
|
console.log(`[palette] frontend: http://localhost:${FRONTEND_PORT}/apps/${pluginId}`)
|
|
32
37
|
console.log(`[palette] backend: http://localhost:${BACKEND_PORT}/api/v1/plugins/${pluginId}`)
|
|
33
38
|
|
|
39
|
+
// Pre-pull so we can give a useful error if the image isn't reachable
|
|
40
|
+
// (common cause: maintainer hasn't pushed it yet, or `docker login ghcr.io`
|
|
41
|
+
// missing). Without this, the `docker compose up` failure is cryptic.
|
|
42
|
+
if (!tryPullImage(DEFAULT_IMAGE)) {
|
|
43
|
+
console.error(
|
|
44
|
+
`\n[palette] could not pull ${DEFAULT_IMAGE}.\n` +
|
|
45
|
+
` Most common causes:\n` +
|
|
46
|
+
` • The image hasn't been published to the registry yet.\n` +
|
|
47
|
+
` Platform maintainers: see docker/platform-dev/README.md for the build + push flow.\n` +
|
|
48
|
+
` • You are not logged in: docker login ghcr.io -u <github-user> -p <pat>\n` +
|
|
49
|
+
` • You are pointing at a different tag: set PALETTE_DEV_IMAGE=<your-image> to override.\n`,
|
|
50
|
+
)
|
|
51
|
+
process.exit(1)
|
|
52
|
+
}
|
|
53
|
+
|
|
34
54
|
const env = {
|
|
35
55
|
...process.env,
|
|
36
56
|
PALETTE_DEV_IMAGE: DEFAULT_IMAGE,
|