@cedarjs/cli 3.0.0-canary.13426 → 3.0.0-canary.13428
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/commands/consoleHandler.js +8 -7
- package/dist/commands/deploy/render.js +1 -1
- package/dist/commands/execHandler.js +23 -20
- package/dist/commands/generate/script/scriptHandler.js +8 -4
- package/dist/commands/lint.js +1 -1
- package/dist/commands/record/init.js +1 -1
- package/dist/commands/record.js +1 -1
- package/dist/commands/serveApiHandler.js +3 -2
- package/dist/commands/serveBothHandler.js +8 -2
- package/dist/commands/serveWebHandler.js +1 -0
- package/dist/commands/studioHandler.js +2 -2
- package/package.json +11 -11
|
@@ -24,10 +24,10 @@ const loadConsoleHistory = async (r) => {
|
|
|
24
24
|
try {
|
|
25
25
|
const history = await fs.promises.readFile(consoleHistoryFile, "utf8");
|
|
26
26
|
history.split("\n").reverse().map((line) => r.history.push(line));
|
|
27
|
-
} catch
|
|
27
|
+
} catch {
|
|
28
28
|
}
|
|
29
29
|
};
|
|
30
|
-
const handler = () => {
|
|
30
|
+
const handler = (_options) => {
|
|
31
31
|
recordTelemetryAttributes({
|
|
32
32
|
command: "console"
|
|
33
33
|
});
|
|
@@ -46,19 +46,20 @@ const handler = () => {
|
|
|
46
46
|
});
|
|
47
47
|
const r = repl.start();
|
|
48
48
|
const defaultEval = r.eval;
|
|
49
|
-
|
|
50
|
-
defaultEval(cmd, context, filename, async (err, result) => {
|
|
49
|
+
const asyncEval = (cmd, context, filename, callback) => {
|
|
50
|
+
defaultEval.call(r, cmd, context, filename, async (err, result) => {
|
|
51
51
|
if (err) {
|
|
52
|
-
callback(err);
|
|
52
|
+
callback(err, null);
|
|
53
53
|
} else {
|
|
54
54
|
try {
|
|
55
55
|
callback(null, await Promise.resolve(result));
|
|
56
|
-
} catch (
|
|
57
|
-
callback(
|
|
56
|
+
} catch (error) {
|
|
57
|
+
callback(error, null);
|
|
58
58
|
}
|
|
59
59
|
}
|
|
60
60
|
});
|
|
61
61
|
};
|
|
62
|
+
r.eval = asyncEval;
|
|
62
63
|
loadConsoleHistory(r);
|
|
63
64
|
r.addListener("close", () => persistConsoleHistory(r));
|
|
64
65
|
loadPrismaClient(r.context);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { terminalLink } from "termi-link";
|
|
2
2
|
if (process.argv.slice(2).includes("api")) {
|
|
3
|
-
process.env.REDWOOD_DISABLE_TELEMETRY = 1;
|
|
3
|
+
process.env.REDWOOD_DISABLE_TELEMETRY = "1";
|
|
4
4
|
}
|
|
5
5
|
const command = "render <side>";
|
|
6
6
|
const description = "Build, migrate, and serve command for Render deploy";
|
|
@@ -10,18 +10,21 @@ import { runScriptFunction } from "../lib/exec.js";
|
|
|
10
10
|
import { generatePrismaClient } from "../lib/generatePrismaClient.js";
|
|
11
11
|
import { getPaths } from "../lib/index.js";
|
|
12
12
|
const printAvailableScriptsToConsole = () => {
|
|
13
|
-
const scripts = findScripts(getPaths().scripts).reduce(
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
13
|
+
const scripts = findScripts(getPaths().scripts).reduce(
|
|
14
|
+
(acc, scriptPath) => {
|
|
15
|
+
const relativePath = path.relative(getPaths().scripts, scriptPath);
|
|
16
|
+
const ext = path.parse(relativePath).ext;
|
|
17
|
+
const pathNoExt = relativePath.slice(0, -ext.length);
|
|
18
|
+
acc[pathNoExt] ||= [];
|
|
19
|
+
acc[pathNoExt].push(relativePath);
|
|
20
|
+
return acc;
|
|
21
|
+
},
|
|
22
|
+
{}
|
|
23
|
+
);
|
|
21
24
|
console.log("Available scripts:");
|
|
22
|
-
Object.entries(scripts).forEach(([name,
|
|
23
|
-
if (
|
|
24
|
-
|
|
25
|
+
Object.entries(scripts).forEach(([name, scriptPaths]) => {
|
|
26
|
+
if (scriptPaths.length > 1) {
|
|
27
|
+
scriptPaths.forEach((scriptPath) => {
|
|
25
28
|
console.log(c.info(`- ${scriptPath}`));
|
|
26
29
|
});
|
|
27
30
|
} else {
|
|
@@ -41,7 +44,7 @@ const handler = async (args) => {
|
|
|
41
44
|
printAvailableScriptsToConsole();
|
|
42
45
|
return;
|
|
43
46
|
}
|
|
44
|
-
scriptArgs._ = scriptArgs._.slice(1);
|
|
47
|
+
scriptArgs._ = (Array.isArray(scriptArgs._) ? scriptArgs._ : []).slice(1);
|
|
45
48
|
delete scriptArgs.$0;
|
|
46
49
|
delete scriptArgs.l;
|
|
47
50
|
delete scriptArgs.s;
|
|
@@ -59,7 +62,7 @@ No script called \`${name}\` in the ./scripts folder.
|
|
|
59
62
|
const scriptTasks = [
|
|
60
63
|
{
|
|
61
64
|
title: "Generating Prisma client",
|
|
62
|
-
enabled: () => prisma,
|
|
65
|
+
enabled: () => Boolean(prisma),
|
|
63
66
|
task: () => generatePrismaClient({
|
|
64
67
|
force: false,
|
|
65
68
|
verbose: !args.silent,
|
|
@@ -75,15 +78,15 @@ No script called \`${name}\` in the ./scripts folder.
|
|
|
75
78
|
functionName: "default",
|
|
76
79
|
args: { args: scriptArgs }
|
|
77
80
|
});
|
|
78
|
-
} catch (
|
|
79
|
-
|
|
80
|
-
|
|
81
|
+
} catch (error) {
|
|
82
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
83
|
+
console.error(c.error(`Error in script: ${message}`));
|
|
84
|
+
throw error;
|
|
81
85
|
}
|
|
82
86
|
}
|
|
83
87
|
}
|
|
84
88
|
];
|
|
85
89
|
const tasks = new Listr(scriptTasks, {
|
|
86
|
-
rendererOptions: { collapseSubtasks: false },
|
|
87
90
|
renderer: args.silent ? "silent" : "verbose"
|
|
88
91
|
});
|
|
89
92
|
await context.with(suppressTracing(context.active()), async () => {
|
|
@@ -98,9 +101,9 @@ function resolveScriptPath(name) {
|
|
|
98
101
|
const extensions = [".js", ".jsx", ".ts", ".tsx"];
|
|
99
102
|
const matches = [];
|
|
100
103
|
for (const extension of extensions) {
|
|
101
|
-
const
|
|
102
|
-
if (fs.existsSync(
|
|
103
|
-
matches.push(
|
|
104
|
+
const candidate = scriptPath + extension;
|
|
105
|
+
if (fs.existsSync(candidate)) {
|
|
106
|
+
matches.push(candidate);
|
|
104
107
|
}
|
|
105
108
|
}
|
|
106
109
|
if (matches.length === 1) {
|
|
@@ -35,7 +35,10 @@ const files = async ({ name, typescript = false }) => {
|
|
|
35
35
|
}
|
|
36
36
|
};
|
|
37
37
|
};
|
|
38
|
-
const handler = async ({
|
|
38
|
+
const handler = async ({
|
|
39
|
+
force,
|
|
40
|
+
...args
|
|
41
|
+
}) => {
|
|
39
42
|
recordTelemetryAttributes({
|
|
40
43
|
command: "generate script",
|
|
41
44
|
force,
|
|
@@ -74,9 +77,10 @@ const handler = async ({ force, ...args }) => {
|
|
|
74
77
|
prepareForRollback(tasks);
|
|
75
78
|
}
|
|
76
79
|
await tasks.run();
|
|
77
|
-
} catch (
|
|
78
|
-
|
|
79
|
-
|
|
80
|
+
} catch (error) {
|
|
81
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
82
|
+
errorTelemetry(process.argv, message);
|
|
83
|
+
console.log(c.error(message));
|
|
80
84
|
process.exit(1);
|
|
81
85
|
}
|
|
82
86
|
};
|
package/dist/commands/lint.js
CHANGED
|
@@ -111,7 +111,7 @@ const handler = async ({
|
|
|
111
111
|
process.exitCode = result.exitCode;
|
|
112
112
|
} catch (error) {
|
|
113
113
|
if (error && typeof error === "object" && "exitCode" in error) {
|
|
114
|
-
process.exitCode = error.exitCode
|
|
114
|
+
process.exitCode = typeof error.exitCode === "number" ? error.exitCode : 1;
|
|
115
115
|
return;
|
|
116
116
|
}
|
|
117
117
|
process.exitCode = 1;
|
package/dist/commands/record.js
CHANGED
|
@@ -3,9 +3,10 @@ import { getPaths } from "@cedarjs/project-config";
|
|
|
3
3
|
const apiServerFileHandler = async (argv) => {
|
|
4
4
|
const args = ["node", "server.js", "--apiRootPath", argv.apiRootPath];
|
|
5
5
|
if (argv.port) {
|
|
6
|
-
args.push("--apiPort", argv.port);
|
|
6
|
+
args.push("--apiPort", String(argv.port));
|
|
7
7
|
}
|
|
8
|
-
|
|
8
|
+
const filteredArgs = args.filter((arg) => Boolean(arg));
|
|
9
|
+
await execa("yarn", filteredArgs, {
|
|
9
10
|
cwd: getPaths().api.dist,
|
|
10
11
|
stdio: "inherit"
|
|
11
12
|
});
|
|
@@ -11,6 +11,10 @@ import {
|
|
|
11
11
|
import { getConfig, getPaths } from "@cedarjs/project-config";
|
|
12
12
|
import { errorTelemetry } from "@cedarjs/telemetry";
|
|
13
13
|
import { exitWithError } from "../lib/exit.js";
|
|
14
|
+
const hasStringMessage = (error) => {
|
|
15
|
+
const message = typeof error === "object" && error !== null ? Reflect.get(error, "message") : void 0;
|
|
16
|
+
return typeof error === "object" && error !== null && "message" in error && typeof message === "string";
|
|
17
|
+
};
|
|
14
18
|
const bothServerFileHandler = async (argv) => {
|
|
15
19
|
if (getConfig().experimental?.rsc?.enabled || getConfig().experimental?.streamingSsr?.enabled) {
|
|
16
20
|
logSkippingFastifyWebServer();
|
|
@@ -54,10 +58,11 @@ const bothServerFileHandler = async (argv) => {
|
|
|
54
58
|
try {
|
|
55
59
|
await result;
|
|
56
60
|
} catch (error) {
|
|
57
|
-
|
|
61
|
+
const message = hasStringMessage(error) ? error.message : void 0;
|
|
62
|
+
if (typeof message !== "undefined") {
|
|
58
63
|
errorTelemetry(
|
|
59
64
|
process.argv,
|
|
60
|
-
`Error concurrently starting sides: ${
|
|
65
|
+
`Error concurrently starting sides: ${message}`
|
|
61
66
|
);
|
|
62
67
|
exitWithError(error);
|
|
63
68
|
}
|
|
@@ -74,6 +79,7 @@ const bothSsrRscServerHandler = async (argv, rscEnabled) => {
|
|
|
74
79
|
cwd: getPaths().web.base,
|
|
75
80
|
stdio: "inherit",
|
|
76
81
|
env: rscEnabled ? {
|
|
82
|
+
...process.env,
|
|
77
83
|
// TODO (RSC): Is this how we want to do it? If so, we need to find a way
|
|
78
84
|
// to merge this with users' NODE_OPTIONS
|
|
79
85
|
NODE_OPTIONS: "--conditions react-server"
|
|
@@ -5,6 +5,7 @@ const webSsrServerHandler = async (rscEnabled) => {
|
|
|
5
5
|
cwd: getPaths().web.base,
|
|
6
6
|
stdio: "inherit",
|
|
7
7
|
env: rscEnabled ? {
|
|
8
|
+
...process.env,
|
|
8
9
|
// TODO (RSC): Is this how we want to do it? If so, we need to find a way
|
|
9
10
|
// to merge this with users' NODE_OPTIONS
|
|
10
11
|
NODE_OPTIONS: "--conditions react-server"
|
|
@@ -22,9 +22,9 @@ const handler = async (options) => {
|
|
|
22
22
|
}
|
|
23
23
|
const { serve } = await import("@cedarjs/studio");
|
|
24
24
|
await serve({ open: options.open, enableWeb: true });
|
|
25
|
-
} catch (
|
|
25
|
+
} catch (error) {
|
|
26
26
|
console.log("Cannot start the development studio");
|
|
27
|
-
console.log(
|
|
27
|
+
console.log(error);
|
|
28
28
|
process.exit(1);
|
|
29
29
|
}
|
|
30
30
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cedarjs/cli",
|
|
3
|
-
"version": "3.0.0-canary.
|
|
3
|
+
"version": "3.0.0-canary.13428+fde92dd19",
|
|
4
4
|
"description": "The CedarJS Command Line",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -34,15 +34,15 @@
|
|
|
34
34
|
"@babel/parser": "7.29.0",
|
|
35
35
|
"@babel/preset-typescript": "7.28.5",
|
|
36
36
|
"@babel/runtime-corejs3": "7.29.0",
|
|
37
|
-
"@cedarjs/api-server": "3.0.0-canary.
|
|
38
|
-
"@cedarjs/cli-helpers": "3.0.0-canary.
|
|
39
|
-
"@cedarjs/fastify-web": "3.0.0-canary.
|
|
40
|
-
"@cedarjs/internal": "3.0.0-canary.
|
|
41
|
-
"@cedarjs/prerender": "3.0.0-canary.
|
|
42
|
-
"@cedarjs/project-config": "3.0.0-canary.
|
|
43
|
-
"@cedarjs/structure": "3.0.0-canary.
|
|
44
|
-
"@cedarjs/telemetry": "3.0.0-canary.
|
|
45
|
-
"@cedarjs/web-server": "3.0.0-canary.
|
|
37
|
+
"@cedarjs/api-server": "3.0.0-canary.13428",
|
|
38
|
+
"@cedarjs/cli-helpers": "3.0.0-canary.13428",
|
|
39
|
+
"@cedarjs/fastify-web": "3.0.0-canary.13428",
|
|
40
|
+
"@cedarjs/internal": "3.0.0-canary.13428",
|
|
41
|
+
"@cedarjs/prerender": "3.0.0-canary.13428",
|
|
42
|
+
"@cedarjs/project-config": "3.0.0-canary.13428",
|
|
43
|
+
"@cedarjs/structure": "3.0.0-canary.13428",
|
|
44
|
+
"@cedarjs/telemetry": "3.0.0-canary.13428",
|
|
45
|
+
"@cedarjs/web-server": "3.0.0-canary.13428",
|
|
46
46
|
"@listr2/prompt-adapter-enquirer": "2.0.16",
|
|
47
47
|
"@opentelemetry/api": "1.9.0",
|
|
48
48
|
"@opentelemetry/core": "1.30.1",
|
|
@@ -106,5 +106,5 @@
|
|
|
106
106
|
"publishConfig": {
|
|
107
107
|
"access": "public"
|
|
108
108
|
},
|
|
109
|
-
"gitHead": "
|
|
109
|
+
"gitHead": "fde92dd19c42fb2ef91dac69981649c3fa07e7f7"
|
|
110
110
|
}
|