@zuplo/cli 1.112.0 → 1.114.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli.js +4 -2
- package/dist/cmds/compile.js +42 -0
- package/dist/cmds/dev.js +6 -2
- package/dist/common/utils/ports.js +19 -0
- package/dist/compile/handler.js +42 -0
- package/dist/dev/handler.js +24 -6
- package/package.json +4 -4
package/dist/cli.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},n=(new Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="
|
|
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]="b7b80df4-c767-5f13-8cfb-0f1e1b3f3d4f")}catch(e){}}();
|
|
3
3
|
import * as dotenv from "dotenv";
|
|
4
4
|
dotenv.config();
|
|
5
5
|
import * as Sentry from "@sentry/node";
|
|
@@ -8,6 +8,7 @@ import { fileURLToPath } from "node:url";
|
|
|
8
8
|
import { gte } from "semver";
|
|
9
9
|
import { hideBin } from "yargs/helpers";
|
|
10
10
|
import yargs from "yargs/yargs";
|
|
11
|
+
import compile from "./cmds/compile.js";
|
|
11
12
|
import convert from "./cmds/convert.js";
|
|
12
13
|
import deleteZup from "./cmds/delete.js";
|
|
13
14
|
import deploy from "./cmds/deploy.js";
|
|
@@ -41,6 +42,7 @@ if (gte(process.versions.node, MIN_NODE_VERSION)) {
|
|
|
41
42
|
});
|
|
42
43
|
const cli = yargs(hideBin(process.argv))
|
|
43
44
|
.env("ZUPLO")
|
|
45
|
+
.command(compile)
|
|
44
46
|
.command(convert)
|
|
45
47
|
.command(deleteZup)
|
|
46
48
|
.command(deploy)
|
|
@@ -82,4 +84,4 @@ else {
|
|
|
82
84
|
Consider using a Node.js version manager such as https://github.com/nvm-sh/nvm.`);
|
|
83
85
|
}
|
|
84
86
|
//# sourceMappingURL=cli.js.map
|
|
85
|
-
//# debugId=
|
|
87
|
+
//# debugId=b7b80df4-c767-5f13-8cfb-0f1e1b3f3d4f
|
|
@@ -0,0 +1,42 @@
|
|
|
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]="8fe11cc3-3789-5833-a7f5-87287360c988")}catch(e){}}();
|
|
3
|
+
import { captureEvent } from "../common/analytics/lib.js";
|
|
4
|
+
import { identify } from "../common/middleware/user-identification.js";
|
|
5
|
+
import setBlocking from "../common/output.js";
|
|
6
|
+
import { ZuploProjectValidator } from "../common/validators/file-system-validator.js";
|
|
7
|
+
import { YargsChecker } from "../common/validators/lib.js";
|
|
8
|
+
import { compile } from "../compile/handler.js";
|
|
9
|
+
export default {
|
|
10
|
+
desc: false,
|
|
11
|
+
command: "compile",
|
|
12
|
+
builder: (yargs) => {
|
|
13
|
+
return yargs
|
|
14
|
+
.option("dir", {
|
|
15
|
+
type: "string",
|
|
16
|
+
describe: "The directory containing your zup",
|
|
17
|
+
default: ".",
|
|
18
|
+
normalize: true,
|
|
19
|
+
hidden: true,
|
|
20
|
+
})
|
|
21
|
+
.option("port", {
|
|
22
|
+
type: "number",
|
|
23
|
+
describe: "The port to run the zup server on",
|
|
24
|
+
default: 9000,
|
|
25
|
+
})
|
|
26
|
+
.option("binary-name", {
|
|
27
|
+
type: "string",
|
|
28
|
+
describe: "The name of the binary",
|
|
29
|
+
default: "compiled-zup",
|
|
30
|
+
})
|
|
31
|
+
.middleware([setBlocking, identify])
|
|
32
|
+
.check(async (argv) => {
|
|
33
|
+
return await new YargsChecker(new ZuploProjectValidator()).check(argv);
|
|
34
|
+
});
|
|
35
|
+
},
|
|
36
|
+
handler: async (argv) => {
|
|
37
|
+
await captureEvent({ argv, event: "zup compile" });
|
|
38
|
+
await compile(argv);
|
|
39
|
+
},
|
|
40
|
+
};
|
|
41
|
+
//# sourceMappingURL=compile.js.map
|
|
42
|
+
//# debugId=8fe11cc3-3789-5833-a7f5-87287360c988
|
package/dist/cmds/dev.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]="cd26cd84-311b-5031-9a99-53eb489538ba")}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";
|
|
@@ -32,6 +32,10 @@ export default {
|
|
|
32
32
|
type: "number",
|
|
33
33
|
describe: "The port to run the route designer on",
|
|
34
34
|
default: 9100,
|
|
35
|
+
})
|
|
36
|
+
.option("debug-port", {
|
|
37
|
+
type: "number",
|
|
38
|
+
describe: "The port to run the Chrome inspector on",
|
|
35
39
|
})
|
|
36
40
|
.middleware([setBlocking, identify])
|
|
37
41
|
.check(async (argv) => {
|
|
@@ -44,4 +48,4 @@ export default {
|
|
|
44
48
|
},
|
|
45
49
|
};
|
|
46
50
|
//# sourceMappingURL=dev.js.map
|
|
47
|
-
//# debugId=
|
|
51
|
+
//# debugId=cd26cd84-311b-5031-9a99-53eb489538ba
|
|
@@ -0,0 +1,19 @@
|
|
|
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]="91c950c6-7387-5ef2-9dbb-0446c03af67f")}catch(e){}}();
|
|
3
|
+
import net from "net";
|
|
4
|
+
export function isPortAvailable(host, port) {
|
|
5
|
+
return new Promise((resolve, reject) => {
|
|
6
|
+
const socket = new net.Socket();
|
|
7
|
+
socket.connect(port, host);
|
|
8
|
+
socket.on("connect", () => {
|
|
9
|
+
socket.destroy();
|
|
10
|
+
resolve(false);
|
|
11
|
+
});
|
|
12
|
+
socket.on("error", (err) => {
|
|
13
|
+
socket.destroy();
|
|
14
|
+
resolve(true);
|
|
15
|
+
});
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
//# sourceMappingURL=ports.js.map
|
|
19
|
+
//# debugId=91c950c6-7387-5ef2-9dbb-0446c03af67f
|
|
@@ -0,0 +1,42 @@
|
|
|
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]="e900a4a1-10a3-56de-9a5a-905c90d64f03")}catch(e){}}();
|
|
3
|
+
import { cpSync, existsSync } from "node:fs";
|
|
4
|
+
import { join, relative, resolve } from "node:path";
|
|
5
|
+
import { fileURLToPath, pathToFileURL } from "node:url";
|
|
6
|
+
import { printDiagnosticsToConsole } from "../common/output.js";
|
|
7
|
+
export async function compile(argv) {
|
|
8
|
+
const sourceDirectory = resolve(join(relative(process.cwd(), argv.dir)));
|
|
9
|
+
const zuploRuntimePath = new URL("../../node_modules/@zuplo/runtime", import.meta.url);
|
|
10
|
+
if (existsSync(zuploRuntimePath)) {
|
|
11
|
+
cpSync(zuploRuntimePath, join(sourceDirectory, "node_modules/@zuplo/runtime"), {
|
|
12
|
+
recursive: true,
|
|
13
|
+
dereference: true,
|
|
14
|
+
});
|
|
15
|
+
}
|
|
16
|
+
process.env.GLOBAL_MODULE_LOCATION = fileURLToPath(new URL("../../node_modules", import.meta.url));
|
|
17
|
+
const loadedEnvFiles = [];
|
|
18
|
+
const envFile = join(sourceDirectory, ".env");
|
|
19
|
+
if (existsSync(envFile)) {
|
|
20
|
+
loadedEnvFiles.push(".env");
|
|
21
|
+
}
|
|
22
|
+
const envZuploFile = join(sourceDirectory, ".env.zuplo");
|
|
23
|
+
if (existsSync(envZuploFile)) {
|
|
24
|
+
loadedEnvFiles.push(".env.zuplo");
|
|
25
|
+
}
|
|
26
|
+
const config = {
|
|
27
|
+
build_assets_url: pathToFileURL(sourceDirectory),
|
|
28
|
+
};
|
|
29
|
+
process.env.__ZUPLO_CONFIG = btoa(JSON.stringify(config));
|
|
30
|
+
const core = await import("@zuplo/core");
|
|
31
|
+
const zupPort = argv.port;
|
|
32
|
+
await core.default.compileWorkerdServer({
|
|
33
|
+
sourceDirectory,
|
|
34
|
+
port: zupPort,
|
|
35
|
+
binaryName: argv["binary-name"],
|
|
36
|
+
generateSourceMaps: true,
|
|
37
|
+
});
|
|
38
|
+
printDiagnosticsToConsole("📦 Compiled a self-contained zup binary");
|
|
39
|
+
printDiagnosticsToConsole(`The binary is available at ${sourceDirectory}/dist/${argv["binary-name"]}`);
|
|
40
|
+
}
|
|
41
|
+
//# sourceMappingURL=handler.js.map
|
|
42
|
+
//# debugId=e900a4a1-10a3-56de-9a5a-905c90d64f03
|
package/dist/dev/handler.js
CHANGED
|
@@ -1,10 +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]="bf35816c-e91e-5014-89aa-1472b78406e4")}catch(e){}}();
|
|
3
3
|
import { cpSync, existsSync } from "node:fs";
|
|
4
4
|
import { join, relative, resolve } from "node:path";
|
|
5
5
|
import { fileURLToPath, pathToFileURL } from "node:url";
|
|
6
6
|
import { logger } from "../common/logger.js";
|
|
7
|
-
import { printDiagnosticsToConsole } from "../common/output.js";
|
|
7
|
+
import { printCriticalFailureToConsoleAndExit, printDiagnosticsToConsole, } from "../common/output.js";
|
|
8
|
+
import { isPortAvailable } from "../common/utils/ports.js";
|
|
8
9
|
import { ApiServer } from "../editor/server/server.js";
|
|
9
10
|
export async function dev(argv) {
|
|
10
11
|
const sourceDirectory = resolve(join(relative(process.cwd(), argv.dir)));
|
|
@@ -30,10 +31,27 @@ export async function dev(argv) {
|
|
|
30
31
|
};
|
|
31
32
|
process.env.__ZUPLO_CONFIG = btoa(JSON.stringify(config));
|
|
32
33
|
const core = await import("@zuplo/core");
|
|
33
|
-
const
|
|
34
|
+
const zupPort = argv.port;
|
|
35
|
+
const zupEditorPort = argv.editorPort;
|
|
36
|
+
const zupDebugPort = argv.debugPort;
|
|
37
|
+
const isZupPortAvailable = await isPortAvailable("localhost", zupPort);
|
|
38
|
+
if (!isZupPortAvailable) {
|
|
39
|
+
printCriticalFailureToConsoleAndExit(`Port ${zupPort} is already in use. Please specify a different port using --port.`);
|
|
40
|
+
}
|
|
41
|
+
const isZupEditorPortAvailable = await isPortAvailable("localhost", zupEditorPort);
|
|
42
|
+
if (!isZupEditorPortAvailable) {
|
|
43
|
+
printCriticalFailureToConsoleAndExit(`Port ${zupEditorPort} is already in use. Please specify a different port using --editor-port.`);
|
|
44
|
+
}
|
|
45
|
+
if (zupDebugPort) {
|
|
46
|
+
const isZupDebugPortAvailable = await isPortAvailable("localhost", zupDebugPort);
|
|
47
|
+
if (!isZupDebugPortAvailable) {
|
|
48
|
+
printCriticalFailureToConsoleAndExit(`Port ${zupDebugPort} is already in use. Please specify a different port using --debug-port.`);
|
|
49
|
+
}
|
|
50
|
+
}
|
|
34
51
|
await core.default.startDevServer({
|
|
35
52
|
sourceDirectory,
|
|
36
|
-
port,
|
|
53
|
+
port: zupPort,
|
|
54
|
+
debugPort: argv.debugPort ?? undefined,
|
|
37
55
|
devServerPort: undefined,
|
|
38
56
|
generateSourceMaps: true,
|
|
39
57
|
flags: {
|
|
@@ -54,7 +72,7 @@ export async function dev(argv) {
|
|
|
54
72
|
printDiagnosticsToConsole("Started local development setup");
|
|
55
73
|
printDiagnosticsToConsole("Ctrl+C to exit");
|
|
56
74
|
printDiagnosticsToConsole("");
|
|
57
|
-
printDiagnosticsToConsole(`🚀 Zuplo Gateway: http://localhost:${
|
|
75
|
+
printDiagnosticsToConsole(`🚀 Zuplo Gateway: http://localhost:${zupPort}`);
|
|
58
76
|
if (argv["start-editor"]) {
|
|
59
77
|
printDiagnosticsToConsole(`📘 Route Designer: http://localhost:${argv.editorPort}`);
|
|
60
78
|
}
|
|
@@ -77,4 +95,4 @@ export async function dev(argv) {
|
|
|
77
95
|
});
|
|
78
96
|
}
|
|
79
97
|
//# sourceMappingURL=handler.js.map
|
|
80
|
-
//# debugId=
|
|
98
|
+
//# debugId=bf35816c-e91e-5014-89aa-1472b78406e4
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zuplo/cli",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.114.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"repository": "https://github.com/zuplo/cli",
|
|
6
6
|
"description": "The command-line interface for Zuplo",
|
|
@@ -64,10 +64,10 @@
|
|
|
64
64
|
"@opentelemetry/api": "^1.8.0",
|
|
65
65
|
"@sentry/node": "7.69.0",
|
|
66
66
|
"@swc/core": "1.3.78",
|
|
67
|
-
"@zuplo/core": "5.
|
|
67
|
+
"@zuplo/core": "5.2150.0",
|
|
68
68
|
"@zuplo/deno-bin": "1.37.1",
|
|
69
69
|
"@zuplo/pino-pretty-configurations": "^1.5.0",
|
|
70
|
-
"@zuplo/runtime": "5.
|
|
70
|
+
"@zuplo/runtime": "5.2150.0",
|
|
71
71
|
"chalk": "^5.1.2",
|
|
72
72
|
"chokidar": "^3.5.3",
|
|
73
73
|
"dotenv": "^16.3.1",
|
|
@@ -95,7 +95,7 @@
|
|
|
95
95
|
"tar": "^6.1.13",
|
|
96
96
|
"temp": "^0.9.4",
|
|
97
97
|
"uuid": "^9.0.1",
|
|
98
|
-
"workerd": "1.
|
|
98
|
+
"workerd": "^1.20240502.0",
|
|
99
99
|
"yargs": "^17.7.1"
|
|
100
100
|
}
|
|
101
101
|
}
|