@zuplo/cli 1.82.0 → 1.84.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,12 @@
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]="1eb67449-21d8-583a-9429-4ef33f6ecaed")}catch(e){}}();
3
- import * as dotenv from "dotenv";
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]="693e8a63-74e3-5e0f-8ccd-e696344947e7")}catch(e){}}();
4
3
  import { cpSync, existsSync } from "node:fs";
5
- import { readFile } from "node:fs/promises";
6
4
  import { join, relative, resolve } from "node:path";
7
5
  import { fileURLToPath, pathToFileURL } from "node:url";
8
6
  import { locateDenoExecutable } from "../common/deno-utils/locator.js";
7
+ import { logger } from "../common/logger.js";
9
8
  import { printDiagnosticsToConsole } from "../common/output.js";
9
+ import { ApiServer } from "../editor/server/server.js";
10
10
  export async function dev(argv) {
11
11
  const sourceDirectory = resolve(join(relative(process.cwd(), argv.dir)));
12
12
  const zuploRuntimePath = new URL("../../node_modules/@zuplo/runtime", import.meta.url);
@@ -18,14 +18,12 @@ export async function dev(argv) {
18
18
  process.env.GLOBAL_MODULE_LOCATION = fileURLToPath(new URL("../../node_modules", import.meta.url));
19
19
  process.env.DENO_EXECUTABLE = await locateDenoExecutable();
20
20
  const loadedEnvFiles = [];
21
- const envResult = dotenv.config();
22
- if (envResult.error === undefined) {
21
+ const envFile = join(sourceDirectory, ".env");
22
+ if (existsSync(envFile)) {
23
23
  loadedEnvFiles.push(".env");
24
24
  }
25
- const envFile = join(sourceDirectory, ".env.zuplo");
26
- if (existsSync(envFile)) {
27
- const config = dotenv.parse(await readFile(envFile, "utf-8"));
28
- dotenv.populate(process.env, config);
25
+ const envZuploFile = join(sourceDirectory, ".env.zuplo");
26
+ if (existsSync(envZuploFile)) {
29
27
  loadedEnvFiles.push(".env.zuplo");
30
28
  }
31
29
  const config = {
@@ -33,7 +31,7 @@ export async function dev(argv) {
33
31
  };
34
32
  process.env.__ZUPLO_CONFIG = btoa(JSON.stringify(config));
35
33
  const core = await import("@zuplo/core");
36
- const port = argv.port ?? 9000;
34
+ const port = argv.port;
37
35
  const serverProcess = await core.default.startDevServer({
38
36
  sourceDirectory,
39
37
  port,
@@ -43,21 +41,40 @@ export async function dev(argv) {
43
41
  disableIntegratedDevPortalBuild: false,
44
42
  },
45
43
  });
44
+ let editor;
45
+ if (argv["start-editor"]) {
46
+ editor = new ApiServer({
47
+ workingDir: sourceDirectory,
48
+ port: argv.editorPort,
49
+ isStandalone: false,
50
+ });
51
+ editor.start().catch((err) => logger.error(err));
52
+ }
46
53
  printDiagnosticsToConsole("Started local development setup");
47
54
  printDiagnosticsToConsole("Ctrl+C to exit");
48
55
  printDiagnosticsToConsole("");
49
56
  printDiagnosticsToConsole(`🚀 Zuplo Gateway: http://localhost:${port}`);
57
+ if (argv["start-editor"]) {
58
+ printDiagnosticsToConsole(`📘 Route Designer: http://localhost:${argv.editorPort}`);
59
+ }
50
60
  if (loadedEnvFiles.length > 0) {
51
61
  printDiagnosticsToConsole(`⚙️ Loaded env files: \n - ${loadedEnvFiles.join(" \n - ")}`);
52
62
  }
53
63
  printDiagnosticsToConsole("");
54
64
  printDiagnosticsToConsole("");
55
65
  return new Promise((resolve) => {
56
- serverProcess.on("exit", () => {
66
+ async function exit() {
57
67
  printDiagnosticsToConsole("Closing local development setup");
58
- resolve(void 0);
59
- });
68
+ serverProcess.kill();
69
+ if (argv["start-editor"]) {
70
+ printDiagnosticsToConsole("Closing local route designer");
71
+ await editor.close();
72
+ }
73
+ resolve();
74
+ }
75
+ process.on("SIGTERM", exit);
76
+ process.on("SIGINT", exit);
60
77
  });
61
78
  }
62
79
  //# sourceMappingURL=handler.js.map
63
- //# debugId=1eb67449-21d8-583a-9429-4ef33f6ecaed
80
+ //# debugId=693e8a63-74e3-5e0f-8ccd-e696344947e7
@@ -1,11 +1,15 @@
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]="a91948d7-c2a9-5d47-a291-0780bc4b373e")}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]="fc77d1b3-caea-5c0e-8d5d-3a380bd43f60")}catch(e){}}();
3
3
  import { logger } from "../common/logger.js";
4
4
  import { ApiServer } from "./server/server.js";
5
5
  export async function editor(argv) {
6
- const workingDir = argv.dir || null;
7
- const server = new ApiServer(workingDir);
8
- server.start().catch(logger.error);
6
+ const workingDir = argv.dir || process.cwd();
7
+ const server = new ApiServer({
8
+ workingDir,
9
+ port: argv.port,
10
+ isStandalone: true,
11
+ });
12
+ server.start().catch((err) => logger.error(err));
9
13
  return new Promise((resolve) => {
10
14
  process.on("SIGTERM", async () => {
11
15
  await server.close();
@@ -18,4 +22,4 @@ export async function editor(argv) {
18
22
  });
19
23
  }
20
24
  //# sourceMappingURL=handler.js.map
21
- //# debugId=a91948d7-c2a9-5d47-a291-0780bc4b373e
25
+ //# debugId=fc77d1b3-caea-5c0e-8d5d-3a380bd43f60
@@ -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]="466535e1-0ea2-5336-8c14-853d1f02f9b3")}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]="5ab9ac05-f559-54b5-b7df-cad35032f993")}catch(e){}}();
3
3
  import fastifyStatic from "@fastify/static";
4
4
  import chokidar from "chokidar";
5
5
  import Fastify from "fastify";
@@ -16,13 +16,19 @@ const CONFIG_DIR = "config";
16
16
  export class ApiServer {
17
17
  fastify;
18
18
  listenerPort;
19
+ isStandalone;
19
20
  listenerHost;
20
21
  workingDir;
21
22
  watcher;
22
23
  sseContext;
23
- constructor(workingDir) {
24
- this.workingDir = workingDir ?? ".";
25
- this.listenerPort = 5500;
24
+ constructor(options = {
25
+ workingDir: ".",
26
+ port: 9100,
27
+ isStandalone: true,
28
+ }) {
29
+ this.workingDir = options.workingDir;
30
+ this.listenerPort = options.port;
31
+ this.isStandalone = options.isStandalone;
26
32
  this.listenerHost = "localhost";
27
33
  this.watcher = chokidar.watch(path.join(this.workingDir, CONFIG_DIR));
28
34
  this.fastify = Fastify({
@@ -183,12 +189,14 @@ export class ApiServer {
183
189
  reject(err);
184
190
  }
185
191
  this.fastify.log.level = "info";
186
- printDiagnosticsToConsole("Started route designer");
187
- printDiagnosticsToConsole("Ctrl+C to exit");
188
- printDiagnosticsToConsole("");
189
- printDiagnosticsToConsole(`📘 Route Designer: http://${this.listenerHost}:${this.listenerPort}`);
190
- printDiagnosticsToConsole("");
191
- printDiagnosticsToConsole("");
192
+ if (this.isStandalone) {
193
+ printDiagnosticsToConsole("Started route designer");
194
+ printDiagnosticsToConsole("Ctrl+C to exit");
195
+ printDiagnosticsToConsole("");
196
+ printDiagnosticsToConsole(`📘 Route Designer: http://${this.listenerHost}:${this.listenerPort}`);
197
+ printDiagnosticsToConsole("");
198
+ printDiagnosticsToConsole("");
199
+ }
192
200
  resolve();
193
201
  });
194
202
  });
@@ -199,7 +207,9 @@ export class ApiServer {
199
207
  return this.fastify.ready();
200
208
  };
201
209
  close = async () => {
202
- printDiagnosticsToConsole("Closing route designer");
210
+ if (this.isStandalone) {
211
+ printDiagnosticsToConsole("Closing route designer");
212
+ }
203
213
  try {
204
214
  if (this.sseContext) {
205
215
  this.sseContext.source.end();
@@ -216,4 +226,4 @@ export class ApiServer {
216
226
  };
217
227
  }
218
228
  //# sourceMappingURL=server.js.map
219
- //# debugId=466535e1-0ea2-5336-8c14-853d1f02f9b3
229
+ //# debugId=5ab9ac05-f559-54b5-b7df-cad35032f993
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zuplo/cli",
3
- "version": "1.82.0",
3
+ "version": "1.84.0",
4
4
  "type": "module",
5
5
  "repository": "https://github.com/zuplo/cli",
6
6
  "description": "The command-line interface for Zuplo",
@@ -58,9 +58,9 @@
58
58
  "@inquirer/prompts": "^3.0.4",
59
59
  "@sentry/node": "7.69.0",
60
60
  "@swc/core": "1.3.78",
61
- "@zuplo/core": "5.1324.0",
61
+ "@zuplo/core": "5.1340.0",
62
62
  "@zuplo/pino-pretty-configurations": "^1.5.0",
63
- "@zuplo/runtime": "5.1324.0",
63
+ "@zuplo/runtime": "5.1340.0",
64
64
  "chalk": "^5.1.2",
65
65
  "chokidar": "^3.5.3",
66
66
  "deno-bin": "1.31.1",