@zuplo/cli 1.136.0 → 1.138.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/link.js CHANGED
@@ -1,10 +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]="6247c8c4-d880-5d58-a70d-da8c9cd6a68a")}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]="0be777a5-8b5e-574a-8780-387d75ffa1a8")}catch(e){}}();
3
3
  import { captureEvent } from "../common/analytics/lib.js";
4
4
  import { configure } from "../common/middleware/user-configuration.js";
5
5
  import { identify } from "../common/middleware/user-identification.js";
6
6
  import setBlocking from "../common/output.js";
7
- import { validLinkDirectoryValidator } from "../common/validators/file-system-validator.js";
7
+ import { ZuploProjectValidator } from "../common/validators/file-system-validator.js";
8
8
  import { YargsChecker } from "../common/validators/lib.js";
9
9
  import { link } from "../link/handler.js";
10
10
  export default {
@@ -23,10 +23,6 @@ export default {
23
23
  type: "string",
24
24
  describe: "The API Key from Zuplo",
25
25
  envVar: "API_KEY",
26
- })
27
- .option("account", {
28
- type: "string",
29
- describe: "The account name",
30
26
  })
31
27
  .option("project", {
32
28
  type: "string",
@@ -39,7 +35,7 @@ export default {
39
35
  .demandOption(["api-key"])
40
36
  .middleware([setBlocking, configure, identify])
41
37
  .check(async (argv) => {
42
- return await new YargsChecker(validLinkDirectoryValidator).check(argv);
38
+ return await new YargsChecker(new ZuploProjectValidator()).check(argv);
43
39
  });
44
40
  },
45
41
  handler: async (argv) => {
@@ -48,4 +44,4 @@ export default {
48
44
  },
49
45
  };
50
46
  //# sourceMappingURL=link.js.map
51
- //# debugId=6247c8c4-d880-5d58-a70d-da8c9cd6a68a
47
+ //# debugId=0be777a5-8b5e-574a-8780-387d75ffa1a8
@@ -1,11 +1,11 @@
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]="06344ac3-9b00-5aab-b199-3e6faa6f3a3d")}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]="9e5192b9-6633-50a5-9d82-31772de9bdcc")}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";
6
6
  import { login } from "../login/handler.js";
7
7
  export default {
8
- desc: "Authenticates the user",
8
+ desc: false,
9
9
  command: "login",
10
10
  builder: (yargs) => {
11
11
  return yargs
@@ -21,4 +21,4 @@ export default {
21
21
  },
22
22
  };
23
23
  //# sourceMappingURL=login.js.map
24
- //# debugId=06344ac3-9b00-5aab-b199-3e6faa6f3a3d
24
+ //# debugId=9e5192b9-6633-50a5-9d82-31772de9bdcc
@@ -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]="9679ce39-91f8-5b74-ad15-9a9a9427e410")}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]="e03e4373-c6b2-5c5e-b73d-fcff6d7d010b")}catch(e){}}();
3
3
  import { readFile, writeFile } from "node:fs/promises";
4
4
  import { join } from "node:path";
5
5
  import prettier from "prettier";
@@ -56,7 +56,7 @@ export class PackageJsonUpgrader extends StandardUpgrader {
56
56
  if (packageJson.devDependencies["@types/chai"])
57
57
  delete packageJson.devDependencies["@types/chai"];
58
58
  }
59
- const formatted = prettier.format(JSON.stringify(packageJson), {
59
+ const formatted = await prettier.format(JSON.stringify(packageJson), {
60
60
  parser: "json-stringify",
61
61
  quoteProps: "as-needed",
62
62
  });
@@ -64,4 +64,4 @@ export class PackageJsonUpgrader extends StandardUpgrader {
64
64
  }
65
65
  }
66
66
  //# sourceMappingURL=package-json-upgrader.js.map
67
- //# debugId=9679ce39-91f8-5b74-ad15-9a9a9427e410
67
+ //# debugId=e03e4373-c6b2-5c5e-b73d-fcff6d7d010b
@@ -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]="427b8d5d-9342-514f-bb93-cc1119525f44")}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]="2c738faa-55e9-5587-ad3f-7939112799e0")}catch(e){}}();
3
3
  import { parse } from "jsonc-parser";
4
4
  import { existsSync } from "node:fs";
5
5
  import { readFile, writeFile } from "node:fs/promises";
@@ -66,7 +66,7 @@ export class VsCodeSettingsJsonUpgrader extends StandardUpgrader {
66
66
  }
67
67
  ]
68
68
  }`;
69
- const formatted = prettier.format(content, {
69
+ const formatted = await prettier.format(content, {
70
70
  parser: "json",
71
71
  quoteProps: "as-needed",
72
72
  });
@@ -84,7 +84,7 @@ export class VsCodeSettingsJsonUpgrader extends StandardUpgrader {
84
84
  settingsJson["json.schemas"].push(schema);
85
85
  }
86
86
  }
87
- const formatted = prettier.format(JSON.stringify(settingsJson), {
87
+ const formatted = await prettier.format(JSON.stringify(settingsJson), {
88
88
  parser: "json",
89
89
  quoteProps: "as-needed",
90
90
  });
@@ -93,4 +93,4 @@ export class VsCodeSettingsJsonUpgrader extends StandardUpgrader {
93
93
  }
94
94
  }
95
95
  //# sourceMappingURL=vscode-settings-json-upgrader.js.map
96
- //# debugId=427b8d5d-9342-514f-bb93-cc1119525f44
96
+ //# debugId=2c738faa-55e9-5587-ad3f-7939112799e0
@@ -1,12 +1,11 @@
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]="ec896cd1-5086-5370-b8b3-2b5276946dee")}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]="a750d299-a353-5bcd-b91f-5638e7666ba6")}catch(e){}}();
3
3
  import fg from "fast-glob";
4
4
  import { existsSync, readdirSync } from "node:fs";
5
5
  import { join } from "node:path";
6
6
  import { simpleGit } from "simple-git";
7
7
  import { TEST_IN_FOLDER } from "../constants.js";
8
8
  import { CompositeValidator } from "./lib.js";
9
- import { IsZupLinkInvocableValidator } from "./login-state-validator.js";
10
9
  import { ProjectIsSetValidator } from "./project-name-validator.js";
11
10
  export class NotAGitRepoError extends Error {
12
11
  constructor() {
@@ -161,6 +160,5 @@ export class ZuploProjectHasTestsValidator {
161
160
  }
162
161
  export const validDeployDirectoryValidator = new CompositeValidator(new ZuploProjectValidator(), new GitVersionControlValidator(), new GitCommitValidator(), new GitBranchValidator(), new GitRemoteValidator(), new ProjectIsSetValidator());
163
162
  export const validTestDirectoryValidator = new CompositeValidator(new ZuploProjectValidator(), new ZuploProjectHasTestsValidator());
164
- export const validLinkDirectoryValidator = new CompositeValidator(new ZuploProjectValidator(), new IsZupLinkInvocableValidator());
165
163
  //# sourceMappingURL=file-system-validator.js.map
166
- //# debugId=ec896cd1-5086-5370-b8b3-2b5276946dee
164
+ //# debugId=a750d299-a353-5bcd-b91f-5638e7666ba6
@@ -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]="e6a52b60-c0b1-5706-8119-a479c0ba9592")}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]="7ee0b975-ed5e-5b29-8cde-a84beac8baad")}catch(e){}}();
3
3
  import { writeFileSync } from "node:fs";
4
4
  import { readFile } from "node:fs/promises";
5
5
  import { join, relative } from "node:path";
@@ -15,7 +15,7 @@ export async function convert(argv) {
15
15
  const routes = JSON.parse(rawRoutes.toString());
16
16
  const openApi = convertRoutes(routes);
17
17
  const openAPIFilePath = join(normalizedDir, "config", "routes.oas.json");
18
- const formattedOpenAPI = prettier.format(JSON.stringify(openApi), {
18
+ const formattedOpenAPI = await prettier.format(JSON.stringify(openApi), {
19
19
  parser: "json-stringify",
20
20
  });
21
21
  writeFileSync(openAPIFilePath, formattedOpenAPI, {
@@ -23,7 +23,7 @@ export async function convert(argv) {
23
23
  });
24
24
  const policies = convertPolicies(routes);
25
25
  const policiesFilePath = join(normalizedDir, "config", "policies.json");
26
- const formattedPolicies = prettier.format(JSON.stringify(policies), {
26
+ const formattedPolicies = await prettier.format(JSON.stringify(policies), {
27
27
  parser: "json-stringify",
28
28
  });
29
29
  writeFileSync(policiesFilePath, formattedPolicies, {
@@ -36,4 +36,4 @@ export async function convert(argv) {
36
36
  }
37
37
  }
38
38
  //# sourceMappingURL=handler.js.map
39
- //# debugId=e6a52b60-c0b1-5706-8119-a479c0ba9592
39
+ //# debugId=7ee0b975-ed5e-5b29-8cde-a84beac8baad
@@ -1,17 +1,24 @@
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]="a334ee0f-c282-5c19-8ff1-5d9a20596571")}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]="2a68c8a7-7685-52e4-93e9-6b7b75a92f82")}catch(e){}}();
3
3
  import ignore from "ignore";
4
4
  import { minimatch } from "minimatch";
5
+ import { randomBytes } from "node:crypto";
5
6
  import { existsSync, mkdirSync, readFileSync, writeFileSync, } from "node:fs";
7
+ import { tmpdir } from "node:os";
6
8
  import { join, relative, sep } from "node:path";
7
9
  import { simpleGit } from "simple-git";
8
10
  import * as tar from "tar";
9
- import * as temp from "temp";
10
11
  import { DEPLOYER_METADATA_FILE } from "../common/constants.js";
11
12
  import { logger } from "../common/logger.js";
12
13
  export const ARCHIVE_EXTENSION = ".tar.gz";
14
+ function createTempFileWithSuffix(suffix = ARCHIVE_EXTENSION) {
15
+ const tempDir = tmpdir();
16
+ const randomName = randomBytes(16).toString("hex");
17
+ const tempFilePath = join(tempDir, `${randomName}${suffix}`);
18
+ return tempFilePath;
19
+ }
13
20
  export async function archive(argv) {
14
- const tarball = temp.path({ suffix: ARCHIVE_EXTENSION });
21
+ const tarball = createTempFileWithSuffix();
15
22
  const dir = argv.dir;
16
23
  const ignoreFn = createIgnoreFunction(dir);
17
24
  const normalizedDir = join(relative(process.cwd(), dir));
@@ -108,4 +115,4 @@ async function writeGeneratedMetadata(dir, metadata) {
108
115
  });
109
116
  }
110
117
  //# sourceMappingURL=archive.js.map
111
- //# debugId=a334ee0f-c282-5c19-8ff1-5d9a20596571
118
+ //# debugId=2a68c8a7-7685-52e4-93e9-6b7b75a92f82
@@ -1,70 +1,40 @@
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]="ed7a03fb-41e9-565b-95ab-4e4d54930128")}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]="f5e0af3e-c906-5b69-ba89-acd89c389920")}catch(e){}}();
3
3
  import { select } from "@inquirer/prompts";
4
- import { readFile } from "node:fs/promises";
5
- import { join } from "node:path";
6
- import { ZUPLO_AUTH_FILE_NAME } from "../common/constants.js";
7
4
  import { logger } from "../common/logger.js";
8
5
  import { printCriticalFailureToConsoleAndExit, printResultToConsoleAndExitGracefully, textOrJson, } from "../common/output.js";
9
6
  import settings from "../common/settings.js";
10
- import { ZUPLO_XDG_STATE_HOME } from "../common/xdg/lib.js";
11
7
  import { pullSystemConfig, safeMergeConfig } from "./populate.js";
12
- function prettyPrintEnvironmentPrompt(env) {
13
- const name = env.name;
8
+ function prettyPrintEnvironmentPrompt(env, hasSingleDevelopmentInstance) {
14
9
  let environmentType = env.environmentType.toLowerCase();
15
10
  let branchName = env.branchName;
11
+ let name = env.name;
16
12
  switch (environmentType) {
17
13
  case "working-copy":
18
14
  case "working_copy":
19
- environmentType = "development";
20
- branchName = "(via portal.zuplo.com)";
21
- break;
15
+ case "development":
16
+ if (hasSingleDevelopmentInstance) {
17
+ name = "Default for local development";
18
+ environmentType = "development";
19
+ branchName = "";
20
+ return `${name} (${environmentType})`;
21
+ }
22
+ else {
23
+ environmentType = "development";
24
+ branchName = "";
25
+ return `${name} (${environmentType})`;
26
+ }
22
27
  }
23
- return `${env.name} (${environmentType}, ${branchName})`;
28
+ return `${name} (${environmentType}, ${branchName})`;
24
29
  }
25
30
  export async function link(argv) {
31
+ const account = argv.account;
26
32
  let environment = argv.environment;
27
- let authJson = undefined;
28
- if (!environment) {
29
- const rawAuth = await readFile(join(ZUPLO_XDG_STATE_HOME, ZUPLO_AUTH_FILE_NAME), "utf-8");
30
- authJson = JSON.parse(rawAuth);
31
- }
32
- let account = argv.account;
33
- if (!environment && !account) {
34
- const accountResponse = await fetch(`${settings.ZUPLO_API_ENDPOINT}/v1/accounts`, {
35
- headers: {
36
- authorization: `Bearer ${authJson.access_token}`,
37
- },
38
- });
39
- if (!accountResponse.ok) {
40
- logger.error({
41
- status: accountResponse.status,
42
- statusText: accountResponse.statusText,
43
- response: textOrJson(await accountResponse.text()),
44
- }, "Failed to list accounts.");
45
- await printCriticalFailureToConsoleAndExit("Error: Failed to list your accounts. Try again later.");
46
- }
47
- const accountJson = (await accountResponse.json());
48
- if (accountJson.length === 1) {
49
- account = accountJson[0].name;
50
- }
51
- else {
52
- account = await select({
53
- message: "Select the account to work with",
54
- choices: accountJson.map((acc) => {
55
- return {
56
- name: acc.name,
57
- value: acc.name,
58
- };
59
- }),
60
- });
61
- }
62
- }
63
33
  let project = argv.project;
64
34
  if (!environment && !project) {
65
- const projectResponse = await fetch(`${settings.ZUPLO_API_ENDPOINT}/v1/accounts/${account}/projects`, {
35
+ const projectResponse = await fetch(`${settings.ZUPLO_DEVELOPER_API_ENDPOINT}/v1/projects`, {
66
36
  headers: {
67
- authorization: `Bearer ${authJson.access_token}`,
37
+ authorization: `Bearer ${argv["api-key"]}`,
68
38
  },
69
39
  });
70
40
  if (!projectResponse.ok) {
@@ -92,30 +62,55 @@ export async function link(argv) {
92
62
  }
93
63
  }
94
64
  if (!environment) {
95
- const environmentResponseFromZuploAPI = await fetch(`${settings.ZUPLO_API_ENDPOINT}/v1/accounts/${account}/projects/${project}/deployments`, {
96
- headers: {
97
- authorization: `Bearer ${authJson.access_token}`,
98
- },
99
- });
100
- const environmentJsonFromZuploAPI = (await environmentResponseFromZuploAPI.json());
101
- const environmentResponseFromDeveloperAPI = await fetch(`${settings.ZUPLO_DEVELOPER_API_ENDPOINT}/v1/accounts/${account}/projects/${project}/deployments`, {
65
+ const baseUrl = `${settings.ZUPLO_DEVELOPER_API_ENDPOINT}/v1/environments`;
66
+ const queryParams = {
67
+ accountName: account,
68
+ projectName: project,
69
+ };
70
+ const url = new URL(baseUrl);
71
+ url.search = new URLSearchParams(queryParams).toString();
72
+ let environmentResponseFromDeveloperAPI = await fetch(url, {
102
73
  headers: {
103
74
  authorization: `Bearer ${argv["api-key"]}`,
104
75
  },
105
76
  });
106
- const environmentJsonFromDeveloperAPI = (await environmentResponseFromDeveloperAPI.json());
107
- const environments = Object.assign({}, environmentJsonFromZuploAPI.data
108
- .map((env) => {
109
- return {
110
- [prettyPrintEnvironmentPrompt(env)]: env.name,
111
- };
112
- })
113
- .reduce((acc, curr) => {
114
- return { ...acc, ...curr };
115
- }), environmentJsonFromDeveloperAPI.data
77
+ let environmentJsonFromDeveloperAPI = (await environmentResponseFromDeveloperAPI.json());
78
+ let numDevelopmentEnvironments = environmentJsonFromDeveloperAPI.data.filter((env) => {
79
+ return env.environmentType === "development";
80
+ }).length;
81
+ if (numDevelopmentEnvironments <= 0) {
82
+ const createDevelopmenEnvironmentResponse = await fetch(`${baseUrl}`, {
83
+ method: "POST",
84
+ headers: {
85
+ authorization: `Bearer ${argv["api-key"]}`,
86
+ "Content-Type": "application/json",
87
+ },
88
+ body: JSON.stringify({
89
+ accountName: account,
90
+ projectName: project,
91
+ environmentType: "development",
92
+ }),
93
+ });
94
+ if (!createDevelopmenEnvironmentResponse.ok) {
95
+ logger.debug({
96
+ status: createDevelopmenEnvironmentResponse.status,
97
+ statusText: createDevelopmenEnvironmentResponse.statusText,
98
+ }, "Failed to create a new instance of development environment");
99
+ await printCriticalFailureToConsoleAndExit("Failed to create a new development environment. Please try again later.");
100
+ }
101
+ numDevelopmentEnvironments++;
102
+ environmentResponseFromDeveloperAPI = await fetch(url, {
103
+ headers: {
104
+ authorization: `Bearer ${argv["api-key"]}`,
105
+ },
106
+ });
107
+ environmentJsonFromDeveloperAPI =
108
+ (await environmentResponseFromDeveloperAPI.json());
109
+ }
110
+ const environments = Object.assign({}, environmentJsonFromDeveloperAPI.data
116
111
  .map((env) => {
117
112
  return {
118
- [prettyPrintEnvironmentPrompt(env)]: env.name,
113
+ [prettyPrintEnvironmentPrompt(env, numDevelopmentEnvironments == 1)]: env.name,
119
114
  };
120
115
  })
121
116
  .reduce((acc, curr) => {
@@ -146,4 +141,4 @@ Successfully linked your local directory to the ${project} project in the ${acco
146
141
  .env.zuplo and zuplo.jsonc have been updated with the new values.`);
147
142
  }
148
143
  //# sourceMappingURL=handler.js.map
149
- //# debugId=ed7a03fb-41e9-565b-95ab-4e4d54930128
144
+ //# debugId=f5e0af3e-c906-5b69-ba89-acd89c389920
@@ -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]="a94104ad-6a44-5d00-851d-f9a06e68c72c")}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]="67cff82f-69c9-50d3-876f-40e3b6b9afd6")}catch(e){}}();
3
3
  import { applyEdits, modify } from "jsonc-parser";
4
4
  import { existsSync } from "node:fs";
5
5
  import { readFile, writeFile } from "node:fs/promises";
@@ -19,7 +19,7 @@ export async function safeMergeConfig(dir, project) {
19
19
  getInsertionIndex: () => 2,
20
20
  });
21
21
  const contentsPostProject = applyEdits(originalContents, modifyProjectEdit);
22
- const formatted = prettier.format(contentsPostProject, {
22
+ const formatted = await prettier.format(contentsPostProject, {
23
23
  parser: "json",
24
24
  quoteProps: "as-needed",
25
25
  });
@@ -27,7 +27,7 @@ export async function safeMergeConfig(dir, project) {
27
27
  }
28
28
  else if (existsSync(zuploFallbackConfigFile)) {
29
29
  const config = JSON.parse(await readFile(zuploFallbackConfigFile, "utf-8"));
30
- const formatted = prettier.format(JSON.stringify({
30
+ const formatted = await prettier.format(JSON.stringify({
31
31
  version: 1,
32
32
  project: project,
33
33
  compatibilityDate: config.compatibilityDate,
@@ -38,7 +38,7 @@ export async function safeMergeConfig(dir, project) {
38
38
  await writeFile(zuploPreferredConfigFile, formatted);
39
39
  }
40
40
  else {
41
- const formatted = prettier.format(JSON.stringify({
41
+ const formatted = await prettier.format(JSON.stringify({
42
42
  version: 1,
43
43
  project: project,
44
44
  compatibilityDate: "2023-03-14",
@@ -84,4 +84,4 @@ ZUPLO_SYSTEM_CONFIGURATIONS=${payload["systemConfigurations"]}
84
84
  await writeFile(zuploPreferredConfigFile, content);
85
85
  }
86
86
  //# sourceMappingURL=populate.js.map
87
- //# debugId=a94104ad-6a44-5d00-851d-f9a06e68c72c
87
+ //# debugId=67cff82f-69c9-50d3-876f-40e3b6b9afd6
@@ -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]="f2551837-2c92-5d06-a4ed-dc11de482182")}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]="2c36d082-afe3-5d10-a05d-e20f9c10dcf8")}catch(e){}}();
3
3
  import { logger } from "../common/logger.js";
4
4
  import { printCriticalFailureToConsoleAndExit, printDiagnosticsToConsole, printResultToConsoleAndExitGracefully, textOrJson, } from "../common/output.js";
5
5
  import settings from "../common/settings.js";
@@ -23,7 +23,7 @@ async function listFromSaas(argv) {
23
23
  });
24
24
  if (listResponse.ok) {
25
25
  const { data: deployments } = await listResponse.json();
26
- const output = deployments.map((deployment) => deployment.url).join("\n");
26
+ const output = deployments.filter((deployment) => deployment.url).map((deployment) => deployment.url).join("\n");
27
27
  await printResultToConsoleAndExitGracefully(output);
28
28
  }
29
29
  else {
@@ -56,4 +56,4 @@ async function listFromSelfHosted(argv) {
56
56
  }
57
57
  }
58
58
  //# sourceMappingURL=handler.js.map
59
- //# debugId=f2551837-2c92-5d06-a4ed-dc11de482182
59
+ //# debugId=2c36d082-afe3-5d10-a05d-e20f9c10dcf8
@@ -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]="033f0170-115e-58e0-8515-63e43519f59c")}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]="c5129a8e-104c-557e-bd58-09f307c47a3f")}catch(e){}}();
3
3
  import { confirm } from "@inquirer/prompts";
4
4
  import jsYaml from "js-yaml";
5
5
  import { existsSync, writeFileSync } from "node:fs";
@@ -133,7 +133,7 @@ export async function importOpenApi(argv) {
133
133
  }
134
134
  }
135
135
  addOperationIdsAsNecessary(parsedOpenApiSpec);
136
- const formattedOpenApi = prettier.format(JSON.stringify(parsedOpenApiSpec), {
136
+ const formattedOpenApi = await prettier.format(JSON.stringify(parsedOpenApiSpec), {
137
137
  parser: "json-stringify",
138
138
  });
139
139
  writeFileSync(destinationFilePath, formattedOpenApi, {
@@ -142,4 +142,4 @@ export async function importOpenApi(argv) {
142
142
  await printResultToConsoleAndExitGracefully(`Import successful. File written to ${destinationFilePath}`);
143
143
  }
144
144
  //# sourceMappingURL=handler.js.map
145
- //# debugId=033f0170-115e-58e0-8515-63e43519f59c
145
+ //# debugId=c5129a8e-104c-557e-bd58-09f307c47a3f
@@ -1,16 +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]="22d3731c-201b-5303-ad12-25a85ff3fb29")}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]="1ca2f9a0-dd2a-5e05-9db2-0a83d26896ad")}catch(e){}}();
3
3
  import fg from "fast-glob";
4
- import { promisify } from "node:util";
5
- import rimraf from "rimraf";
4
+ import { rimrafSync } from "rimraf";
6
5
  import { TEST_IN_FOLDER, TEST_OUT_FOLDER } from "../common/constants.js";
7
6
  import { logger } from "../common/logger.js";
8
7
  import { generateBuildOptionsForTest } from "./esbuild-config.js";
9
8
  import { runTests } from "./invoke-test.js";
10
- const rimrafp = promisify(rimraf);
11
9
  import esbuild from "esbuild";
12
10
  export async function test(argv) {
13
- await rimrafp(`${argv.dir}/${TEST_OUT_FOLDER}`);
11
+ rimrafSync(`${argv.dir}/${TEST_OUT_FOLDER}`);
14
12
  const result = await esbuild.build({
15
13
  ...generateBuildOptionsForTest(argv),
16
14
  entryPoints: fg.sync(`${argv.dir}/${TEST_IN_FOLDER}/**/*.test.ts`),
@@ -27,4 +25,4 @@ export async function test(argv) {
27
25
  }
28
26
  }
29
27
  //# sourceMappingURL=handler.js.map
30
- //# debugId=22d3731c-201b-5303-ad12-25a85ff3fb29
28
+ //# debugId=1ca2f9a0-dd2a-5e05-9db2-0a83d26896ad
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zuplo/cli",
3
- "version": "1.136.0",
3
+ "version": "1.138.0",
4
4
  "type": "module",
5
5
  "repository": "https://github.com/zuplo/cli",
6
6
  "description": "The command-line interface for Zuplo",
@@ -11,8 +11,7 @@
11
11
  "build": "tsc --build && node ./scripts/post-build.js",
12
12
  "clean": "git clean -Xfde !.env",
13
13
  "sentry:sourcemaps": "sentry-cli sourcemaps inject --org zuplo --project zuplo-cli ./dist",
14
- "test": "mocha",
15
- "test:debug": "mocha --timeout 0"
14
+ "test": "node --test dist/**/*.spec.js"
16
15
  },
17
16
  "engines": {
18
17
  "node": ">=18.0.0"
@@ -30,37 +29,32 @@
30
29
  },
31
30
  "devDependencies": {
32
31
  "@sentry/cli": "^2.20.7",
33
- "@types/chai": "^4.3.4",
34
- "@types/js-yaml": "^4.0.8",
35
- "@types/mocha": "^10.0.1",
32
+ "@types/chai": "^4.3.17",
33
+ "@types/js-yaml": "^4.0.9",
36
34
  "@types/node": "^18.15.11",
37
- "@types/prettier": "^2.7.2",
38
- "@types/rimraf": "^3.0.2",
39
- "@types/semver": "^7.3.13",
40
- "@types/tar": "^6.1.4",
41
- "@types/temp": "^0.9.1",
42
- "@types/uuid": "^9.0.6",
43
- "@types/yargs": "^17.0.24",
44
- "@typescript-eslint/eslint-plugin": "^5.57.1",
45
- "@typescript-eslint/parser": "^5.57.1",
46
- "chai": "^4.3.7",
47
- "eslint": "^8.37.0",
48
- "eslint-config-prettier": "^8.8.0",
49
- "eslint-plugin-import": "^2.27.5",
35
+ "@types/semver": "^7.5.8",
36
+ "@types/tar": "^6.1.13",
37
+ "@types/temp": "^0.9.4",
38
+ "@types/uuid": "^10.0.0",
39
+ "@types/yargs": "^17.0.33",
40
+ "@typescript-eslint/eslint-plugin": "^8.2.0",
41
+ "@typescript-eslint/parser": "^8.2.0",
42
+ "chai": "^5.1.1",
43
+ "eslint": "^9.9.1",
44
+ "eslint-config-prettier": "^9.1.0",
50
45
  "eslint-plugin-node": "^11.1.0",
51
- "eslint-plugin-unicorn": "^44.0.2",
52
- "husky": "^8.0.3",
53
- "lint-staged": "^13.2.0",
54
- "mocha": "^10.2.0",
46
+ "eslint-plugin-unicorn": "^55.0.0",
47
+ "husky": "^9.1.5",
48
+ "lint-staged": "^15.2.9",
55
49
  "openapi-types": "^12.1.3",
56
- "prettier-plugin-organize-imports": "^3.2.2",
57
- "typescript": "^5.2.2",
58
- "undici": "^6.10.1"
50
+ "prettier-plugin-organize-imports": "^4.0.0",
51
+ "typescript": "^5.5.4",
52
+ "undici": "^6.19.8"
59
53
  },
60
54
  "dependencies": {
61
- "@fastify/cors": "^8.3.0",
62
- "@fastify/static": "^6.10.2",
63
- "@inquirer/prompts": "^3.0.4",
55
+ "@fastify/cors": "^9.0.1",
56
+ "@fastify/static": "^7.0.4",
57
+ "@inquirer/prompts": "^5.3.8",
64
58
  "@opentelemetry/api": "^1.8.0",
65
59
  "@sentry/node": "7.69.0",
66
60
  "@swc/core": "1.3.78",
@@ -83,17 +77,15 @@
83
77
  "jsonc-parser": "3.2.0",
84
78
  "minimatch": "^9.0.3",
85
79
  "open": "^9.1.0",
86
- "pino": "^8.11.0",
87
- "pino-pretty": "^9.4.0",
80
+ "pino": "^9.3.2",
81
+ "pino-pretty": "^11.2.2",
88
82
  "posthog-node": "4.0.1",
89
- "prettier": "^2.8.7",
90
- "rimraf": "^3.0.2",
91
- "rollup-plugin-node-polyfills": "^0.2.1",
83
+ "prettier": "^3.3.3",
84
+ "rimraf": "^5.0.10",
92
85
  "semver": "^7.5.2",
93
86
  "simple-git": "^3.17.0",
94
87
  "strip-ansi": "^7.1.0",
95
- "tar": "^7.1.0",
96
- "temp": "^0.9.4",
88
+ "tar": "^7.4.3",
97
89
  "uuid": "^9.0.1",
98
90
  "workerd": "1.20240725.0",
99
91
  "yargs": "^17.7.1"