@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 +4 -8
- package/dist/cmds/login.js +3 -3
- package/dist/common/upgraders/package-json-upgrader.js +3 -3
- package/dist/common/upgraders/vscode-settings-json-upgrader.js +4 -4
- package/dist/common/validators/file-system-validator.js +2 -4
- package/dist/convert/handler.js +4 -4
- package/dist/deploy/archive.js +11 -4
- package/dist/link/handler.js +63 -68
- 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/handler.js +4 -6
- package/package.json +28 -36
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]="
|
|
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 {
|
|
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(
|
|
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=
|
|
47
|
+
//# debugId=0be777a5-8b5e-574a-8780-387d75ffa1a8
|
package/dist/cmds/login.js
CHANGED
|
@@ -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]="
|
|
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:
|
|
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=
|
|
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]="
|
|
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
|
|
@@ -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]="
|
|
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=
|
|
164
|
+
//# debugId=a750d299-a353-5bcd-b91f-5638e7666ba6
|
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/handler.js
CHANGED
|
@@ -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]="
|
|
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
|
-
|
|
20
|
-
|
|
21
|
-
|
|
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 `${
|
|
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.
|
|
35
|
+
const projectResponse = await fetch(`${settings.ZUPLO_DEVELOPER_API_ENDPOINT}/v1/projects`, {
|
|
66
36
|
headers: {
|
|
67
|
-
authorization: `Bearer ${
|
|
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
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
}
|
|
100
|
-
const
|
|
101
|
-
|
|
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
|
-
|
|
107
|
-
|
|
108
|
-
.
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
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=
|
|
144
|
+
//# debugId=f5e0af3e-c906-5b69-ba89-acd89c389920
|
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
|
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]="1ca2f9a0-dd2a-5e05-9db2-0a83d26896ad")}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=1ca2f9a0-dd2a-5e05-9db2-0a83d26896ad
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zuplo/cli",
|
|
3
|
-
"version": "1.
|
|
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": "
|
|
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.
|
|
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",
|
|
@@ -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": "^
|
|
87
|
-
"pino-pretty": "^
|
|
80
|
+
"pino": "^9.3.2",
|
|
81
|
+
"pino-pretty": "^11.2.2",
|
|
88
82
|
"posthog-node": "4.0.1",
|
|
89
|
-
"prettier": "^
|
|
90
|
-
"rimraf": "^
|
|
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.
|
|
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"
|