@cedarjs/cli 5.0.0-canary.2478 → 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/generate/cell/cellHandler.js +2 -1
- 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/job/jobHandler.js +2 -3
- package/dist/commands/generate/package/packageHandler.js +5 -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/package.json +12 -12
|
@@ -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
|
}
|
|
@@ -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
|
{
|
|
@@ -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`,
|
|
@@ -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/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",
|