@zuplo/cli 1.137.0 → 2.1.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/README.md CHANGED
@@ -64,3 +64,12 @@ Commands:
64
64
  zup variable update Updates an existing variable for a branch
65
65
 
66
66
  ```
67
+
68
+ # Changelog
69
+
70
+ ## v2
71
+
72
+ - Removes the use of Deno's test runner. We now use the built-in test runner in
73
+ Node.js. All features are preserved; however, the output of `zup test` follows
74
+ the Node.js
75
+ [spec reporter](https://nodejs.org/docs/latest-v18.x/api/test.html#test-reporters).
@@ -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,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,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,23 +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]="f13aec76-f70a-5053-8b92-7e9a9134dbfc")}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]="5c127662-31c6-5178-a683-322b67f8580c")}catch(e){}}();
3
3
  import { TEST_OUT_FOLDER } from "../common/constants.js";
4
- import { denoTestPrepPlugin } from "./esbuild-plugins/deno-test-prep-plugin.js";
4
+ import { nodeTestPrepPlugin } from "./esbuild-plugins/node-test-prep-plugin.js";
5
5
  export function generateBuildOptionsForTest(argv) {
6
6
  return {
7
7
  outdir: `${argv.dir}/${TEST_OUT_FOLDER}`,
8
+ external: ["chai", "dotenv/config", "node:test"],
9
+ platform: "node",
8
10
  bundle: true,
9
11
  treeShaking: true,
10
12
  format: "esm",
11
13
  outExtension: {
12
- ".js": ".ts",
14
+ ".js": ".mjs",
13
15
  },
14
16
  plugins: [
15
- denoTestPrepPlugin(argv, {
17
+ nodeTestPrepPlugin(argv, {
16
18
  "@zuplo/test": "",
17
- chai: "https://cdn.skypack.dev/chai@4.3.4?dts",
18
19
  }),
19
20
  ],
20
21
  };
21
22
  }
22
23
  //# sourceMappingURL=esbuild-config.js.map
23
- //# debugId=f13aec76-f70a-5053-8b92-7e9a9134dbfc
24
+ //# debugId=5c127662-31c6-5178-a683-322b67f8580c
@@ -0,0 +1,65 @@
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]="c847b970-590a-5cd3-b907-2b9fad49c028")}catch(e){}}();
3
+ export function nodeTestPrepPlugin(argv, options) {
4
+ const aliases = Object.keys(options);
5
+ const re = new RegExp(`^(${aliases.map((x) => escapeRegExp(x)).join("|")})$`);
6
+ return {
7
+ name: "alias",
8
+ setup(build) {
9
+ build.onResolve({ filter: re }, (args) => {
10
+ if (/@zuplo\/test/.test(args.path)) {
11
+ return {
12
+ path: args.path,
13
+ namespace: "zuplo-url",
14
+ };
15
+ }
16
+ else {
17
+ return {
18
+ path: options[args.path],
19
+ namespace: "zuplo-url",
20
+ external: true,
21
+ };
22
+ }
23
+ });
24
+ build.onLoad({ filter: /.*/, namespace: "zuplo-url" }, (args) => {
25
+ if (/@zuplo\/test/.test(args.path)) {
26
+ return { contents: generateTestContents(argv), loader: "ts" };
27
+ }
28
+ });
29
+ },
30
+ };
31
+ }
32
+ function escapeRegExp(value) {
33
+ return value.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
34
+ }
35
+ function generateTestContents(argv) {
36
+ return `
37
+ import 'dotenv/config'
38
+ import { after, afterEach, describe, it, before, beforeEach } from "node:test"
39
+
40
+ export class TestHelper {
41
+ static get TEST_URL() {
42
+ const url = "${argv.endpoint}";
43
+ if (url !== "undefined") {
44
+ return url;
45
+ }
46
+
47
+ throw new Error("TEST_URL is not set. Pass --endpoint <URL> to \`zuplo test\` on the CLI to set a value.");
48
+ }
49
+
50
+ static get environment() {
51
+ return process.env;
52
+ }
53
+ }
54
+
55
+ const afterAll = after;
56
+ const beforeAll = before;
57
+
58
+ describe.ignore = describe.skip;
59
+ it.ignore = it.skip;
60
+
61
+ export {afterAll, afterEach, beforeAll, beforeEach, describe, it};
62
+ `;
63
+ }
64
+ //# sourceMappingURL=node-test-prep-plugin.js.map
65
+ //# debugId=c847b970-590a-5cd3-b907-2b9fad49c028
@@ -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]="08888ef0-037c-5716-a727-dd52d53a2f00")}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=08888ef0-037c-5716-a727-dd52d53a2f00
@@ -1,28 +1,27 @@
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]="a86033b8-649a-53cf-9f24-6b9f118258b4")}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]="91819abd-e850-5b4f-83ac-b91327da0a26")}catch(e){}}();
3
3
  import { execa } from "execa";
4
4
  import { TEST_OUT_FOLDER } from "../common/constants.js";
5
- import { locateDenoExecutable, MissingDenoExecutableError, } from "../common/deno-utils/locator.js";
6
5
  import { logger } from "../common/logger.js";
6
+ class MissingNodeExecutableError extends Error {
7
+ constructor() {
8
+ super("Missing executable: Cannot locate node executable");
9
+ Object.setPrototypeOf(this, MissingNodeExecutableError.prototype);
10
+ }
11
+ }
7
12
  export async function runTests(argv) {
8
- const denoExecutable = await locateDenoExecutable();
9
- if (denoExecutable) {
10
- const args = [
11
- "test",
12
- "--allow-env",
13
- "--allow-net",
14
- "--allow-read=.env,.env.defaults,.env.example,config/",
15
- "--no-check",
16
- ];
13
+ const nodeExecutable = process.platform === "win32" ? "node.exe" : "node";
14
+ if (nodeExecutable) {
15
+ const args = ["--test", "--test-reporter=spec"];
17
16
  if (argv.filter) {
18
- args.push("--filter", argv.filter);
17
+ args.push("--test-name-pattern", argv.filter);
19
18
  }
20
19
  args.push(`${argv.dir}/${TEST_OUT_FOLDER}`);
21
- const denoProcess = execa(denoExecutable, args);
22
- denoProcess.stdout?.pipe(process.stdout);
23
- denoProcess.stderr?.pipe(process.stderr);
20
+ const nodeProcess = execa(nodeExecutable, args);
21
+ nodeProcess.stdout?.pipe(process.stdout);
22
+ nodeProcess.stderr?.pipe(process.stderr);
24
23
  try {
25
- const result = await denoProcess;
24
+ const result = await nodeProcess;
26
25
  return result;
27
26
  }
28
27
  catch (err) {
@@ -31,8 +30,8 @@ export async function runTests(argv) {
31
30
  }
32
31
  }
33
32
  else {
34
- throw new MissingDenoExecutableError();
33
+ throw new MissingNodeExecutableError();
35
34
  }
36
35
  }
37
36
  //# sourceMappingURL=invoke-test.js.map
38
- //# debugId=a86033b8-649a-53cf-9f24-6b9f118258b4
37
+ //# debugId=91819abd-e850-5b4f-83ac-b91327da0a26
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zuplo/cli",
3
- "version": "1.137.0",
3
+ "version": "2.1.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,42 +29,36 @@
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",
67
61
  "@zuplo/core": "5.2458.0",
68
- "@zuplo/deno-bin": "1.37.1",
69
62
  "@zuplo/pino-pretty-configurations": "^1.5.0",
70
63
  "@zuplo/runtime": "5.2458.0",
71
64
  "chalk": "^5.1.2",
@@ -83,17 +76,15 @@
83
76
  "jsonc-parser": "3.2.0",
84
77
  "minimatch": "^9.0.3",
85
78
  "open": "^9.1.0",
86
- "pino": "^8.11.0",
87
- "pino-pretty": "^9.4.0",
79
+ "pino": "^9.3.2",
80
+ "pino-pretty": "^11.2.2",
88
81
  "posthog-node": "4.0.1",
89
- "prettier": "^2.8.7",
90
- "rimraf": "^3.0.2",
91
- "rollup-plugin-node-polyfills": "^0.2.1",
82
+ "prettier": "^3.3.3",
83
+ "rimraf": "^5.0.10",
92
84
  "semver": "^7.5.2",
93
85
  "simple-git": "^3.17.0",
94
86
  "strip-ansi": "^7.1.0",
95
- "tar": "^7.1.0",
96
- "temp": "^0.9.4",
87
+ "tar": "^7.4.3",
97
88
  "uuid": "^9.0.1",
98
89
  "workerd": "1.20240725.0",
99
90
  "yargs": "^17.7.1"
@@ -1,29 +0,0 @@
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]="8edf8105-ebeb-518f-8885-8891eb778b11")}catch(e){}}();
3
- import { existsSync } from "node:fs";
4
- import { dirname, resolve } from "node:path";
5
- import { fileURLToPath } from "node:url";
6
- import { logger } from "../logger.js";
7
- export class MissingDenoExecutableError extends Error {
8
- constructor() {
9
- super("Missing executable: Cannot locate deno executable");
10
- Object.setPrototypeOf(this, MissingDenoExecutableError.prototype);
11
- }
12
- }
13
- export async function locateDenoExecutable() {
14
- return locateDeno(dirname(fileURLToPath(import.meta.url)));
15
- }
16
- export async function locateDeno(dir) {
17
- const DENO_EXECUTABLE = process.platform === "win32" ? "deno.exe" : "deno";
18
- if (dir === ".") {
19
- return undefined;
20
- }
21
- const pathToDeno = resolve(dir, "node_modules", "@zuplo/deno-bin", "bin", DENO_EXECUTABLE);
22
- if (await existsSync(pathToDeno)) {
23
- logger.debug(`Path to deno: ${pathToDeno}`);
24
- return pathToDeno;
25
- }
26
- return locateDeno(dirname(dir));
27
- }
28
- //# sourceMappingURL=locator.js.map
29
- //# debugId=8edf8105-ebeb-518f-8885-8891eb778b11
@@ -1,99 +0,0 @@
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]="327f255c-47ca-568f-9b06-a3716ca6b328")}catch(e){}}();
3
- export function denoTestPrepPlugin(argv, options) {
4
- const aliases = Object.keys(options);
5
- const re = new RegExp(`^(${aliases.map((x) => escapeRegExp(x)).join("|")})$`);
6
- return {
7
- name: "alias",
8
- setup(build) {
9
- build.onResolve({ filter: re }, (args) => {
10
- if (/@zuplo\/test/.test(args.path)) {
11
- return {
12
- path: args.path,
13
- namespace: "deno-url",
14
- };
15
- }
16
- else {
17
- return {
18
- path: options[args.path],
19
- namespace: "deno-url",
20
- external: true,
21
- };
22
- }
23
- });
24
- build.onLoad({ filter: /.*/, namespace: "deno-url" }, (args) => {
25
- if (/@zuplo\/test/.test(args.path)) {
26
- return { contents: generateTestContents(argv), loader: "ts" };
27
- }
28
- });
29
- },
30
- };
31
- }
32
- function escapeRegExp(value) {
33
- return value.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
34
- }
35
- function generateTestContents(argv) {
36
- return `
37
-
38
- // Load environment variables
39
- import { load } from "https://deno.land/std@0.203.0/dotenv/mod.ts";
40
- await load();
41
-
42
- export class TestHelper {
43
- static get TEST_URL() {
44
- const url = "${argv.endpoint}";
45
- if (url !== "undefined") {
46
- return url;
47
- }
48
-
49
- throw new Error("TEST_URL is not set. Pass --endpoint <URL> to \`zuplo test\` on the CLI to set a value.");
50
- }
51
-
52
- static get environment() {
53
- return Deno.env.toObject();
54
- }
55
- }
56
-
57
- import {
58
- afterAll,
59
- afterEach,
60
- beforeAll,
61
- beforeEach,
62
- describe as originalDescribe,
63
- it,
64
- } from "https://deno.land/std@0.203.0/testing/bdd.ts";
65
-
66
- // We want to be able to disable test sanitizers by default to
67
- // make tests easier/more familiar to write.
68
-
69
- function describe<T>(
70
- name: string,
71
- fn: () => void | Promise<void>,
72
- ): TestSuite<T> {
73
- return originalDescribe(name, {
74
- sanitizeExit: false,
75
- sanitizeOps: false,
76
- sanitizeResources: false,
77
- }, fn);
78
- }
79
-
80
- describe.only = function describeOnly<T>(
81
- name: string,
82
- fn: () => void | Promise<void>,
83
- ): TestSuite<T> {
84
- return originalDescribe.only(name, fn);
85
- };
86
-
87
- describe.ignore = function describeIgnore<T>(
88
- name: string,
89
- fn: () => void | Promise<void>,
90
- ): TestSuite<T> {
91
- return originalDescribe.ignore(name, fn);
92
- };
93
-
94
- export {afterAll, afterEach, beforeAll, beforeEach, describe, it};
95
-
96
- `;
97
- }
98
- //# sourceMappingURL=deno-test-prep-plugin.js.map
99
- //# debugId=327f255c-47ca-568f-9b06-a3716ca6b328