@cedarjs/cli 5.0.0-canary.2477 → 5.0.0-canary.2479
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/experimental/setupReactCompilerHandler.js +10 -5
- package/dist/commands/experimental/setupStreamingSsrHandler.js +9 -4
- package/dist/commands/generate/cell/cellHandler.js +2 -1
- package/dist/commands/generate/component/componentHandler.js +16 -9
- package/dist/commands/generate/dataMigration/dataMigration.js +10 -6
- package/dist/commands/generate/dbAuth/dbAuthHandler.js +13 -4
- package/dist/commands/generate/directive/directiveHandler.js +3 -3
- package/dist/commands/generate/function/functionHandler.js +21 -12
- package/dist/commands/generate/job/jobHandler.js +2 -3
- package/dist/commands/generate/package/packageHandler.js +5 -5
- package/dist/commands/generate/realtime/realtimeHandler.js +14 -5
- package/dist/commands/generate/scaffold/scaffoldHandler.js +6 -3
- package/dist/commands/generate.js +2 -2
- package/dist/lib/test.js +4 -0
- package/dist/plugin.js +10 -6
- package/package.json +12 -12
|
@@ -13,7 +13,10 @@ import {
|
|
|
13
13
|
EXPERIMENTAL_TOPIC_ID
|
|
14
14
|
} from "./setupReactCompiler.js";
|
|
15
15
|
import { printTaskEpilogue } from "./util.js";
|
|
16
|
-
const handler = async ({
|
|
16
|
+
const handler = async ({
|
|
17
|
+
force,
|
|
18
|
+
verbose
|
|
19
|
+
}) => {
|
|
17
20
|
const rwPaths = getPaths();
|
|
18
21
|
const configTomlPath = getConfigPath();
|
|
19
22
|
const configFileName = path.basename(configTomlPath);
|
|
@@ -37,7 +40,7 @@ const handler = async ({ force, verbose }) => {
|
|
|
37
40
|
);
|
|
38
41
|
const reactVersion = webPkgJson["dependencies"]["react"];
|
|
39
42
|
const coercedReactVersion = semver.coerce(reactVersion);
|
|
40
|
-
if (!semver.gte(coercedReactVersion, "19.0.0")) {
|
|
43
|
+
if (!coercedReactVersion || !semver.gte(coercedReactVersion, "19.0.0")) {
|
|
41
44
|
throw new Error(
|
|
42
45
|
"You need to be using at least React version 19 to enable the React Compiler"
|
|
43
46
|
);
|
|
@@ -118,9 +121,11 @@ const handler = async ({ force, verbose }) => {
|
|
|
118
121
|
try {
|
|
119
122
|
await tasks.run();
|
|
120
123
|
} catch (e) {
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
process.
|
|
124
|
+
const message = e instanceof Error ? e.message : String(e);
|
|
125
|
+
const exitCode = e instanceof Error && "exitCode" in e && typeof e.exitCode === "number" ? e.exitCode : 1;
|
|
126
|
+
errorTelemetry(process.argv, message);
|
|
127
|
+
console.error(c.error(message));
|
|
128
|
+
process.exit(exitCode);
|
|
124
129
|
}
|
|
125
130
|
};
|
|
126
131
|
export {
|
|
@@ -13,7 +13,10 @@ import {
|
|
|
13
13
|
EXPERIMENTAL_TOPIC_ID
|
|
14
14
|
} from "./setupStreamingSsr.js";
|
|
15
15
|
import { printTaskEpilogue } from "./util.js";
|
|
16
|
-
const handler = async ({
|
|
16
|
+
const handler = async ({
|
|
17
|
+
force,
|
|
18
|
+
verbose
|
|
19
|
+
}) => {
|
|
17
20
|
const rwPaths = getPaths();
|
|
18
21
|
const configPath = getConfigPath();
|
|
19
22
|
const configContent = fs.readFileSync(configPath, "utf-8");
|
|
@@ -197,9 +200,11 @@ You'll manually need to merge it with your existing entry.client${ext} file.`;
|
|
|
197
200
|
try {
|
|
198
201
|
await tasks.run();
|
|
199
202
|
} catch (e) {
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
process.
|
|
203
|
+
const message = e instanceof Error ? e.message : String(e);
|
|
204
|
+
const exitCode = e instanceof Error && "exitCode" in e && typeof e.exitCode === "number" ? e.exitCode : 1;
|
|
205
|
+
errorTelemetry(process.argv, message);
|
|
206
|
+
console.error(c.error(message));
|
|
207
|
+
process.exit(exitCode);
|
|
203
208
|
}
|
|
204
209
|
};
|
|
205
210
|
export {
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import pascalcase from "pascalcase";
|
|
2
|
+
import { formatCedarCommand } from "@cedarjs/cli-helpers/packageManager/display";
|
|
2
3
|
import { generate as generateTypes } from "@cedarjs/internal/dist/generate/generate";
|
|
3
4
|
import { isPlural, singularize } from "@cedarjs/utils/cedarPluralize";
|
|
4
5
|
import { nameVariants, transformTSToJS } from "../../../lib/index.js";
|
|
@@ -141,7 +142,7 @@ const handler = createHandler({
|
|
|
141
142
|
addFunctionToRollback(generateTypes, true);
|
|
142
143
|
} else {
|
|
143
144
|
task.skip(
|
|
144
|
-
`Skipping type generation: no SDL defined for "${queryFieldName}". To generate types, run '
|
|
145
|
+
`Skipping type generation: no SDL defined for "${queryFieldName}". To generate types, run '${formatCedarCommand(["generate", "sdl", queryFieldName])}'.`
|
|
145
146
|
);
|
|
146
147
|
}
|
|
147
148
|
}
|
|
@@ -4,7 +4,11 @@ import {
|
|
|
4
4
|
templateForComponentFile
|
|
5
5
|
} from "../yargsHandlerHelpers.js";
|
|
6
6
|
const REDWOOD_WEB_PATH_NAME = "components";
|
|
7
|
-
const files = async ({
|
|
7
|
+
const files = async ({
|
|
8
|
+
name,
|
|
9
|
+
typescript = false,
|
|
10
|
+
...argv
|
|
11
|
+
}) => {
|
|
8
12
|
const extension = typescript ? ".tsx" : ".jsx";
|
|
9
13
|
const componentFile = await templateForComponentFile({
|
|
10
14
|
name,
|
|
@@ -36,14 +40,17 @@ const files = async ({ name, typescript = false, ...argv }) => {
|
|
|
36
40
|
if (argv.tests) {
|
|
37
41
|
files2.push(testFile);
|
|
38
42
|
}
|
|
39
|
-
return files2.reduce(
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
43
|
+
return files2.reduce(
|
|
44
|
+
async (accP, [outputPath, content]) => {
|
|
45
|
+
const acc = await accP;
|
|
46
|
+
const template = typescript ? content : await transformTSToJS(outputPath, content);
|
|
47
|
+
return {
|
|
48
|
+
[outputPath]: template,
|
|
49
|
+
...acc
|
|
50
|
+
};
|
|
51
|
+
},
|
|
52
|
+
Promise.resolve({})
|
|
53
|
+
);
|
|
47
54
|
};
|
|
48
55
|
const handler = createHandler({
|
|
49
56
|
componentName: "component",
|
|
@@ -3,6 +3,7 @@ import { paramCase } from "change-case";
|
|
|
3
3
|
import { Listr } from "listr2";
|
|
4
4
|
import { terminalLink } from "termi-link";
|
|
5
5
|
import { recordTelemetryAttributes, colors as c } from "@cedarjs/cli-helpers";
|
|
6
|
+
import { formatCedarCommand } from "@cedarjs/cli-helpers/packageManager/display";
|
|
6
7
|
import { getDataMigrationsPath } from "@cedarjs/project-config";
|
|
7
8
|
import {
|
|
8
9
|
generateTemplate,
|
|
@@ -12,14 +13,16 @@ import {
|
|
|
12
13
|
import { prepareForRollback } from "../../../lib/rollback.js";
|
|
13
14
|
import { validateName } from "../helpers.js";
|
|
14
15
|
import { getYargsDefaults } from "../yargsCommandHelpers.js";
|
|
15
|
-
|
|
16
|
+
function getPostRunInstructions() {
|
|
17
|
+
const text = c.warning("After writing your migration, you can run it with:");
|
|
18
|
+
const command2 = formatCedarCommand(["dataMigrate", "up"]);
|
|
19
|
+
return `Next steps...
|
|
16
20
|
|
|
17
|
-
${
|
|
18
|
-
"After writing your migration, you can run it with:"
|
|
19
|
-
)}
|
|
21
|
+
${text}
|
|
20
22
|
|
|
21
|
-
|
|
23
|
+
${command2}
|
|
22
24
|
`;
|
|
25
|
+
}
|
|
23
26
|
const TEMPLATE_PATHS = {
|
|
24
27
|
js: path.resolve(
|
|
25
28
|
import.meta.dirname,
|
|
@@ -89,7 +92,7 @@ const handler = async (args) => {
|
|
|
89
92
|
{
|
|
90
93
|
title: "Next steps...",
|
|
91
94
|
task: (_ctx, task) => {
|
|
92
|
-
task.title =
|
|
95
|
+
task.title = getPostRunInstructions();
|
|
93
96
|
}
|
|
94
97
|
}
|
|
95
98
|
].filter(Boolean),
|
|
@@ -111,5 +114,6 @@ export {
|
|
|
111
114
|
command,
|
|
112
115
|
description,
|
|
113
116
|
files,
|
|
117
|
+
getPostRunInstructions,
|
|
114
118
|
handler
|
|
115
119
|
};
|
|
@@ -2,10 +2,11 @@ import fs from "node:fs";
|
|
|
2
2
|
import path from "node:path";
|
|
3
3
|
import { ListrEnquirerPromptAdapter } from "@listr2/prompt-adapter-enquirer";
|
|
4
4
|
import { camelCase } from "camel-case";
|
|
5
|
-
import execa from "execa";
|
|
6
5
|
import { Listr } from "listr2";
|
|
7
6
|
import { titleCase } from "title-case";
|
|
8
7
|
import { recordTelemetryAttributes, colors as c } from "@cedarjs/cli-helpers";
|
|
8
|
+
import { formatCedarCommand } from "@cedarjs/cli-helpers/packageManager/display";
|
|
9
|
+
import { runBinSync } from "@cedarjs/cli-helpers/packageManager/exec";
|
|
9
10
|
import {
|
|
10
11
|
addRoutesToRouterTask,
|
|
11
12
|
addScaffoldImport,
|
|
@@ -36,7 +37,11 @@ function getPostInstallMessage(isDbAuthSetup2) {
|
|
|
36
37
|
" logged in. Also take a look in the onSubmit() functions in ForgotPasswordPage",
|
|
37
38
|
" and ResetPasswordPage to change where the user redirects to after submitting",
|
|
38
39
|
" those forms.\n",
|
|
39
|
-
!isDbAuthSetup2 &&
|
|
40
|
+
!isDbAuthSetup2 && ` Oh, and if you haven't already, add the necessary dbAuth functions and
|
|
41
|
+
app setup by running:
|
|
42
|
+
|
|
43
|
+
${formatCedarCommand(["setup", "auth", "dbAuth"])}
|
|
44
|
+
`,
|
|
40
45
|
" Happy authenticating!"
|
|
41
46
|
].filter(Boolean).join("\n");
|
|
42
47
|
}
|
|
@@ -55,7 +60,11 @@ function getPostInstallWebauthnMessage(isDbAuthSetup2) {
|
|
|
55
60
|
" logged in. Also take a look in the onSubmit() functions in ForgotPasswordPage",
|
|
56
61
|
" and ResetPasswordPage to change where the user redirects to after submitting",
|
|
57
62
|
" those forms.\n",
|
|
58
|
-
!isDbAuthSetup2 &&
|
|
63
|
+
!isDbAuthSetup2 && ` Oh, and if you haven't already, add the necessary dbAuth functions and
|
|
64
|
+
app setup by running:
|
|
65
|
+
|
|
66
|
+
${formatCedarCommand(["setup", "auth", "dbAuth"])}
|
|
67
|
+
`,
|
|
59
68
|
" Happy authenticating!"
|
|
60
69
|
].filter(Boolean).join("\n");
|
|
61
70
|
}
|
|
@@ -303,7 +312,7 @@ const tasks = ({
|
|
|
303
312
|
{
|
|
304
313
|
title: "Generate types...",
|
|
305
314
|
task: () => {
|
|
306
|
-
|
|
315
|
+
runBinSync("cedar", ["g", "types"]);
|
|
307
316
|
}
|
|
308
317
|
},
|
|
309
318
|
{
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import camelcase from "camelcase";
|
|
2
|
-
import execa from "execa";
|
|
3
2
|
import { Listr } from "listr2";
|
|
4
3
|
import prompts from "prompts";
|
|
5
4
|
import { recordTelemetryAttributes, colors as c } from "@cedarjs/cli-helpers";
|
|
5
|
+
import { runBin } from "@cedarjs/cli-helpers/packageManager/exec";
|
|
6
6
|
import { getConfig } from "@cedarjs/project-config";
|
|
7
7
|
import { writeFilesTask, transformTSToJS } from "../../../lib/index.js";
|
|
8
8
|
import {
|
|
@@ -109,9 +109,9 @@ const handler = async (args) => {
|
|
|
109
109
|
title: "Generating TypeScript definitions and GraphQL schemas ...",
|
|
110
110
|
task: () => {
|
|
111
111
|
addFunctionToRollback(async () => {
|
|
112
|
-
await
|
|
112
|
+
await runBin("cedar-gen", [], { stdio: "pipe" });
|
|
113
113
|
}, true);
|
|
114
|
-
return
|
|
114
|
+
return runBin("cedar-gen", [], { stdio: "inherit" });
|
|
115
115
|
}
|
|
116
116
|
},
|
|
117
117
|
{
|
|
@@ -43,16 +43,23 @@ const files = async ({
|
|
|
43
43
|
outputFiles.push(testFile);
|
|
44
44
|
outputFiles.push(scenarioFile);
|
|
45
45
|
}
|
|
46
|
-
return outputFiles.reduce(
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
46
|
+
return outputFiles.reduce(
|
|
47
|
+
async (accP, [outputPath, content]) => {
|
|
48
|
+
const acc = await accP;
|
|
49
|
+
const template = generateTypescript ? content : await transformTSToJS(outputPath, content);
|
|
50
|
+
return {
|
|
51
|
+
[outputPath]: template,
|
|
52
|
+
...acc
|
|
53
|
+
};
|
|
54
|
+
},
|
|
55
|
+
Promise.resolve({})
|
|
56
|
+
);
|
|
54
57
|
};
|
|
55
|
-
const handler = async ({
|
|
58
|
+
const handler = async ({
|
|
59
|
+
name,
|
|
60
|
+
force,
|
|
61
|
+
...rest
|
|
62
|
+
}) => {
|
|
56
63
|
recordTelemetryAttributes({
|
|
57
64
|
command: "generate function",
|
|
58
65
|
force,
|
|
@@ -94,9 +101,11 @@ const handler = async ({ name, force, ...rest }) => {
|
|
|
94
101
|
);
|
|
95
102
|
console.info("");
|
|
96
103
|
} catch (e) {
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
process.
|
|
104
|
+
const message = e instanceof Error ? e.message : String(e);
|
|
105
|
+
const exitCode = e instanceof Error && "exitCode" in e && typeof e.exitCode === "number" ? e.exitCode : 1;
|
|
106
|
+
errorTelemetry(process.argv, message);
|
|
107
|
+
console.error(c.error(message));
|
|
108
|
+
process.exit(exitCode);
|
|
100
109
|
}
|
|
101
110
|
};
|
|
102
111
|
export {
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import path from "node:path";
|
|
2
2
|
import { pathToFileURL } from "node:url";
|
|
3
3
|
import * as changeCase from "change-case";
|
|
4
|
-
import execa from "execa";
|
|
5
4
|
import { Listr } from "listr2";
|
|
6
5
|
import { recordTelemetryAttributes, colors as c } from "@cedarjs/cli-helpers";
|
|
6
|
+
import { runBinSync } from "@cedarjs/cli-helpers/packageManager/exec";
|
|
7
7
|
import { errorTelemetry } from "@cedarjs/telemetry";
|
|
8
8
|
import {
|
|
9
9
|
getPaths,
|
|
@@ -100,8 +100,7 @@ const handler = async ({ name, force, ...rest }) => {
|
|
|
100
100
|
{
|
|
101
101
|
title: "Cleaning up...",
|
|
102
102
|
task: () => {
|
|
103
|
-
|
|
104
|
-
"eslint",
|
|
103
|
+
runBinSync("eslint", [
|
|
105
104
|
"--fix",
|
|
106
105
|
"--config",
|
|
107
106
|
`${getPaths().base}/node_modules/@cedarjs/eslint-config/shared.js`,
|
|
@@ -2,13 +2,14 @@ import fs from "node:fs";
|
|
|
2
2
|
import path from "node:path";
|
|
3
3
|
import { ListrEnquirerPromptAdapter } from "@listr2/prompt-adapter-enquirer";
|
|
4
4
|
import { paramCase, camelCase } from "change-case";
|
|
5
|
-
import execa from "execa";
|
|
6
5
|
import { modify, applyEdits } from "jsonc-parser";
|
|
7
6
|
import { Listr } from "listr2";
|
|
8
7
|
import { terminalLink } from "termi-link";
|
|
9
8
|
import ts from "typescript";
|
|
10
9
|
import { recordTelemetryAttributes, colors as c } from "@cedarjs/cli-helpers";
|
|
11
10
|
import { workspacePackageSpecifier } from "@cedarjs/cli-helpers/packageManager";
|
|
11
|
+
import { runScript, runBinSync } from "@cedarjs/cli-helpers/packageManager/exec";
|
|
12
|
+
import { installPackages } from "@cedarjs/cli-helpers/packageManager/packages";
|
|
12
13
|
import { getConfig } from "@cedarjs/project-config";
|
|
13
14
|
import { errorTelemetry } from "@cedarjs/telemetry";
|
|
14
15
|
import { getPaths, writeFilesTask } from "../../../lib/index.js";
|
|
@@ -244,8 +245,8 @@ function updateWorkspaceTsconfigReferences(task, folderName, targetWorkspaces) {
|
|
|
244
245
|
}
|
|
245
246
|
async function installAndBuild(folderName) {
|
|
246
247
|
const packagePath = path.join("packages", folderName);
|
|
247
|
-
await
|
|
248
|
-
await
|
|
248
|
+
await installPackages({ stdio: "inherit", cwd: getPaths().base });
|
|
249
|
+
await runScript("build", [], { stdio: "inherit", cwd: packagePath });
|
|
249
250
|
}
|
|
250
251
|
const handler = async ({ name, force, ...rest }) => {
|
|
251
252
|
recordTelemetryAttributes({
|
|
@@ -425,8 +426,7 @@ const handler = async ({ name, force, ...rest }) => {
|
|
|
425
426
|
{
|
|
426
427
|
title: "Cleaning up...",
|
|
427
428
|
task: () => {
|
|
428
|
-
|
|
429
|
-
"eslint",
|
|
429
|
+
runBinSync("eslint", [
|
|
430
430
|
"--fix",
|
|
431
431
|
"--config",
|
|
432
432
|
`${getPaths().base}/node_modules/@cedarjs/eslint-config/index.js`,
|
|
@@ -35,7 +35,13 @@ const templateVariables = (name) => {
|
|
|
35
35
|
subscriptionServiceResolver: `publishTo${pascalcase(name)}Channel`
|
|
36
36
|
};
|
|
37
37
|
};
|
|
38
|
-
async function handler({
|
|
38
|
+
async function handler({
|
|
39
|
+
name,
|
|
40
|
+
type,
|
|
41
|
+
force,
|
|
42
|
+
verbose,
|
|
43
|
+
silent
|
|
44
|
+
}) {
|
|
39
45
|
const cedarPaths = getPaths();
|
|
40
46
|
const ts = isTypeScriptProject();
|
|
41
47
|
name = pluralize.singular(name.toLowerCase());
|
|
@@ -65,7 +71,8 @@ async function handler({ name, type, force, verbose, silent }) {
|
|
|
65
71
|
{
|
|
66
72
|
title: "Checking for realtime environment prerequisites ...",
|
|
67
73
|
task: () => {
|
|
68
|
-
isServerFileSetup()
|
|
74
|
+
isServerFileSetup();
|
|
75
|
+
isRealtimeSetup();
|
|
69
76
|
}
|
|
70
77
|
},
|
|
71
78
|
{
|
|
@@ -209,9 +216,11 @@ async function handler({ name, type, force, verbose, silent }) {
|
|
|
209
216
|
try {
|
|
210
217
|
await tasks.run();
|
|
211
218
|
} catch (e) {
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
process.
|
|
219
|
+
const message = e instanceof Error ? e.message : String(e);
|
|
220
|
+
const exitCode = e instanceof Error && "exitCode" in e && typeof e.exitCode === "number" ? e.exitCode : 1;
|
|
221
|
+
errorTelemetry(process.argv, message);
|
|
222
|
+
console.error(c.error(message));
|
|
223
|
+
process.exit(exitCode);
|
|
215
224
|
}
|
|
216
225
|
}
|
|
217
226
|
export {
|
|
@@ -2,11 +2,14 @@ import fs from "node:fs";
|
|
|
2
2
|
import path from "path";
|
|
3
3
|
import camelcase from "camelcase";
|
|
4
4
|
import { paramCase } from "change-case";
|
|
5
|
-
import execa from "execa";
|
|
6
5
|
import humanize from "humanize-string";
|
|
7
6
|
import { Listr } from "listr2";
|
|
8
7
|
import pascalcase from "pascalcase";
|
|
9
8
|
import { recordTelemetryAttributes, colors as c } from "@cedarjs/cli-helpers";
|
|
9
|
+
import {
|
|
10
|
+
addWorkspacePackages,
|
|
11
|
+
removeWorkspacePackages
|
|
12
|
+
} from "@cedarjs/cli-helpers/packageManager/packages";
|
|
10
13
|
import { generate as generateTypes } from "@cedarjs/internal/dist/generate/generate";
|
|
11
14
|
import { getConfig } from "@cedarjs/project-config";
|
|
12
15
|
import { pluralize, singularize } from "@cedarjs/utils/cedarPluralize";
|
|
@@ -500,9 +503,9 @@ const addHelperPackages = async (task) => {
|
|
|
500
503
|
if (packageJson.default.dependencies["humanize-string"]) {
|
|
501
504
|
return task.skip("Skipping. Already installed");
|
|
502
505
|
}
|
|
503
|
-
await
|
|
506
|
+
await addWorkspacePackages("web", ["humanize-string@2.1.0"]);
|
|
504
507
|
addFunctionToRollback(async () => {
|
|
505
|
-
await
|
|
508
|
+
await removeWorkspacePackages("web", ["humanize-string"]);
|
|
506
509
|
});
|
|
507
510
|
};
|
|
508
511
|
const addSetImport = (task) => {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import execa from "execa";
|
|
2
1
|
import { terminalLink } from "termi-link";
|
|
3
2
|
import { recordTelemetryAttributes } from "@cedarjs/cli-helpers";
|
|
3
|
+
import { runBinSync } from "@cedarjs/cli-helpers/packageManager/exec";
|
|
4
4
|
import * as generateCell from "./generate/cell/cell.js";
|
|
5
5
|
import * as generateComponent from "./generate/component/component.js";
|
|
6
6
|
import * as generateDataMigration from "./generate/dataMigration/dataMigration.js";
|
|
@@ -32,7 +32,7 @@ const getExitCode = (error) => {
|
|
|
32
32
|
const builder = (yargs) => yargs.command("types", "Generate supplementary code", {}, () => {
|
|
33
33
|
recordTelemetryAttributes({ command: "generate types" });
|
|
34
34
|
try {
|
|
35
|
-
|
|
35
|
+
runBinSync("cedar-gen", [], { stdio: "inherit" });
|
|
36
36
|
} catch (error) {
|
|
37
37
|
process.exitCode = getExitCode(error) ?? 1;
|
|
38
38
|
}
|
package/dist/lib/test.js
CHANGED
|
@@ -76,6 +76,10 @@ vi.mock("@cedarjs/project-config", async (importOriginal) => {
|
|
|
76
76
|
}
|
|
77
77
|
};
|
|
78
78
|
});
|
|
79
|
+
vi.mock("@cedarjs/project-config/packageManager", () => ({
|
|
80
|
+
getPackageManager: vi.fn(() => "yarn"),
|
|
81
|
+
resetPackageManagerCache: vi.fn()
|
|
82
|
+
}));
|
|
79
83
|
vi.mock("@cedarjs/cli-helpers", async (importOriginal) => {
|
|
80
84
|
const originalCliHelpers = await importOriginal();
|
|
81
85
|
return {
|
package/dist/plugin.js
CHANGED
|
@@ -112,7 +112,9 @@ async function loadPlugins(yargs) {
|
|
|
112
112
|
continue;
|
|
113
113
|
}
|
|
114
114
|
const commandFirstWords = [];
|
|
115
|
-
for (const [command, info] of Object.entries(
|
|
115
|
+
for (const [command, info] of Object.entries(
|
|
116
|
+
cacheEntry
|
|
117
|
+
)) {
|
|
116
118
|
commandFirstWords.push(command.split(" ")[0]);
|
|
117
119
|
commandFirstWords.push(
|
|
118
120
|
...info.aliases?.map((a) => a.split(" ")[0]) ?? []
|
|
@@ -193,16 +195,18 @@ async function loadCommandsFromCacheOrPackage(packageName, cache, autoInstall, r
|
|
|
193
195
|
return {
|
|
194
196
|
command,
|
|
195
197
|
describe: info.description,
|
|
196
|
-
aliases: info.aliases
|
|
198
|
+
aliases: info.aliases,
|
|
199
|
+
handler: () => {
|
|
200
|
+
}
|
|
197
201
|
};
|
|
198
202
|
});
|
|
199
203
|
return commands;
|
|
200
204
|
}
|
|
201
205
|
const plugin = await loadPluginPackage(packageName, void 0, autoInstall);
|
|
202
206
|
if (plugin) {
|
|
203
|
-
const
|
|
207
|
+
const rawCommands = plugin.commands ?? [];
|
|
204
208
|
const cacheUpdate = {};
|
|
205
|
-
for (const command of
|
|
209
|
+
for (const command of rawCommands) {
|
|
206
210
|
const info = {
|
|
207
211
|
aliases: command.aliases,
|
|
208
212
|
description: command.description
|
|
@@ -211,10 +215,10 @@ async function loadCommandsFromCacheOrPackage(packageName, cache, autoInstall, r
|
|
|
211
215
|
cacheUpdate[command.command] = info;
|
|
212
216
|
}
|
|
213
217
|
}
|
|
214
|
-
if (Object.keys(cacheUpdate).length > 0) {
|
|
218
|
+
if (cache && Object.keys(cacheUpdate).length > 0) {
|
|
215
219
|
cache[packageName] = cacheUpdate;
|
|
216
220
|
}
|
|
217
|
-
return commands;
|
|
221
|
+
return plugin.commands ?? [];
|
|
218
222
|
}
|
|
219
223
|
return [];
|
|
220
224
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cedarjs/cli",
|
|
3
|
-
"version": "5.0.0-canary.
|
|
3
|
+
"version": "5.0.0-canary.2479",
|
|
4
4
|
"description": "The CedarJS Command Line",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -33,17 +33,17 @@
|
|
|
33
33
|
"dependencies": {
|
|
34
34
|
"@babel/parser": "7.29.3",
|
|
35
35
|
"@babel/preset-typescript": "7.28.5",
|
|
36
|
-
"@cedarjs/api-server": "5.0.0-canary.
|
|
37
|
-
"@cedarjs/cli-helpers": "5.0.0-canary.
|
|
38
|
-
"@cedarjs/fastify-web": "5.0.0-canary.
|
|
39
|
-
"@cedarjs/internal": "5.0.0-canary.
|
|
40
|
-
"@cedarjs/prerender": "5.0.0-canary.
|
|
41
|
-
"@cedarjs/project-config": "5.0.0-canary.
|
|
42
|
-
"@cedarjs/structure": "5.0.0-canary.
|
|
43
|
-
"@cedarjs/telemetry": "5.0.0-canary.
|
|
44
|
-
"@cedarjs/utils": "5.0.0-canary.
|
|
45
|
-
"@cedarjs/vite": "5.0.0-canary.
|
|
46
|
-
"@cedarjs/web-server": "5.0.0-canary.
|
|
36
|
+
"@cedarjs/api-server": "5.0.0-canary.2479",
|
|
37
|
+
"@cedarjs/cli-helpers": "5.0.0-canary.2479",
|
|
38
|
+
"@cedarjs/fastify-web": "5.0.0-canary.2479",
|
|
39
|
+
"@cedarjs/internal": "5.0.0-canary.2479",
|
|
40
|
+
"@cedarjs/prerender": "5.0.0-canary.2479",
|
|
41
|
+
"@cedarjs/project-config": "5.0.0-canary.2479",
|
|
42
|
+
"@cedarjs/structure": "5.0.0-canary.2479",
|
|
43
|
+
"@cedarjs/telemetry": "5.0.0-canary.2479",
|
|
44
|
+
"@cedarjs/utils": "5.0.0-canary.2479",
|
|
45
|
+
"@cedarjs/vite": "5.0.0-canary.2479",
|
|
46
|
+
"@cedarjs/web-server": "5.0.0-canary.2479",
|
|
47
47
|
"@listr2/prompt-adapter-enquirer": "4.2.1",
|
|
48
48
|
"@opentelemetry/api": "1.9.1",
|
|
49
49
|
"@opentelemetry/core": "1.30.1",
|