@mediamonks/canopy-cli 0.4.3 → 0.4.4

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.
@@ -0,0 +1,2 @@
1
+ import { t as devCommand } from "./dev-pPVCUaFp.mjs";
2
+ export { devCommand };
@@ -22,7 +22,7 @@ function rewriteApiPath(path, slug) {
22
22
  }
23
23
  /**
24
24
  * Load Vite's `createServer`, preferring the Vite installed in the *project*
25
- * over the copy bundled with the CLI.
25
+ * over the copy bundled with the CLI. `bundled` reports which one we got.
26
26
  *
27
27
  * Why the project's own Vite: the dev server and the project's
28
28
  * vite.config/plugins must run on ONE Vite instance. When they don't — e.g. the
@@ -38,21 +38,36 @@ function rewriteApiPath(path, slug) {
38
38
  */
39
39
  async function loadCreateServer(dir) {
40
40
  try {
41
- return (await import(pathToFileURL(createRequire(join(dir, "package.json")).resolve("vite")).href)).createServer;
41
+ return {
42
+ createServer: (await import(pathToFileURL(createRequire(join(dir, "package.json")).resolve("vite")).href)).createServer,
43
+ bundled: false
44
+ };
42
45
  } catch {
43
- return (await import("vite-server")).createServer;
46
+ return {
47
+ createServer: (await import("vite-server")).createServer,
48
+ bundled: true
49
+ };
44
50
  }
45
51
  }
46
52
  async function startVite(flags, serverOverrides) {
47
- const server = await (await loadCreateServer(flags.dir))({
53
+ const { createServer, bundled } = await loadCreateServer(flags.dir);
54
+ const plugins = [{
55
+ name: "canopy-platform-api-external",
56
+ resolveId: (id) => id.startsWith("/_api/") ? {
57
+ id,
58
+ external: true
59
+ } : void 0
60
+ }];
61
+ if (bundled) plugins.push({
62
+ name: "canopy-no-build-static",
63
+ transformIndexHtml: {
64
+ order: "post",
65
+ handler: (html) => html.replace(/\s*<script type="module" src="\/@vite\/client"><\/script>/g, "")
66
+ }
67
+ });
68
+ const server = await createServer({
48
69
  root: flags.dir,
49
- plugins: [{
50
- name: "canopy-platform-api-external",
51
- resolveId: (id) => id.startsWith("/_api/") ? {
52
- id,
53
- external: true
54
- } : void 0
55
- }],
70
+ plugins,
56
71
  server: {
57
72
  port: flags.port,
58
73
  ...serverOverrides
@@ -79,7 +94,7 @@ async function devRemote(flags, slug) {
79
94
  async function devLocal(flags, slug) {
80
95
  let dump;
81
96
  if (flags.pull) {
82
- const { fetchProjectDump } = await import("./local-DSGE-qxT.mjs");
97
+ const { fetchProjectDump } = await import("./local-MLfuFVZb.mjs");
83
98
  console.log(`Pulling a fresh export of ${slug}…`);
84
99
  dump = await fetchProjectDump(slug);
85
100
  }
@@ -93,7 +108,7 @@ async function devLocal(flags, slug) {
93
108
  } catch (err) {
94
109
  console.log(`Note: ai/services will be unavailable — could not reach the platform (${err instanceof Error ? err.message : String(err)}).`);
95
110
  }
96
- const { createSandbox } = await import("./local-DSGE-qxT.mjs");
111
+ const { createSandbox } = await import("./local-MLfuFVZb.mjs");
97
112
  const sandbox = await createSandbox({
98
113
  slug,
99
114
  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-M9p3aYWG.mjs";
2
+ import { t as version } from "./package-BHlmIdUm.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-fNEcOnTg.mjs").then((m) => m.devCommand),
51
+ dev: () => import("./dev-R6nzDtA-.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-BYuy0tS3.mjs").then((m) => m.skillCommand),
60
- upgrade: () => import("./upgrade-fRFEV1GC.mjs").then((m) => m.upgradeCommand),
59
+ skill: () => import("./skill-BsZKAgGI.mjs").then((m) => m.skillCommand),
60
+ upgrade: () => import("./upgrade-nYLjXxPk.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-CGiJJ5mj.mjs";
2
+ import { n as rewriteApiPath } from "./dev-pPVCUaFp.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
1
  //#region package.json
2
- var version = "0.4.3";
2
+ var version = "0.4.4";
3
3
  //#endregion
4
4
  export { version as t };
@@ -1,4 +1,4 @@
1
- import { t as version } from "./package-M9p3aYWG.mjs";
1
+ import { t as version } from "./package-BHlmIdUm.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,7 +112,7 @@ 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");
115
+ const { skillInstalled } = await import("./skill-BsZKAgGI.mjs");
116
116
  const refreshSkill = skillInstalled(process.cwd());
117
117
  console.log(`Upgrading via ${command}: ${command} ${cmd.join(" ")}`);
118
118
  await run(command, cmd);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mediamonks/canopy-cli",
3
- "version": "0.4.3",
3
+ "version": "0.4.4",
4
4
  "description": "Canopy CLI — create, develop and deploy Canopy projects.",
5
5
  "bin": {
6
6
  "canopy": "./dist/index.mjs"
@@ -1,2 +0,0 @@
1
- import { t as devCommand } from "./dev-CGiJJ5mj.mjs";
2
- export { devCommand };