@zuplo/cli 1.109.0 → 1.111.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/cli.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]="13f2d28d-a993-57e1-bc2e-1821b26c7cff")}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]="59466167-0404-586c-a0b1-a43e10b758a7")}catch(e){}}();
3
3
  import * as dotenv from "dotenv";
4
4
  dotenv.config();
5
5
  import * as Sentry from "@sentry/node";
@@ -23,6 +23,7 @@ import variable from "./cmds/variable/index.js";
23
23
  import { shutdownAnalytics } from "./common/analytics/lib.js";
24
24
  import { MAX_WAIT_PENDING_TIME_MS, SENTRY_DSN } from "./common/constants.js";
25
25
  import { logger } from "./common/logger.js";
26
+ import { warnIfOutdatedVersion } from "./common/outdated.js";
26
27
  import { printCriticalFailureToConsoleAndExit } from "./common/output.js";
27
28
  const MIN_NODE_VERSION = "18.0.0";
28
29
  if (gte(process.versions.node, MIN_NODE_VERSION)) {
@@ -32,7 +33,7 @@ if (gte(process.versions.node, MIN_NODE_VERSION)) {
32
33
  }
33
34
  catch (e) {
34
35
  logger.error(e);
35
- printCriticalFailureToConsoleAndExit(`Unable to load @zuplo/cli. The package.json is missing or malformed.`);
36
+ await printCriticalFailureToConsoleAndExit(`Unable to load @zuplo/cli. The package.json is missing or malformed.`);
36
37
  }
37
38
  Sentry.init({
38
39
  dsn: SENTRY_DSN,
@@ -59,6 +60,7 @@ if (gte(process.versions.node, MIN_NODE_VERSION)) {
59
60
  .help();
60
61
  try {
61
62
  await cli.argv;
63
+ void warnIfOutdatedVersion(packageJson?.version);
62
64
  void Sentry.close(MAX_WAIT_PENDING_TIME_MS).then(() => {
63
65
  process.exit(0);
64
66
  });
@@ -67,7 +69,7 @@ if (gte(process.versions.node, MIN_NODE_VERSION)) {
67
69
  if (err instanceof Error) {
68
70
  Sentry.captureException(err);
69
71
  }
70
- printCriticalFailureToConsoleAndExit(err.message ?? err);
72
+ await printCriticalFailureToConsoleAndExit(err.message ?? err);
71
73
  cli.showHelp();
72
74
  }
73
75
  finally {
@@ -75,9 +77,9 @@ if (gte(process.versions.node, MIN_NODE_VERSION)) {
75
77
  }
76
78
  }
77
79
  else {
78
- printCriticalFailureToConsoleAndExit(`The zup CLI requires at least node.js v${MIN_NODE_VERSION}. You are using v${process.versions.node}. Please update your version of node.js.
80
+ await printCriticalFailureToConsoleAndExit(`The zup CLI requires at least node.js v${MIN_NODE_VERSION}. You are using v${process.versions.node}. Please update your version of node.js.
79
81
 
80
82
  Consider using a Node.js version manager such as https://github.com/nvm-sh/nvm.`);
81
83
  }
82
84
  //# sourceMappingURL=cli.js.map
83
- //# debugId=13f2d28d-a993-57e1-bc2e-1821b26c7cff
85
+ //# debugId=59466167-0404-586c-a0b1-a43e10b758a7
@@ -1,9 +1,10 @@
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]="8f9176c4-bdd2-5546-8161-2df78f8c8d2d")}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]="4daebd3e-ec9e-5f97-947a-e83332c8499e")}catch(e){}}();
3
3
  export const ZUPLO_PREFERRED_JSON_FILE = "zuplo.jsonc";
4
4
  export const ZUPLO_FALLBACK_JSON_FILE = "zuplo.json";
5
5
  export const ZUPLO_CLI_XDG_FOLDER_NAME = "zup";
6
6
  export const ZUPLO_AUTH_FILE_NAME = "auth.json";
7
+ export const ZUPLO_VERSION_CHECK_FILE = "version.json";
7
8
  export const ZUPLO_SYSTEM_ENV_VAR = ".env.zuplo";
8
9
  export const DEPLOYER_METADATA_FILE = "deployer.json";
9
10
  export const ZUPLO_USER_ID_ARGV_KEY = "zuplo-user-id";
@@ -13,4 +14,4 @@ export const SENTRY_DSN = "https://28220fd3185a1281daff09ade2114dca@o1036703.ing
13
14
  export const MAX_WAIT_PENDING_TIME_MS = 1000;
14
15
  export const POST_HOG_CAPTURE_KEY = "phc_LDSwSTOvIjiDDZql2g54Q7xEXoQ0EN9RMYb3STbdz1V";
15
16
  //# sourceMappingURL=constants.js.map
16
- //# debugId=8f9176c4-bdd2-5546-8161-2df78f8c8d2d
17
+ //# debugId=4daebd3e-ec9e-5f97-947a-e83332c8499e
@@ -0,0 +1,70 @@
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]="f9015546-77f3-5e6e-9d05-4742665613e8")}catch(e){}}();
3
+ import chalk from "chalk";
4
+ import { existsSync, mkdirSync } from "node:fs";
5
+ import { readFile, writeFile } from "node:fs/promises";
6
+ import { join } from "node:path";
7
+ import { gt } from "semver";
8
+ import { ZUPLO_VERSION_CHECK_FILE } from "./constants.js";
9
+ import { printWarningToConsole } from "./output.js";
10
+ import box from "./utils/box.js";
11
+ import { ZUPLO_XDG_STATE_HOME } from "./xdg/lib.js";
12
+ export async function warnIfOutdatedVersion(currentVersion) {
13
+ if (!process.env.ZUPLO_OVERRIDE_CI_TO_TEST &&
14
+ (process.env.CI || process.env.ZUPLO_DISABLE_UPDATE_CHECK)) {
15
+ return false;
16
+ }
17
+ const versionCheckInfo = await getVersionCheckInfo();
18
+ const shouldWarn = gt(versionCheckInfo.latestVersion, currentVersion);
19
+ if (shouldWarn) {
20
+ printWarningToConsole(box(`Update available! ${chalk.gray(`v${currentVersion}`)} ≫ ${chalk.green(`v${versionCheckInfo.latestVersion}`)}
21
+ Run ${chalk.cyan("npm install zuplo@latest")} to update.
22
+
23
+ ${chalk.gray("Older versions are unsupported and may not work as expected.")}`));
24
+ }
25
+ return shouldWarn;
26
+ }
27
+ async function getLatestVersion() {
28
+ const response = await fetch("https://raw.githubusercontent.com/zuplo/zuplo/main/packages/zuplo/package.json");
29
+ const result = await response.json();
30
+ return result.dependencies["@zuplo/cli"];
31
+ }
32
+ async function getVersionCheckInfo() {
33
+ if (!existsSync(ZUPLO_XDG_STATE_HOME)) {
34
+ mkdirSync(ZUPLO_XDG_STATE_HOME, { recursive: true });
35
+ }
36
+ const versionCheckPath = join(ZUPLO_XDG_STATE_HOME, ZUPLO_VERSION_CHECK_FILE);
37
+ let versionCheckInfo;
38
+ if (existsSync(versionCheckPath)) {
39
+ try {
40
+ versionCheckInfo = await readFile(versionCheckPath, "utf-8").then(JSON.parse);
41
+ }
42
+ catch (err) {
43
+ }
44
+ if (versionCheckInfo) {
45
+ if (typeof versionCheckInfo.lastCheck !== "number" ||
46
+ typeof versionCheckInfo.latestVersion !== "string") {
47
+ versionCheckInfo = undefined;
48
+ }
49
+ }
50
+ }
51
+ let shouldCheck = true;
52
+ if (versionCheckInfo) {
53
+ const now = Date.now();
54
+ const lastCheck = versionCheckInfo.lastCheck;
55
+ if (now - lastCheck < 1000 * 60 * 60 * 24) {
56
+ shouldCheck = false;
57
+ }
58
+ }
59
+ if (!versionCheckInfo || shouldCheck) {
60
+ const latestVersion = await getLatestVersion();
61
+ versionCheckInfo = {
62
+ lastCheck: Date.now(),
63
+ latestVersion,
64
+ };
65
+ await writeFile(versionCheckPath, JSON.stringify(versionCheckInfo), "utf-8");
66
+ }
67
+ return versionCheckInfo;
68
+ }
69
+ //# sourceMappingURL=outdated.js.map
70
+ //# debugId=f9015546-77f3-5e6e-9d05-4742665613e8
@@ -1,11 +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]="2df63d73-274e-5ba8-9b31-5a7a98c11051")}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]="c4c27bd6-8cfb-5bb5-86f6-e63b05aa573f")}catch(e){}}();
3
3
  import * as Sentry from "@sentry/node";
4
4
  import chalk from "chalk";
5
5
  import { MAX_WAIT_PENDING_TIME_MS } from "./constants.js";
6
6
  export function printDiagnosticsToConsole(message) {
7
7
  console.error(chalk.bold.blue(message));
8
8
  }
9
+ export function printWarningToConsole(message) {
10
+ console.error(message);
11
+ }
9
12
  export async function printCriticalFailureToConsoleAndExit(message) {
10
13
  console.error(chalk.bold.red(message));
11
14
  await Sentry.close(MAX_WAIT_PENDING_TIME_MS).then(() => {
@@ -51,4 +54,4 @@ export function textOrJson(text) {
51
54
  }
52
55
  }
53
56
  //# sourceMappingURL=output.js.map
54
- //# debugId=2df63d73-274e-5ba8-9b31-5a7a98c11051
57
+ //# debugId=c4c27bd6-8cfb-5bb5-86f6-e63b05aa573f
@@ -0,0 +1,55 @@
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]="2581e0ba-5dec-5b76-8b00-e2ed57baadcf")}catch(e){}}();
3
+ import chalk from "chalk";
4
+ import stripAnsi from "strip-ansi";
5
+ const border = ["─", "╭", "╮", "│", "│", "╰", "╯"];
6
+ const nothing = ["─", "", "", "", "", "", ""];
7
+ export default function box(message, { borderColor, padding = 1, textAlignment = "center", terminalColumns: cols = process.stdout.columns ||
8
+ (process.env.COLUMNS && parseInt(process.env.COLUMNS, 10)) ||
9
+ 80, } = {}) {
10
+ const lines = message
11
+ .split(/\r?\n/)
12
+ .map((line) => [line, stripAnsi(line).length]);
13
+ const maxLine = lines.reduce((p, [, len]) => Math.max(p, len), 0);
14
+ const borderColorFn = (borderColor && chalk[borderColor]) || chalk.yellow;
15
+ const clampedSidePadding = Math.max(1, padding * 3);
16
+ const narrowMode = maxLine + 2 + clampedSidePadding * 2 > cols;
17
+ const sidePadding = narrowMode ? 0 : clampedSidePadding;
18
+ const innerWidth = Math.min(maxLine + sidePadding * 2, cols);
19
+ const [hr, topLeft, topRight, left, right, bottomLeft, bottomRight] = narrowMode ? nothing : border;
20
+ const spacerRow = narrowMode
21
+ ? "\n".repeat(padding)
22
+ : `${borderColorFn(`${left}${" ".repeat(innerWidth)}${right}`)}\n`.repeat(padding);
23
+ const renderLine = ([line, len]) => {
24
+ let leftPadding = 0;
25
+ let rightPadding = 0;
26
+ if (!narrowMode) {
27
+ leftPadding = sidePadding;
28
+ rightPadding = sidePadding;
29
+ if (textAlignment === "center") {
30
+ leftPadding += Math.floor((maxLine - len) / 2);
31
+ rightPadding += maxLine - len - leftPadding + sidePadding;
32
+ }
33
+ else if (textAlignment === "right") {
34
+ leftPadding += maxLine - len;
35
+ }
36
+ else if (textAlignment === "left") {
37
+ rightPadding += maxLine - len;
38
+ }
39
+ }
40
+ return (borderColorFn(left) +
41
+ " ".repeat(leftPadding) +
42
+ line +
43
+ " ".repeat(rightPadding) +
44
+ borderColorFn(right));
45
+ };
46
+ return (borderColorFn(`${topLeft}${hr.repeat(innerWidth)}${topRight}`) +
47
+ "\n" +
48
+ spacerRow +
49
+ lines.map(renderLine).join("\n") +
50
+ "\n" +
51
+ spacerRow +
52
+ borderColorFn(`${bottomLeft}${hr.repeat(innerWidth)}${bottomRight}`));
53
+ }
54
+ //# sourceMappingURL=box.js.map
55
+ //# debugId=2581e0ba-5dec-5b76-8b00-e2ed57baadcf
@@ -1,9 +1,8 @@
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]="7fbaf77e-7785-5c59-af8e-6a90090cfb6f")}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]="dde8dcee-5646-5949-b230-50ff08e9b24e")}catch(e){}}();
3
3
  import { cpSync, existsSync } from "node:fs";
4
4
  import { join, relative, resolve } from "node:path";
5
5
  import { fileURLToPath, pathToFileURL } from "node:url";
6
- import { locateDenoExecutable } from "../common/deno-utils/locator.js";
7
6
  import { logger } from "../common/logger.js";
8
7
  import { printDiagnosticsToConsole } from "../common/output.js";
9
8
  import { ApiServer } from "../editor/server/server.js";
@@ -17,7 +16,6 @@ export async function dev(argv) {
17
16
  });
18
17
  }
19
18
  process.env.GLOBAL_MODULE_LOCATION = fileURLToPath(new URL("../../node_modules", import.meta.url));
20
- process.env.DENO_EXECUTABLE = await locateDenoExecutable();
21
19
  const loadedEnvFiles = [];
22
20
  const envFile = join(sourceDirectory, ".env");
23
21
  if (existsSync(envFile)) {
@@ -33,9 +31,10 @@ export async function dev(argv) {
33
31
  process.env.__ZUPLO_CONFIG = btoa(JSON.stringify(config));
34
32
  const core = await import("@zuplo/core");
35
33
  const port = argv.port;
36
- const serverProcess = await core.default.startDevServer({
34
+ await core.default.startDevServer({
37
35
  sourceDirectory,
38
36
  port,
37
+ devServerPort: undefined,
39
38
  generateSourceMaps: true,
40
39
  flags: {
41
40
  remoteModules: false,
@@ -67,7 +66,6 @@ export async function dev(argv) {
67
66
  return new Promise((resolve) => {
68
67
  async function exit() {
69
68
  printDiagnosticsToConsole("Closing local development setup");
70
- serverProcess.kill();
71
69
  if (argv["start-editor"]) {
72
70
  printDiagnosticsToConsole("Closing local route designer");
73
71
  await editor.close();
@@ -79,4 +77,4 @@ export async function dev(argv) {
79
77
  });
80
78
  }
81
79
  //# sourceMappingURL=handler.js.map
82
- //# debugId=7fbaf77e-7785-5c59-af8e-6a90090cfb6f
80
+ //# debugId=dde8dcee-5646-5949-b230-50ff08e9b24e
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zuplo/cli",
3
- "version": "1.109.0",
3
+ "version": "1.111.0",
4
4
  "type": "module",
5
5
  "repository": "https://github.com/zuplo/cli",
6
6
  "description": "The command-line interface for Zuplo",
@@ -54,20 +54,20 @@
54
54
  "mocha": "^10.2.0",
55
55
  "openapi-types": "^12.1.3",
56
56
  "prettier-plugin-organize-imports": "^3.2.2",
57
- "typescript": "^5.2.2"
57
+ "typescript": "^5.2.2",
58
+ "undici": "^6.10.1"
58
59
  },
59
60
  "dependencies": {
60
61
  "@fastify/cors": "^8.3.0",
61
62
  "@fastify/static": "^6.10.2",
62
- "@google-cloud/tasks": "5.1.1",
63
63
  "@inquirer/prompts": "^3.0.4",
64
64
  "@opentelemetry/api": "^1.8.0",
65
65
  "@sentry/node": "7.69.0",
66
66
  "@swc/core": "1.3.78",
67
- "@zuplo/core": "5.1982.0",
67
+ "@zuplo/core": "5.2074.0",
68
68
  "@zuplo/deno-bin": "1.37.1",
69
69
  "@zuplo/pino-pretty-configurations": "^1.5.0",
70
- "@zuplo/runtime": "5.1982.0",
70
+ "@zuplo/runtime": "5.2074.0",
71
71
  "chalk": "^5.1.2",
72
72
  "chokidar": "^3.5.3",
73
73
  "dotenv": "^16.3.1",
@@ -91,9 +91,11 @@
91
91
  "rollup-plugin-node-polyfills": "^0.2.1",
92
92
  "semver": "^7.5.2",
93
93
  "simple-git": "^3.17.0",
94
+ "strip-ansi": "^7.1.0",
94
95
  "tar": "^6.1.13",
95
96
  "temp": "^0.9.4",
96
97
  "uuid": "^9.0.1",
98
+ "workerd": "1.20240405.0",
97
99
  "yargs": "^17.7.1"
98
100
  }
99
101
  }