@zuplo/cli 1.81.0 → 1.83.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/dist/cmds/dev.js CHANGED
@@ -1,5 +1,5 @@
1
1
 
2
- !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},n=(new Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="e910dd81-7af4-5078-bc97-0a2561de6ce0")}catch(e){}}();
2
+ !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},n=(new Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="d957865b-71c7-52e9-907e-8620261193ad")}catch(e){}}();
3
3
  import { captureEvent } from "../common/analytics/lib.js";
4
4
  import { identify } from "../common/middleware/user-identification.js";
5
5
  import setBlocking from "../common/output.js";
@@ -17,11 +17,21 @@ export default {
17
17
  default: ".",
18
18
  normalize: true,
19
19
  hidden: true,
20
+ })
21
+ .option("start-editor", {
22
+ type: "boolean",
23
+ describe: "Start the editor with the local server",
24
+ default: true,
20
25
  })
21
26
  .option("port", {
22
27
  type: "number",
23
- describe: "The port to run the zup on",
28
+ describe: "The port to run the local server on",
24
29
  default: 9000,
30
+ })
31
+ .option("editor-port", {
32
+ type: "number",
33
+ describe: "The port to run the route designer on",
34
+ default: 9100,
25
35
  })
26
36
  .middleware([setBlocking, identify])
27
37
  .check(async (argv) => {
@@ -34,4 +44,4 @@ export default {
34
44
  },
35
45
  };
36
46
  //# sourceMappingURL=dev.js.map
37
- //# debugId=e910dd81-7af4-5078-bc97-0a2561de6ce0
47
+ //# debugId=d957865b-71c7-52e9-907e-8620261193ad
@@ -1,5 +1,5 @@
1
1
 
2
- !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},n=(new Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="29e646b9-179b-5d9d-8e0f-c31b1185dfcf")}catch(e){}}();
2
+ !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},n=(new Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="39695608-20e6-59bb-8e32-8b6037d42575")}catch(e){}}();
3
3
  import { captureEvent } from "../common/analytics/lib.js";
4
4
  import { identify } from "../common/middleware/user-identification.js";
5
5
  import setBlocking from "../common/output.js";
@@ -16,7 +16,12 @@ export default {
16
16
  describe: "The directory containing your zup",
17
17
  default: ".",
18
18
  normalize: false,
19
- hidden: false,
19
+ hidden: true,
20
+ })
21
+ .option("port", {
22
+ type: "number",
23
+ describe: "The port to run the route designer on",
24
+ default: "9100",
20
25
  })
21
26
  .middleware([setBlocking, identify])
22
27
  .check(async (argv) => {
@@ -29,4 +34,4 @@ export default {
29
34
  },
30
35
  };
31
36
  //# sourceMappingURL=editor.js.map
32
- //# debugId=29e646b9-179b-5d9d-8e0f-c31b1185dfcf
37
+ //# debugId=39695608-20e6-59bb-8e32-8b6037d42575
@@ -1,12 +1,14 @@
1
1
 
2
- !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},n=(new Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="c73be6b5-a5f8-54e9-8902-e6c42cb6b377")}catch(e){}}();
2
+ !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},n=(new Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="972fe043-9ee3-54a1-b4ff-beecb5715708")}catch(e){}}();
3
3
  import * as dotenv from "dotenv";
4
4
  import { cpSync, existsSync } from "node:fs";
5
5
  import { readFile } from "node:fs/promises";
6
6
  import { join, relative, resolve } from "node:path";
7
7
  import { fileURLToPath, pathToFileURL } from "node:url";
8
8
  import { locateDenoExecutable } from "../common/deno-utils/locator.js";
9
+ import { logger } from "../common/logger.js";
9
10
  import { printDiagnosticsToConsole } from "../common/output.js";
11
+ import { ApiServer } from "../editor/server/server.js";
10
12
  export async function dev(argv) {
11
13
  const sourceDirectory = resolve(join(relative(process.cwd(), argv.dir)));
12
14
  const zuploRuntimePath = new URL("../../node_modules/@zuplo/runtime", import.meta.url);
@@ -17,17 +19,23 @@ export async function dev(argv) {
17
19
  }
18
20
  process.env.GLOBAL_MODULE_LOCATION = fileURLToPath(new URL("../../node_modules", import.meta.url));
19
21
  process.env.DENO_EXECUTABLE = await locateDenoExecutable();
22
+ const loadedEnvFiles = [];
23
+ const envResult = dotenv.config();
24
+ if (envResult.error === undefined) {
25
+ loadedEnvFiles.push(".env");
26
+ }
20
27
  const envFile = join(sourceDirectory, ".env.zuplo");
21
28
  if (existsSync(envFile)) {
22
29
  const config = dotenv.parse(await readFile(envFile, "utf-8"));
23
30
  dotenv.populate(process.env, config);
31
+ loadedEnvFiles.push(".env.zuplo");
24
32
  }
25
33
  const config = {
26
34
  build_assets_url: pathToFileURL(sourceDirectory),
27
35
  };
28
36
  process.env.__ZUPLO_CONFIG = btoa(JSON.stringify(config));
29
37
  const core = await import("@zuplo/core");
30
- const port = argv.port ?? 9000;
38
+ const port = argv.port;
31
39
  const serverProcess = await core.default.startDevServer({
32
40
  sourceDirectory,
33
41
  port,
@@ -37,18 +45,40 @@ export async function dev(argv) {
37
45
  disableIntegratedDevPortalBuild: false,
38
46
  },
39
47
  });
48
+ let editor;
49
+ if (argv["start-editor"]) {
50
+ editor = new ApiServer({
51
+ workingDir: sourceDirectory,
52
+ port: argv.editorPort,
53
+ isStandalone: false,
54
+ });
55
+ editor.start().catch(logger.error);
56
+ }
40
57
  printDiagnosticsToConsole("Started local development setup");
41
58
  printDiagnosticsToConsole("Ctrl+C to exit");
42
59
  printDiagnosticsToConsole("");
43
60
  printDiagnosticsToConsole(`🚀 Zuplo Gateway: http://localhost:${port}`);
61
+ if (argv["start-editor"]) {
62
+ printDiagnosticsToConsole(`📘 Route Designer: http://localhost:${argv.editorPort}`);
63
+ }
64
+ if (loadedEnvFiles.length > 0) {
65
+ printDiagnosticsToConsole(`⚙️ Loaded env files: \n - ${loadedEnvFiles.join(" \n - ")}`);
66
+ }
44
67
  printDiagnosticsToConsole("");
45
68
  printDiagnosticsToConsole("");
46
69
  return new Promise((resolve) => {
47
- serverProcess.on("exit", () => {
70
+ async function exit() {
48
71
  printDiagnosticsToConsole("Closing local development setup");
49
- resolve(void 0);
50
- });
72
+ serverProcess.kill();
73
+ if (argv["start-editor"]) {
74
+ printDiagnosticsToConsole("Closing local route designer");
75
+ await editor.close();
76
+ }
77
+ resolve();
78
+ }
79
+ process.on("SIGTERM", exit);
80
+ process.on("SIGINT", exit);
51
81
  });
52
82
  }
53
83
  //# sourceMappingURL=handler.js.map
54
- //# debugId=c73be6b5-a5f8-54e9-8902-e6c42cb6b377
84
+ //# debugId=972fe043-9ee3-54a1-b4ff-beecb5715708