@cedarjs/cli 1.0.0-canary.12726 → 1.0.0-canary.12729

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.
@@ -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, {
@@ -204,17 +204,12 @@ const handler = async ({ dryRun, tag, verbose, dedupe, yes }) => {
204
204
  await tasks.run();
205
205
  };
206
206
  async function yarnInstall({ verbose }) {
207
- const yarnVersion = await getCmdMajorVersion("yarn");
208
207
  try {
209
- await execa(
210
- "yarn install",
211
- yarnVersion > 1 ? [] : ["--force", "--non-interactive"],
212
- {
213
- shell: true,
214
- stdio: verbose ? "inherit" : "pipe",
215
- cwd: getPaths().base
216
- }
217
- );
208
+ await execa("yarn install", {
209
+ shell: true,
210
+ stdio: verbose ? "inherit" : "pipe",
211
+ cwd: getPaths().base
212
+ });
218
213
  } catch (e) {
219
214
  throw new Error(
220
215
  "Could not finish installation. Please run `yarn install` and then `yarn dedupe`, before continuing"
@@ -433,31 +428,13 @@ async function refreshPrismaClient(task, { verbose }) {
433
428
  console.log(c.error(e.message));
434
429
  }
435
430
  }
436
- const getCmdMajorVersion = async (command2) => {
437
- const { stdout } = await execa(command2, ["--version"], {
438
- cwd: getPaths().base
439
- });
440
- if (!SEMVER_REGEX.test(stdout)) {
441
- throw new Error(`Unable to verify ${command2} version.`);
442
- }
443
- const version = stdout.match(SEMVER_REGEX)[0];
444
- return parseInt(version.split(".")[0]);
445
- };
446
431
  const dedupeDeps = async (task, { verbose }) => {
447
432
  try {
448
- const yarnVersion = await getCmdMajorVersion("yarn");
449
- const baseExecaArgsForDedupe = {
433
+ await execa("yarn dedupe", {
450
434
  shell: true,
451
435
  stdio: verbose ? "inherit" : "pipe",
452
436
  cwd: getPaths().base
453
- };
454
- if (yarnVersion > 1) {
455
- await execa("yarn", ["dedupe"], baseExecaArgsForDedupe);
456
- } else {
457
- task.skip(
458
- "Yarn 1.x doesn't support dedupe directly. Please upgrade yarn or use npx with `npx yarn-deduplicate` manually."
459
- );
460
- }
437
+ });
461
438
  } catch (e) {
462
439
  console.log(c.error(e.message));
463
440
  throw new Error(
@@ -470,7 +447,6 @@ export {
470
447
  builder,
471
448
  command,
472
449
  description,
473
- getCmdMajorVersion,
474
450
  handler,
475
451
  validateTag
476
452
  };
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 {
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": "1.0.0-canary.12726+454aa0bc6",
3
+ "version": "1.0.0-canary.12729+338020ede",
4
4
  "description": "The CedarJS Command Line",
5
5
  "repository": {
6
6
  "type": "git",
@@ -32,15 +32,15 @@
32
32
  "dependencies": {
33
33
  "@babel/preset-typescript": "7.27.1",
34
34
  "@babel/runtime-corejs3": "7.27.6",
35
- "@cedarjs/api-server": "1.0.0-canary.12726",
36
- "@cedarjs/cli-helpers": "1.0.0-canary.12726",
37
- "@cedarjs/fastify-web": "1.0.0-canary.12726",
38
- "@cedarjs/internal": "1.0.0-canary.12726",
39
- "@cedarjs/prerender": "1.0.0-canary.12726",
40
- "@cedarjs/project-config": "1.0.0-canary.12726",
41
- "@cedarjs/structure": "1.0.0-canary.12726",
42
- "@cedarjs/telemetry": "1.0.0-canary.12726",
43
- "@cedarjs/web-server": "1.0.0-canary.12726",
35
+ "@cedarjs/api-server": "1.0.0-canary.12729",
36
+ "@cedarjs/cli-helpers": "1.0.0-canary.12729",
37
+ "@cedarjs/fastify-web": "1.0.0-canary.12729",
38
+ "@cedarjs/internal": "1.0.0-canary.12729",
39
+ "@cedarjs/prerender": "1.0.0-canary.12729",
40
+ "@cedarjs/project-config": "1.0.0-canary.12729",
41
+ "@cedarjs/structure": "1.0.0-canary.12729",
42
+ "@cedarjs/telemetry": "1.0.0-canary.12729",
43
+ "@cedarjs/web-server": "1.0.0-canary.12729",
44
44
  "@listr2/prompt-adapter-enquirer": "2.0.16",
45
45
  "@opentelemetry/api": "1.8.0",
46
46
  "@opentelemetry/core": "1.22.0",
@@ -102,5 +102,5 @@
102
102
  "publishConfig": {
103
103
  "access": "public"
104
104
  },
105
- "gitHead": "454aa0bc6f3d13376f8ac6bcc7be381344e46b4d"
105
+ "gitHead": "338020ede5f5249d4126a6914f762c35ad1448f2"
106
106
  }