@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 +9 -0
- package/dist/common/upgraders/package-json-upgrader.js +3 -3
- package/dist/common/upgraders/vscode-settings-json-upgrader.js +4 -4
- package/dist/convert/handler.js +4 -4
- package/dist/deploy/archive.js +11 -4
- package/dist/link/populate.js +5 -5
- package/dist/list/handler.js +3 -3
- package/dist/project/import-openapi/handler.js +3 -3
- package/dist/test/esbuild-config.js +7 -6
- package/dist/test/esbuild-plugins/node-test-prep-plugin.js +65 -0
- package/dist/test/handler.js +4 -6
- package/dist/test/invoke-test.js +17 -18
- package/package.json +28 -37
- package/dist/common/deno-utils/locator.js +0 -29
- package/dist/test/esbuild-plugins/deno-test-prep-plugin.js +0 -99
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]="
|
|
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=
|
|
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]="
|
|
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=
|
|
96
|
+
//# debugId=2c738faa-55e9-5587-ad3f-7939112799e0
|
package/dist/convert/handler.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]="
|
|
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=
|
|
39
|
+
//# debugId=7ee0b975-ed5e-5b29-8cde-a84beac8baad
|
package/dist/deploy/archive.js
CHANGED
|
@@ -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]="
|
|
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 =
|
|
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=
|
|
118
|
+
//# debugId=2a68c8a7-7685-52e4-93e9-6b7b75a92f82
|
package/dist/link/populate.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]="
|
|
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=
|
|
87
|
+
//# debugId=67cff82f-69c9-50d3-876f-40e3b6b9afd6
|
package/dist/list/handler.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]="
|
|
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=
|
|
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]="
|
|
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=
|
|
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]="
|
|
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 {
|
|
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": ".
|
|
14
|
+
".js": ".mjs",
|
|
13
15
|
},
|
|
14
16
|
plugins: [
|
|
15
|
-
|
|
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=
|
|
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
|
package/dist/test/handler.js
CHANGED
|
@@ -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]="
|
|
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 {
|
|
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
|
-
|
|
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=
|
|
28
|
+
//# debugId=08888ef0-037c-5716-a727-dd52d53a2f00
|
package/dist/test/invoke-test.js
CHANGED
|
@@ -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]="
|
|
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
|
|
9
|
-
if (
|
|
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("--
|
|
17
|
+
args.push("--test-name-pattern", argv.filter);
|
|
19
18
|
}
|
|
20
19
|
args.push(`${argv.dir}/${TEST_OUT_FOLDER}`);
|
|
21
|
-
const
|
|
22
|
-
|
|
23
|
-
|
|
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
|
|
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
|
|
33
|
+
throw new MissingNodeExecutableError();
|
|
35
34
|
}
|
|
36
35
|
}
|
|
37
36
|
//# sourceMappingURL=invoke-test.js.map
|
|
38
|
-
//# debugId=
|
|
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.
|
|
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": "
|
|
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.
|
|
34
|
-
"@types/js-yaml": "^4.0.
|
|
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/
|
|
38
|
-
"@types/
|
|
39
|
-
"@types/
|
|
40
|
-
"@types/
|
|
41
|
-
"@types/
|
|
42
|
-
"@
|
|
43
|
-
"@
|
|
44
|
-
"
|
|
45
|
-
"
|
|
46
|
-
"
|
|
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": "^
|
|
52
|
-
"husky": "^
|
|
53
|
-
"lint-staged": "^
|
|
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": "^
|
|
57
|
-
"typescript": "^5.
|
|
58
|
-
"undici": "^6.
|
|
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": "^
|
|
62
|
-
"@fastify/static": "^
|
|
63
|
-
"@inquirer/prompts": "^3.
|
|
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": "^
|
|
87
|
-
"pino-pretty": "^
|
|
79
|
+
"pino": "^9.3.2",
|
|
80
|
+
"pino-pretty": "^11.2.2",
|
|
88
81
|
"posthog-node": "4.0.1",
|
|
89
|
-
"prettier": "^
|
|
90
|
-
"rimraf": "^
|
|
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.
|
|
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
|