@cedarjs/cli 4.0.0-canary.13673 → 4.0.0-canary.13675

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.
@@ -1,5 +1,6 @@
1
1
  import { terminalLink } from "termi-link";
2
2
  import { recordTelemetryAttributes } from "@cedarjs/cli-helpers";
3
+ import { getPackageManager } from "@cedarjs/project-config/packageManager";
3
4
  const command = "baremetal [environment]";
4
5
  const description = "Deploy to baremetal server(s)";
5
6
  const builder = (yargs) => {
@@ -23,7 +24,7 @@ const builder = (yargs) => {
23
24
  type: "boolean"
24
25
  });
25
26
  yargs.option("install", {
26
- describe: "Run `yarn install`",
27
+ describe: `Run \`${getPackageManager()} install\``,
27
28
  default: true,
28
29
  type: "boolean"
29
30
  });
@@ -3,7 +3,9 @@ import path from "node:path";
3
3
  import execa from "execa";
4
4
  import { Listr } from "listr2";
5
5
  import { prettify } from "@cedarjs/cli-helpers";
6
+ import { install } from "@cedarjs/cli-helpers/packageManager";
6
7
  import { getConfig, getConfigPath } from "@cedarjs/project-config";
8
+ import { getPackageManager } from "@cedarjs/project-config/packageManager";
7
9
  import { errorTelemetry } from "@cedarjs/telemetry";
8
10
  import c from "../../lib/colors.js";
9
11
  import { getPaths, transformTSToJS, writeFile } from "../../lib/index.js";
@@ -379,9 +381,8 @@ const handler = async ({ force, verbose }) => {
379
381
  overwriteExisting: true
380
382
  }
381
383
  );
382
- await execa("yarn", [], {
383
- cwd: getPaths().web.base
384
- });
384
+ const pm = getPackageManager();
385
+ await execa(pm, [install()], { cwd: getPaths().web.base });
385
386
  }
386
387
  },
387
388
  {
@@ -1,4 +1,5 @@
1
1
  import { terminalLink } from "termi-link";
2
+ import { dedupeIsSupported } from "@cedarjs/cli-helpers/packageManager";
2
3
  import c from "../../lib/colors.js";
3
4
  import { isValidCedarJSTag } from "./tags.js";
4
5
  const SEMVER_REGEX = /(?<=^v?|\sv?)(?:0|[1-9]\d*)\.(?:0|[1-9]\d*)\.(?:0|[1-9]\d*)(?:-(?:0|[1-9]\d*|[\da-z-]*[a-z-][\da-z-]*)(?:\.(?:0|[1-9]\d*|[\da-z-]*[a-z-][\da-z-]*))*)?(?:\+[\da-z-]+(?:\.[\da-z-]+)*)?(?=$|\s)/i;
@@ -40,7 +41,8 @@ const builder = (yargs) => {
40
41
  }).option("dedupe", {
41
42
  description: "Skip dedupe check with --no-dedupe",
42
43
  type: "boolean",
43
- default: true
44
+ default: true,
45
+ hidden: !dedupeIsSupported()
44
46
  }).option("yes", {
45
47
  alias: "y",
46
48
  describe: "Skip prompts and use defaults",
@@ -6,27 +6,29 @@ import latestVersion from "latest-version";
6
6
  import { Listr } from "listr2";
7
7
  import { terminalLink } from "termi-link";
8
8
  import { recordTelemetryAttributes } from "@cedarjs/cli-helpers";
9
+ import {
10
+ dedupe,
11
+ dedupeIsSupported,
12
+ install,
13
+ installationErrorMessage,
14
+ prettyPrintCedarCommand
15
+ } from "@cedarjs/cli-helpers/packageManager";
9
16
  import { getConfig } from "@cedarjs/project-config";
17
+ import { getPackageManager } from "@cedarjs/project-config/packageManager";
10
18
  import c from "../../lib/colors.js";
11
19
  import { generatePrismaClient } from "../../lib/generatePrismaClient.js";
12
20
  import { getPaths } from "../../lib/index.js";
13
21
  import { PLUGIN_CACHE_FILENAME } from "../../lib/plugin.js";
14
22
  import { runPreUpgradeScripts } from "./preUpgradeScripts.js";
15
23
  import { isValidCedarJSTag } from "./tags.js";
16
- const handler = async ({
17
- dryRun,
18
- tag,
19
- verbose,
20
- dedupe,
21
- yes,
22
- force
23
- }) => {
24
+ const handler = async (upgradeOptions) => {
25
+ const { dryRun, tag, verbose, dedupe: dedupe2, yes, force } = upgradeOptions;
24
26
  recordTelemetryAttributes({
25
27
  command: "upgrade",
26
28
  dryRun: !!dryRun,
27
29
  tag: tag ?? "latest",
28
30
  verbose: !!verbose,
29
- dedupe: !!dedupe,
31
+ dedupe: !!dedupe2,
30
32
  yes: !!yes,
31
33
  force: !!force
32
34
  });
@@ -104,8 +106,8 @@ const handler = async ({
104
106
  enabled: (ctx) => !ctx.preUpgradeError
105
107
  },
106
108
  {
107
- title: "Running yarn install",
108
- task: () => yarnInstall({ verbose }),
109
+ title: `Running ${getPackageManager()} ${install()}`,
110
+ task: () => packageManagerInstall({ verbose }),
109
111
  enabled: (ctx) => !ctx.preUpgradeError,
110
112
  skip: () => !!dryRun
111
113
  },
@@ -117,8 +119,8 @@ const handler = async ({
117
119
  },
118
120
  {
119
121
  title: "De-duplicating dependencies",
120
- skip: () => !!dryRun || !dedupe,
121
- enabled: (ctx) => !ctx.preUpgradeError,
122
+ skip: () => !!dryRun || !dedupe2,
123
+ enabled: (ctx) => dedupeIsSupported() && !ctx.preUpgradeError,
122
124
  task: (_ctx, task) => dedupeDeps(task, { verbose })
123
125
  },
124
126
  {
@@ -192,17 +194,15 @@ const handler = async ({
192
194
  console.log(" " + preUpgradeMessage.replace(/\n/g, "\n "));
193
195
  }
194
196
  };
195
- async function yarnInstall({ verbose }) {
197
+ async function packageManagerInstall({ verbose }) {
196
198
  try {
197
- await execa("yarn install", {
199
+ await execa(`${getPackageManager()} ${install()}`, {
198
200
  shell: true,
199
201
  stdio: verbose ? "inherit" : "pipe",
200
202
  cwd: getPaths().base
201
203
  });
202
204
  } catch {
203
- throw new Error(
204
- "Could not finish installation. Please run `yarn install` and then `yarn dedupe`, before continuing"
205
- );
205
+ throw new Error(installationErrorMessage());
206
206
  }
207
207
  }
208
208
  async function removeCliCache({
@@ -447,14 +447,18 @@ async function refreshPrismaClient(task, { verbose }) {
447
447
  const message = e instanceof Error ? e.message : String(e);
448
448
  task.skip("Refreshing the Prisma client caused an Error.");
449
449
  console.log(
450
- "You may need to update your prisma client manually: $ yarn cedar prisma generate"
450
+ "You may need to update your prisma client manually: $ " + prettyPrintCedarCommand(["prisma", "generate"])
451
451
  );
452
452
  console.log(c.error(message));
453
453
  }
454
454
  }
455
- const dedupeDeps = async (_task, { verbose }) => {
455
+ async function dedupeDeps(_task, { verbose }) {
456
+ const dedupeCmd = dedupe();
457
+ if (!dedupeCmd) {
458
+ return;
459
+ }
456
460
  try {
457
- await execa("yarn dedupe", {
461
+ await execa(`${getPackageManager()} ${dedupeCmd}`, {
458
462
  shell: true,
459
463
  stdio: verbose ? "inherit" : "pipe",
460
464
  cwd: getPaths().base
@@ -463,11 +467,11 @@ const dedupeDeps = async (_task, { verbose }) => {
463
467
  const message = e instanceof Error ? e.message : String(e);
464
468
  console.log(c.error(message));
465
469
  throw new Error(
466
- "Could not finish de-duplication. Please run `yarn dedupe` before continuing"
470
+ `Could not finish de-duplication. Please run \`${getPackageManager()} ${dedupeCmd}\` before continuing`
467
471
  );
468
472
  }
469
- await yarnInstall({ verbose });
470
- };
473
+ await packageManagerInstall({ verbose });
474
+ }
471
475
  export {
472
476
  handler
473
477
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cedarjs/cli",
3
- "version": "4.0.0-canary.13673+dcde8831a",
3
+ "version": "4.0.0-canary.13675+8262a8b2b",
4
4
  "description": "The CedarJS Command Line",
5
5
  "repository": {
6
6
  "type": "git",
@@ -33,16 +33,16 @@
33
33
  "dependencies": {
34
34
  "@babel/parser": "7.29.2",
35
35
  "@babel/preset-typescript": "7.28.5",
36
- "@cedarjs/api-server": "4.0.0-canary.13673",
37
- "@cedarjs/cli-helpers": "4.0.0-canary.13673",
38
- "@cedarjs/fastify-web": "4.0.0-canary.13673",
39
- "@cedarjs/internal": "4.0.0-canary.13673",
40
- "@cedarjs/prerender": "4.0.0-canary.13673",
41
- "@cedarjs/project-config": "4.0.0-canary.13673",
42
- "@cedarjs/structure": "4.0.0-canary.13673",
43
- "@cedarjs/telemetry": "4.0.0-canary.13673",
44
- "@cedarjs/utils": "4.0.0-canary.13673",
45
- "@cedarjs/web-server": "4.0.0-canary.13673",
36
+ "@cedarjs/api-server": "4.0.0-canary.13675",
37
+ "@cedarjs/cli-helpers": "4.0.0-canary.13675",
38
+ "@cedarjs/fastify-web": "4.0.0-canary.13675",
39
+ "@cedarjs/internal": "4.0.0-canary.13675",
40
+ "@cedarjs/prerender": "4.0.0-canary.13675",
41
+ "@cedarjs/project-config": "4.0.0-canary.13675",
42
+ "@cedarjs/structure": "4.0.0-canary.13675",
43
+ "@cedarjs/telemetry": "4.0.0-canary.13675",
44
+ "@cedarjs/utils": "4.0.0-canary.13675",
45
+ "@cedarjs/web-server": "4.0.0-canary.13675",
46
46
  "@listr2/prompt-adapter-enquirer": "4.2.1",
47
47
  "@opentelemetry/api": "1.9.0",
48
48
  "@opentelemetry/core": "1.30.1",
@@ -102,8 +102,11 @@
102
102
  "typescript": "5.9.3",
103
103
  "vitest": "3.2.4"
104
104
  },
105
+ "engines": {
106
+ "node": ">=24"
107
+ },
105
108
  "publishConfig": {
106
109
  "access": "public"
107
110
  },
108
- "gitHead": "dcde8831a217305e62b1cfa418fa7448a23c0a28"
111
+ "gitHead": "8262a8b2baf0be63592cde7f6198d234cfd5698b"
109
112
  }