@mediamonks/canopy-cli 0.4.2 → 0.4.3
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/dist/{dev-DdUJbbfA.mjs → dev-CGiJJ5mj.mjs} +28 -4
- package/dist/dev-fNEcOnTg.mjs +2 -0
- package/dist/index.mjs +4 -4
- package/dist/{local-Ba-pZf2O.mjs → local-DSGE-qxT.mjs} +1 -1
- package/dist/{package-CUjYxZem.mjs → package-M9p3aYWG.mjs} +1 -1
- package/dist/{skill-CObIJMP5.mjs → skill-BYuy0tS3.mjs} +1 -1
- package/dist/{upgrade-DxUNN79Q.mjs → upgrade-fRFEV1GC.mjs} +3 -2
- package/package.json +3 -3
- package/dist/dev-DBoGaChx.mjs +0 -2
|
@@ -2,8 +2,10 @@ import { t as readConfig } from "./config-C-z7st1X.mjs";
|
|
|
2
2
|
import { n as apiRequest } from "./api-BcX_w6Xf.mjs";
|
|
3
3
|
import { i as resolveProject, t as projectDirArgs } from "./project-CpiPLNby.mjs";
|
|
4
4
|
import { n as reportErrors } from "./ui-C8VuPzGp.mjs";
|
|
5
|
+
import { createRequire } from "node:module";
|
|
5
6
|
import { defineCommand } from "citty";
|
|
6
7
|
import { join } from "node:path";
|
|
8
|
+
import { pathToFileURL } from "node:url";
|
|
7
9
|
//#region src/dev.ts
|
|
8
10
|
/**
|
|
9
11
|
* Mirror the gateway's project-host rewrite (apps/gateway/src/index.ts):
|
|
@@ -18,9 +20,31 @@ function rewriteApiPath(path, slug) {
|
|
|
18
20
|
if (dataPlane) pathname = `/v1/projects/${slug}/${dataPlane[1]}${dataPlane[2] ?? ""}`;
|
|
19
21
|
return pathname + query;
|
|
20
22
|
}
|
|
23
|
+
/**
|
|
24
|
+
* Load Vite's `createServer`, preferring the Vite installed in the *project*
|
|
25
|
+
* over the copy bundled with the CLI.
|
|
26
|
+
*
|
|
27
|
+
* Why the project's own Vite: the dev server and the project's
|
|
28
|
+
* vite.config/plugins must run on ONE Vite instance. When they don't — e.g. the
|
|
29
|
+
* CLI serves with its Vite while the project's `vite.config.ts` and
|
|
30
|
+
* `@vitejs/plugin-react` pull in a second, separately-installed Vite (even the
|
|
31
|
+
* same version) — internal module resolution breaks: the server fails to
|
|
32
|
+
* resolve `/@vite/client` and the browser gets the HTML fallback instead of the
|
|
33
|
+
* client runtime. Scaffolds that ship a vite.config (spa/worker) always have
|
|
34
|
+
* their own Vite; the no-build `static` scaffold has none, so we fall back to
|
|
35
|
+
* the CLI's bundled Vite (aliased "vite-server"). Upstream Vite is used rather
|
|
36
|
+
* than the repo's Vite+ fork, whose native binding rides the devDependency-only
|
|
37
|
+
* `vite-plus` package and is absent from a user's global `npm i -g` install.
|
|
38
|
+
*/
|
|
39
|
+
async function loadCreateServer(dir) {
|
|
40
|
+
try {
|
|
41
|
+
return (await import(pathToFileURL(createRequire(join(dir, "package.json")).resolve("vite")).href)).createServer;
|
|
42
|
+
} catch {
|
|
43
|
+
return (await import("vite-server")).createServer;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
21
46
|
async function startVite(flags, serverOverrides) {
|
|
22
|
-
const
|
|
23
|
-
const server = await createServer({
|
|
47
|
+
const server = await (await loadCreateServer(flags.dir))({
|
|
24
48
|
root: flags.dir,
|
|
25
49
|
plugins: [{
|
|
26
50
|
name: "canopy-platform-api-external",
|
|
@@ -55,7 +79,7 @@ async function devRemote(flags, slug) {
|
|
|
55
79
|
async function devLocal(flags, slug) {
|
|
56
80
|
let dump;
|
|
57
81
|
if (flags.pull) {
|
|
58
|
-
const { fetchProjectDump } = await import("./local-
|
|
82
|
+
const { fetchProjectDump } = await import("./local-DSGE-qxT.mjs");
|
|
59
83
|
console.log(`Pulling a fresh export of ${slug}…`);
|
|
60
84
|
dump = await fetchProjectDump(slug);
|
|
61
85
|
}
|
|
@@ -69,7 +93,7 @@ async function devLocal(flags, slug) {
|
|
|
69
93
|
} catch (err) {
|
|
70
94
|
console.log(`Note: ai/services will be unavailable — could not reach the platform (${err instanceof Error ? err.message : String(err)}).`);
|
|
71
95
|
}
|
|
72
|
-
const { createSandbox } = await import("./local-
|
|
96
|
+
const { createSandbox } = await import("./local-DSGE-qxT.mjs");
|
|
73
97
|
const sandbox = await createSandbox({
|
|
74
98
|
slug,
|
|
75
99
|
persistDir: join(flags.dir, ".canopy", "local"),
|
package/dist/index.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { t as version } from "./package-
|
|
2
|
+
import { t as version } from "./package-M9p3aYWG.mjs";
|
|
3
3
|
import { i as runRefresh, r as notifyOfUpdate } from "./version-check-CoWgQs2h.mjs";
|
|
4
4
|
import { defineCommand, runMain } from "citty";
|
|
5
5
|
//#region src/index.ts
|
|
@@ -48,7 +48,7 @@ const main = defineCommand({
|
|
|
48
48
|
init: () => import("./projects-oyjC4ZGb.mjs").then((m) => m.initCommand),
|
|
49
49
|
projects: () => import("./projects-oyjC4ZGb.mjs").then((m) => m.projectsCommand),
|
|
50
50
|
delete: () => import("./projects-oyjC4ZGb.mjs").then((m) => m.deleteCommand),
|
|
51
|
-
dev: () => import("./dev-
|
|
51
|
+
dev: () => import("./dev-fNEcOnTg.mjs").then((m) => m.devCommand),
|
|
52
52
|
deploy: () => import("./deploy-BO_-gK32.mjs").then((m) => m.deployCommand),
|
|
53
53
|
rollback: () => import("./deploy-BO_-gK32.mjs").then((m) => m.rollbackCommand),
|
|
54
54
|
download: () => import("./deploy-BO_-gK32.mjs").then((m) => m.downloadCommand),
|
|
@@ -56,8 +56,8 @@ const main = defineCommand({
|
|
|
56
56
|
db: () => import("./db-Bkq-_qkd.mjs").then((m) => m.dbCommand),
|
|
57
57
|
open: () => import("./open-xLiGUz_W.mjs").then((m) => m.openCommand),
|
|
58
58
|
docs: () => import("./docs-C3aOAx_A.mjs").then((m) => m.docsCommand),
|
|
59
|
-
skill: () => import("./skill-
|
|
60
|
-
upgrade: () => import("./upgrade-
|
|
59
|
+
skill: () => import("./skill-BYuy0tS3.mjs").then((m) => m.skillCommand),
|
|
60
|
+
upgrade: () => import("./upgrade-fRFEV1GC.mjs").then((m) => m.upgradeCommand),
|
|
61
61
|
logs: planned("logs", "Tail worker logs", "2")
|
|
62
62
|
}
|
|
63
63
|
});
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { n as apiRequest } from "./api-BcX_w6Xf.mjs";
|
|
2
|
-
import { n as rewriteApiPath } from "./dev-
|
|
2
|
+
import { n as rewriteApiPath } from "./dev-CGiJJ5mj.mjs";
|
|
3
3
|
import { createRequire } from "node:module";
|
|
4
4
|
import { existsSync, readFileSync } from "node:fs";
|
|
5
5
|
import { dirname, join } from "node:path";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { t as version } from "./package-
|
|
1
|
+
import { t as version } from "./package-M9p3aYWG.mjs";
|
|
2
2
|
import { n as reportErrors } from "./ui-C8VuPzGp.mjs";
|
|
3
3
|
import { defineCommand } from "citty";
|
|
4
4
|
import { cpSync, existsSync, mkdirSync, rmSync, symlinkSync, writeFileSync } from "node:fs";
|
|
@@ -112,11 +112,12 @@ const upgradeCommand = defineCommand({
|
|
|
112
112
|
const spec = `${PACKAGE_NAME}@${args.version ?? "latest"}`;
|
|
113
113
|
const command = pmCommand(pm);
|
|
114
114
|
const cmd = installArgs(pm, spec);
|
|
115
|
+
const { skillInstalled } = await import("./skill-BYuy0tS3.mjs");
|
|
116
|
+
const refreshSkill = skillInstalled(process.cwd());
|
|
115
117
|
console.log(`Upgrading via ${command}: ${command} ${cmd.join(" ")}`);
|
|
116
118
|
await run(command, cmd);
|
|
117
119
|
console.log(`\nDone. Run \`canopy --version\` to confirm.`);
|
|
118
|
-
|
|
119
|
-
if (skillInstalled(process.cwd())) {
|
|
120
|
+
if (refreshSkill) {
|
|
120
121
|
console.log("Refreshing the Canopy agent skill in this repo…");
|
|
121
122
|
await run("canopy", ["skill", "install"]).catch((err) => {
|
|
122
123
|
console.warn(`Could not auto-refresh the skill (${err instanceof Error ? err.message : String(err)}). Run \`canopy skill install\` yourself.`);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mediamonks/canopy-cli",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.3",
|
|
4
4
|
"description": "Canopy CLI — create, develop and deploy Canopy projects.",
|
|
5
5
|
"bin": {
|
|
6
6
|
"canopy": "./dist/index.mjs"
|
|
@@ -19,8 +19,8 @@
|
|
|
19
19
|
"hono": "^4.8.0",
|
|
20
20
|
"miniflare": "^4.20260714.0",
|
|
21
21
|
"vite-server": "npm:vite@^7",
|
|
22
|
-
"@mediamonks/canopy": "0.0.
|
|
23
|
-
"@mediamonks/canopy
|
|
22
|
+
"@mediamonks/canopy-data-plane": "0.0.1",
|
|
23
|
+
"@mediamonks/canopy": "0.0.2"
|
|
24
24
|
},
|
|
25
25
|
"devDependencies": {
|
|
26
26
|
"@types/node": "^26.1.1",
|
package/dist/dev-DBoGaChx.mjs
DELETED