@cedarjs/cli 0.15.1-next.0 → 0.15.1-next.23
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/destroy/helpers.js +3 -2
- package/dist/commands/destroy/page/pageHandler.js +1 -1
- package/dist/commands/experimental/util.js +1 -1
- package/dist/commands/generate/directive/directiveHandler.js +2 -8
- package/dist/commands/generate.js +2 -4
- package/dist/commands/lint.js +16 -18
- package/dist/commands/prismaHandler.js +6 -10
- package/dist/commands/serveBothHandler.js +1 -3
- package/dist/commands/serveWebHandler.js +0 -1
- package/dist/commands/setup/ui/libraries/tailwindcssHandler.js +3 -14
- package/dist/commands/testHandler.js +1 -2
- package/dist/commands/testHandlerEsm.js +1 -2
- package/dist/commands/type-checkHandler.js +1 -3
- package/dist/commands/upgrade.js +7 -31
- package/dist/lib/background.js +21 -13
- package/dist/lib/index.js +3 -9
- package/dist/middleware/checkNodeVersion.js +2 -4
- package/dist/rwfw.js +0 -1
- package/package.json +11 -12
|
@@ -12,8 +12,9 @@ const createYargsForComponentDestroy = ({ componentName }) => {
|
|
|
12
12
|
};
|
|
13
13
|
function createHandler(componentName) {
|
|
14
14
|
return async (argv) => {
|
|
15
|
-
const importedHandler = await import(`./${componentName}Handler.js`);
|
|
16
|
-
|
|
15
|
+
const importedHandler = await import(`./${componentName}/${componentName}Handler.js`);
|
|
16
|
+
const fn = importedHandler.default ?? importedHandler.handler ?? importedHandler;
|
|
17
|
+
return typeof fn === "function" ? fn(argv) : fn;
|
|
17
18
|
};
|
|
18
19
|
}
|
|
19
20
|
export {
|
|
@@ -55,7 +55,7 @@ const realtimeExists = () => {
|
|
|
55
55
|
const isRealtimeSetup = () => {
|
|
56
56
|
if (!realtimeExists()) {
|
|
57
57
|
throw new Error(
|
|
58
|
-
"Adding realtime events requires that CedarJS Realtime is setup. Please run `yarn
|
|
58
|
+
"Adding realtime events requires that CedarJS Realtime is setup. Please run `yarn cedar setup realtime` first."
|
|
59
59
|
);
|
|
60
60
|
}
|
|
61
61
|
return true;
|
|
@@ -120,15 +120,9 @@ const handler = async (args) => {
|
|
|
120
120
|
title: "Generating TypeScript definitions and GraphQL schemas ...",
|
|
121
121
|
task: () => {
|
|
122
122
|
addFunctionToRollback(async () => {
|
|
123
|
-
await execa("yarn rw-gen"
|
|
124
|
-
stdio: "pipe",
|
|
125
|
-
shell: true
|
|
126
|
-
});
|
|
123
|
+
await execa("yarn", ["rw-gen"], { stdio: "pipe" });
|
|
127
124
|
}, true);
|
|
128
|
-
return execa("yarn rw-gen"
|
|
129
|
-
stdio: "inherit",
|
|
130
|
-
shell: true
|
|
131
|
-
});
|
|
125
|
+
return execa("yarn", ["rw-gen"], { stdio: "inherit" });
|
|
132
126
|
}
|
|
133
127
|
},
|
|
134
128
|
{
|
|
@@ -22,11 +22,9 @@ const command = "generate <type>";
|
|
|
22
22
|
const aliases = ["g"];
|
|
23
23
|
const description = "Generate boilerplate code and type definitions";
|
|
24
24
|
const builder = (yargs) => yargs.command("types", "Generate supplementary code", {}, () => {
|
|
25
|
-
recordTelemetryAttributes({
|
|
26
|
-
command: "generate types"
|
|
27
|
-
});
|
|
25
|
+
recordTelemetryAttributes({ command: "generate types" });
|
|
28
26
|
try {
|
|
29
|
-
execa.sync("yarn rw-gen", {
|
|
27
|
+
execa.sync("yarn", ["rw-gen"], { stdio: "inherit" });
|
|
30
28
|
} catch (error) {
|
|
31
29
|
process.exitCode = error.exitCode ?? 1;
|
|
32
30
|
}
|
package/dist/commands/lint.js
CHANGED
|
@@ -29,24 +29,22 @@ const handler = async ({ path, fix, format }) => {
|
|
|
29
29
|
try {
|
|
30
30
|
const pathString = path?.join(" ");
|
|
31
31
|
const sbPath = getPaths().web.storybook;
|
|
32
|
-
const
|
|
33
|
-
"
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
}
|
|
49
|
-
);
|
|
32
|
+
const args = [
|
|
33
|
+
"eslint",
|
|
34
|
+
fix && "--fix",
|
|
35
|
+
"--format",
|
|
36
|
+
format,
|
|
37
|
+
!pathString && fs.existsSync(getPaths().web.src) && "web/src",
|
|
38
|
+
!pathString && fs.existsSync(getPaths().web.config) && "web/config",
|
|
39
|
+
!pathString && fs.existsSync(sbPath) && "web/.storybook",
|
|
40
|
+
!pathString && fs.existsSync(getPaths().scripts) && "scripts",
|
|
41
|
+
!pathString && fs.existsSync(getPaths().api.src) && "api/src",
|
|
42
|
+
pathString
|
|
43
|
+
].filter(Boolean);
|
|
44
|
+
const result = await execa("yarn", args, {
|
|
45
|
+
cwd: getPaths().base,
|
|
46
|
+
stdio: "inherit"
|
|
47
|
+
});
|
|
50
48
|
process.exitCode = result.exitCode;
|
|
51
49
|
} catch (error) {
|
|
52
50
|
process.exitCode = error.exitCode ?? 1;
|
|
@@ -49,16 +49,12 @@ const handler = async ({ _, $0, commands = [], ...options }) => {
|
|
|
49
49
|
console.log(c.underline("$ yarn prisma " + args.join(" ")));
|
|
50
50
|
console.log();
|
|
51
51
|
try {
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
stdio: "inherit",
|
|
59
|
-
cleanup: true
|
|
60
|
-
}
|
|
61
|
-
);
|
|
52
|
+
const prismaBin = path.join(rwjsPaths.base, "node_modules/.bin/prisma");
|
|
53
|
+
execa.sync(prismaBin, args, {
|
|
54
|
+
cwd: rwjsPaths.base,
|
|
55
|
+
stdio: "inherit",
|
|
56
|
+
cleanup: true
|
|
57
|
+
});
|
|
62
58
|
if (hasHelpOption || commands.length === 0) {
|
|
63
59
|
printWrapInfo();
|
|
64
60
|
}
|
|
@@ -16,8 +16,7 @@ const bothServerFileHandler = async (argv) => {
|
|
|
16
16
|
logSkippingFastifyWebServer();
|
|
17
17
|
await execa("yarn", ["rw-serve-fe"], {
|
|
18
18
|
cwd: getPaths().web.base,
|
|
19
|
-
stdio: "inherit"
|
|
20
|
-
shell: true
|
|
19
|
+
stdio: "inherit"
|
|
21
20
|
});
|
|
22
21
|
} else {
|
|
23
22
|
argv.apiPort ??= getAPIPort();
|
|
@@ -74,7 +73,6 @@ const bothSsrRscServerHandler = async (argv, rscEnabled) => {
|
|
|
74
73
|
const fePromise = execa("yarn", ["rw-serve-fe"], {
|
|
75
74
|
cwd: getPaths().web.base,
|
|
76
75
|
stdio: "inherit",
|
|
77
|
-
shell: true,
|
|
78
76
|
env: rscEnabled ? {
|
|
79
77
|
// TODO (RSC): Is this how we want to do it? If so, we need to find a way
|
|
80
78
|
// to merge this with users' NODE_OPTIONS
|
|
@@ -4,7 +4,6 @@ const webSsrServerHandler = async (rscEnabled) => {
|
|
|
4
4
|
await execa("yarn", ["rw-serve-fe"], {
|
|
5
5
|
cwd: getPaths().web.base,
|
|
6
6
|
stdio: "inherit",
|
|
7
|
-
shell: true,
|
|
8
7
|
env: rscEnabled ? {
|
|
9
8
|
// TODO (RSC): Is this how we want to do it? If so, we need to find a way
|
|
10
9
|
// to merge this with users' NODE_OPTIONS
|
|
@@ -94,20 +94,9 @@ const handler = async ({ force, install }) => {
|
|
|
94
94
|
{
|
|
95
95
|
title: `Install ${projectPackages.join(", ")}`,
|
|
96
96
|
task: async () => {
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
"yarn",
|
|
101
|
-
[
|
|
102
|
-
"add",
|
|
103
|
-
"-D",
|
|
104
|
-
...isYarnV1 ? ["-W"] : [],
|
|
105
|
-
...projectPackages
|
|
106
|
-
],
|
|
107
|
-
{
|
|
108
|
-
cwd: rwPaths.base
|
|
109
|
-
}
|
|
110
|
-
);
|
|
97
|
+
await execa("yarn", ["add", "-D", ...projectPackages], {
|
|
98
|
+
cwd: rwPaths.base
|
|
99
|
+
});
|
|
111
100
|
}
|
|
112
101
|
}
|
|
113
102
|
],
|
|
@@ -114,9 +114,8 @@ const handler = async ({
|
|
|
114
114
|
process.env.SKIP_DB_PUSH = "1";
|
|
115
115
|
}
|
|
116
116
|
const runCommand = async () => {
|
|
117
|
-
await execa("yarn jest", jestArgs, {
|
|
117
|
+
await execa("yarn", ["jest", ...jestArgs], {
|
|
118
118
|
cwd: rwjsPaths.base,
|
|
119
|
-
shell: true,
|
|
120
119
|
stdio: "inherit",
|
|
121
120
|
env: { DATABASE_URL }
|
|
122
121
|
});
|
|
@@ -62,9 +62,8 @@ const handler = async ({
|
|
|
62
62
|
process.env.SKIP_DB_PUSH = "1";
|
|
63
63
|
}
|
|
64
64
|
const runCommand = async () => {
|
|
65
|
-
await execa("yarn vitest", vitestArgs, {
|
|
65
|
+
await execa("yarn", ["vitest", ...vitestArgs], {
|
|
66
66
|
cwd: rwjsPaths.base,
|
|
67
|
-
shell: true,
|
|
68
67
|
stdio: "inherit",
|
|
69
68
|
env: { DATABASE_URL }
|
|
70
69
|
});
|
|
@@ -3,7 +3,6 @@ import concurrently from "concurrently";
|
|
|
3
3
|
import execa from "execa";
|
|
4
4
|
import { Listr } from "listr2";
|
|
5
5
|
import { recordTelemetryAttributes } from "@cedarjs/cli-helpers";
|
|
6
|
-
import { getCmdMajorVersion } from "../commands/upgrade.js";
|
|
7
6
|
import { generatePrismaClient } from "../lib/generatePrismaClient.js";
|
|
8
7
|
import { getPaths } from "../lib/index.js";
|
|
9
8
|
const handler = async ({ sides, verbose, prisma, generate }) => {
|
|
@@ -16,12 +15,11 @@ const handler = async ({ sides, verbose, prisma, generate }) => {
|
|
|
16
15
|
});
|
|
17
16
|
const typeCheck = async () => {
|
|
18
17
|
let conclusiveExitCode = 0;
|
|
19
|
-
const yarnVersion = await getCmdMajorVersion("yarn");
|
|
20
18
|
const tscForAllSides = sides.map((side) => {
|
|
21
19
|
const projectDir = path.join(getPaths().base, side);
|
|
22
20
|
return {
|
|
23
21
|
cwd: projectDir,
|
|
24
|
-
command: `yarn
|
|
22
|
+
command: `yarn tsc --noEmit --skipLibCheck`
|
|
25
23
|
};
|
|
26
24
|
});
|
|
27
25
|
const { result } = concurrently(tscForAllSides, {
|
package/dist/commands/upgrade.js
CHANGED
|
@@ -171,17 +171,12 @@ const handler = async ({ dryRun, tag, verbose, dedupe }) => {
|
|
|
171
171
|
await tasks.run();
|
|
172
172
|
};
|
|
173
173
|
async function yarnInstall({ verbose }) {
|
|
174
|
-
const yarnVersion = await getCmdMajorVersion("yarn");
|
|
175
174
|
try {
|
|
176
|
-
await execa(
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
stdio: verbose ? "inherit" : "pipe",
|
|
182
|
-
cwd: getPaths().base
|
|
183
|
-
}
|
|
184
|
-
);
|
|
175
|
+
await execa("yarn install", {
|
|
176
|
+
shell: true,
|
|
177
|
+
stdio: verbose ? "inherit" : "pipe",
|
|
178
|
+
cwd: getPaths().base
|
|
179
|
+
});
|
|
185
180
|
} catch (e) {
|
|
186
181
|
throw new Error(
|
|
187
182
|
"Could not finish installation. Please run `yarn install` and then `yarn dedupe`, before continuing"
|
|
@@ -400,31 +395,13 @@ async function refreshPrismaClient(task, { verbose }) {
|
|
|
400
395
|
console.log(c.error(e.message));
|
|
401
396
|
}
|
|
402
397
|
}
|
|
403
|
-
const getCmdMajorVersion = async (command2) => {
|
|
404
|
-
const { stdout } = await execa(command2, ["--version"], {
|
|
405
|
-
cwd: getPaths().base
|
|
406
|
-
});
|
|
407
|
-
if (!SEMVER_REGEX.test(stdout)) {
|
|
408
|
-
throw new Error(`Unable to verify ${command2} version.`);
|
|
409
|
-
}
|
|
410
|
-
const version = stdout.match(SEMVER_REGEX)[0];
|
|
411
|
-
return parseInt(version.split(".")[0]);
|
|
412
|
-
};
|
|
413
398
|
const dedupeDeps = async (task, { verbose }) => {
|
|
414
399
|
try {
|
|
415
|
-
|
|
416
|
-
const baseExecaArgsForDedupe = {
|
|
400
|
+
await execa("yarn dedupe", {
|
|
417
401
|
shell: true,
|
|
418
402
|
stdio: verbose ? "inherit" : "pipe",
|
|
419
403
|
cwd: getPaths().base
|
|
420
|
-
};
|
|
421
|
-
if (yarnVersion > 1) {
|
|
422
|
-
await execa("yarn", ["dedupe"], baseExecaArgsForDedupe);
|
|
423
|
-
} else {
|
|
424
|
-
task.skip(
|
|
425
|
-
"Yarn 1.x doesn't support dedupe directly. Please upgrade yarn or use npx with `npx yarn-deduplicate` manually."
|
|
426
|
-
);
|
|
427
|
-
}
|
|
404
|
+
});
|
|
428
405
|
} catch (e) {
|
|
429
406
|
console.log(c.error(e.message));
|
|
430
407
|
throw new Error(
|
|
@@ -437,7 +414,6 @@ export {
|
|
|
437
414
|
builder,
|
|
438
415
|
command,
|
|
439
416
|
description,
|
|
440
|
-
getCmdMajorVersion,
|
|
441
417
|
handler,
|
|
442
418
|
validateTag
|
|
443
419
|
};
|
package/dist/lib/background.js
CHANGED
|
@@ -26,19 +26,27 @@ function spawnBackgroundProcess(name, cmd, args) {
|
|
|
26
26
|
"w"
|
|
27
27
|
);
|
|
28
28
|
fs.writeSync(stderr, logHeader);
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
29
|
+
if (os.type() === "Windows_NT") {
|
|
30
|
+
const spawnOptions = {
|
|
31
|
+
// The following options run the process in the background without a
|
|
32
|
+
// console window, even though they don't look like they would.
|
|
33
|
+
// See https://github.com/nodejs/node/issues/21825#issuecomment-503766781
|
|
34
|
+
// for information.
|
|
35
|
+
detached: false,
|
|
36
|
+
windowsHide: false,
|
|
37
|
+
shell: true,
|
|
38
|
+
stdio: ["ignore", stdout, stderr]
|
|
39
|
+
};
|
|
40
|
+
const child = spawn(cmd + " " + args.join(" "), spawnOptions);
|
|
41
|
+
child.unref();
|
|
42
|
+
} else {
|
|
43
|
+
const spawnOptions = {
|
|
44
|
+
detached: true,
|
|
45
|
+
stdio: ["ignore", stdout, stderr]
|
|
46
|
+
};
|
|
47
|
+
const child = spawn(cmd, args, spawnOptions);
|
|
48
|
+
child.unref();
|
|
49
|
+
}
|
|
42
50
|
}
|
|
43
51
|
export {
|
|
44
52
|
spawnBackgroundProcess
|
package/dist/lib/index.js
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { execSync } from "child_process";
|
|
2
1
|
import https from "https";
|
|
3
2
|
import path from "path";
|
|
4
3
|
import * as babel from "@babel/core";
|
|
@@ -375,16 +374,11 @@ const addPackagesTask = async ({
|
|
|
375
374
|
].filter(Boolean)
|
|
376
375
|
];
|
|
377
376
|
} else {
|
|
378
|
-
const stdout = execSync("yarn --version");
|
|
379
|
-
const yarnVersion = stdout.toString().trim();
|
|
380
377
|
installCommand = [
|
|
381
378
|
"yarn",
|
|
382
|
-
[
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
devDependency && "--dev",
|
|
386
|
-
...packagesWithSameRWVersion
|
|
387
|
-
].filter(Boolean)
|
|
379
|
+
["add", devDependency && "--dev", ...packagesWithSameRWVersion].filter(
|
|
380
|
+
Boolean
|
|
381
|
+
)
|
|
388
382
|
];
|
|
389
383
|
}
|
|
390
384
|
return {
|
|
@@ -11,10 +11,8 @@ function checkNodeVersion() {
|
|
|
11
11
|
}
|
|
12
12
|
checks.ok = false;
|
|
13
13
|
checks.message = [
|
|
14
|
-
`Your Node.js version is ${c.warning(
|
|
15
|
-
|
|
16
|
-
)}, but Redwood requires ${c.important(`>=${LOWER_BOUND}`)}.`,
|
|
17
|
-
"Upgrade your Node.js version using `nvm` or a similar tool. See https://redwoodjs.com/docs/how-to/using-nvm."
|
|
14
|
+
`Your Node.js version is ${c.warning(pVersion)}, but Cedar requires ${c.important(`>= ${LOWER_BOUND}`)}.`,
|
|
15
|
+
"Upgrade your Node.js version using `nvm`, `n`, or a similar tool. See https://cedarjs.com/docs/how-to/using-nvm."
|
|
18
16
|
].join("\n");
|
|
19
17
|
return checks;
|
|
20
18
|
}
|
package/dist/rwfw.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cedarjs/cli",
|
|
3
|
-
"version": "0.15.1-next.
|
|
3
|
+
"version": "0.15.1-next.23+0753a9ca2",
|
|
4
4
|
"description": "The CedarJS Command Line",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -10,7 +10,6 @@
|
|
|
10
10
|
"license": "MIT",
|
|
11
11
|
"type": "module",
|
|
12
12
|
"bin": {
|
|
13
|
-
"cdr": "./dist/index.js",
|
|
14
13
|
"cedarjs": "./dist/index.js",
|
|
15
14
|
"redwood": "./dist/index.js",
|
|
16
15
|
"rw": "./dist/index.js",
|
|
@@ -32,15 +31,15 @@
|
|
|
32
31
|
"dependencies": {
|
|
33
32
|
"@babel/preset-typescript": "7.27.1",
|
|
34
33
|
"@babel/runtime-corejs3": "7.27.6",
|
|
35
|
-
"@cedarjs/api-server": "0.15.1-next.
|
|
36
|
-
"@cedarjs/cli-helpers": "0.15.1-next.
|
|
37
|
-
"@cedarjs/fastify-web": "0.15.1-next.
|
|
38
|
-
"@cedarjs/internal": "0.15.1-next.
|
|
39
|
-
"@cedarjs/prerender": "0.15.1-next.
|
|
40
|
-
"@cedarjs/project-config": "0.15.1-next.
|
|
41
|
-
"@cedarjs/structure": "0.15.1-next.
|
|
42
|
-
"@cedarjs/telemetry": "0.15.1-next.
|
|
43
|
-
"@cedarjs/web-server": "0.15.1-next.
|
|
34
|
+
"@cedarjs/api-server": "0.15.1-next.23+0753a9ca2",
|
|
35
|
+
"@cedarjs/cli-helpers": "0.15.1-next.23+0753a9ca2",
|
|
36
|
+
"@cedarjs/fastify-web": "0.15.1-next.23+0753a9ca2",
|
|
37
|
+
"@cedarjs/internal": "0.15.1-next.23+0753a9ca2",
|
|
38
|
+
"@cedarjs/prerender": "0.15.1-next.23+0753a9ca2",
|
|
39
|
+
"@cedarjs/project-config": "0.15.1-next.23+0753a9ca2",
|
|
40
|
+
"@cedarjs/structure": "0.15.1-next.23+0753a9ca2",
|
|
41
|
+
"@cedarjs/telemetry": "0.15.1-next.23+0753a9ca2",
|
|
42
|
+
"@cedarjs/web-server": "0.15.1-next.23+0753a9ca2",
|
|
44
43
|
"@listr2/prompt-adapter-enquirer": "2.0.16",
|
|
45
44
|
"@opentelemetry/api": "1.8.0",
|
|
46
45
|
"@opentelemetry/core": "1.22.0",
|
|
@@ -102,5 +101,5 @@
|
|
|
102
101
|
"publishConfig": {
|
|
103
102
|
"access": "public"
|
|
104
103
|
},
|
|
105
|
-
"gitHead": "
|
|
104
|
+
"gitHead": "0753a9ca25ba21702aed57f7f5e8b49db9957984"
|
|
106
105
|
}
|