@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.
@@ -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
- return importedHandler(argv);
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 {
@@ -17,7 +17,7 @@ const tasks = ({ name, path }) => new Listr(
17
17
  title: "Destroying page files...",
18
18
  task: async () => {
19
19
  const p = pathName(path, name);
20
- const f = pageFiles({
20
+ const f = await pageFiles({
21
21
  name,
22
22
  path: p,
23
23
  stories: true,
@@ -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 cedarjs setup realtime` first."
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", { shell: true, stdio: "inherit" });
27
+ execa.sync("yarn", ["rw-gen"], { stdio: "inherit" });
30
28
  } catch (error) {
31
29
  process.exitCode = error.exitCode ?? 1;
32
30
  }
@@ -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 result = await execa(
33
- "yarn eslint",
34
- [
35
- fix && "--fix",
36
- `--format ${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
- {
45
- cwd: getPaths().base,
46
- shell: true,
47
- stdio: "inherit"
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
- execa.sync(
53
- `"${path.join(rwjsPaths.base, "node_modules/.bin/prisma")}"`,
54
- args,
55
- {
56
- shell: true,
57
- cwd: rwjsPaths.base,
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
- const yarnVersion = await execa("yarn", ["--version"]);
98
- const isYarnV1 = yarnVersion.stdout.trim().startsWith("1");
99
- await execa(
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 ${yarnVersion > 1 ? "" : "-s"} tsc --noEmit --skipLibCheck`
22
+ command: `yarn tsc --noEmit --skipLibCheck`
25
23
  };
26
24
  });
27
25
  const { result } = concurrently(tscForAllSides, {
@@ -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
- "yarn install",
178
- yarnVersion > 1 ? [] : ["--force", "--non-interactive"],
179
- {
180
- shell: true,
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
- const yarnVersion = await getCmdMajorVersion("yarn");
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
  };
@@ -26,19 +26,27 @@ function spawnBackgroundProcess(name, cmd, args) {
26
26
  "w"
27
27
  );
28
28
  fs.writeSync(stderr, logHeader);
29
- const spawnOptions = os.type() === "Windows_NT" ? {
30
- // The following options run the process in the background without a console window, even though they don't look like they would.
31
- // See https://github.com/nodejs/node/issues/21825#issuecomment-503766781 for information
32
- detached: false,
33
- windowsHide: false,
34
- shell: true,
35
- stdio: ["ignore", stdout, stderr]
36
- } : {
37
- detached: true,
38
- stdio: ["ignore", stdout, stderr]
39
- };
40
- const child = spawn(cmd, args, spawnOptions);
41
- child.unref();
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
- yarnVersion.startsWith("1") && "-W",
384
- "add",
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
- pVersion
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
@@ -36,7 +36,6 @@ if (!command.length || command.some((cmd) => helpCommands.includes(cmd))) {
36
36
  try {
37
37
  execa.sync("yarn", [...command], {
38
38
  stdio: "inherit",
39
- shell: true,
40
39
  cwd: absRwFwPath,
41
40
  env: {
42
41
  RWJS_CWD: projectPath
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cedarjs/cli",
3
- "version": "0.15.1-next.0+3484fef03",
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.0+3484fef03",
36
- "@cedarjs/cli-helpers": "0.15.1-next.0+3484fef03",
37
- "@cedarjs/fastify-web": "0.15.1-next.0+3484fef03",
38
- "@cedarjs/internal": "0.15.1-next.0+3484fef03",
39
- "@cedarjs/prerender": "0.15.1-next.0+3484fef03",
40
- "@cedarjs/project-config": "0.15.1-next.0+3484fef03",
41
- "@cedarjs/structure": "0.15.1-next.0+3484fef03",
42
- "@cedarjs/telemetry": "0.15.1-next.0+3484fef03",
43
- "@cedarjs/web-server": "0.15.1-next.0+3484fef03",
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": "3484fef0346fcb024623ed62d4621600b8a98d4c"
104
+ "gitHead": "0753a9ca25ba21702aed57f7f5e8b49db9957984"
106
105
  }