@cedarjs/cli 5.0.0-canary.2526 → 5.0.0-canary.2528

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/cfw.js CHANGED
@@ -2,8 +2,8 @@
2
2
  import fs from "node:fs";
3
3
  import path from "node:path";
4
4
  import Configstore from "configstore";
5
- import execa from "execa";
6
5
  import { terminalLink } from "termi-link";
6
+ import { runScriptSync } from "@cedarjs/cli-helpers/packageManager/exec";
7
7
  import { getConfigPath } from "@cedarjs/project-config";
8
8
  const config = new Configstore("@cedarjs/cli");
9
9
  const CFW_PATH = process.env.CFW_PATH || config.get("CFW_PATH");
@@ -30,8 +30,10 @@ const helpCommands = ["help", "--help"];
30
30
  if (!command.length || command.some((cmd) => helpCommands.includes(cmd))) {
31
31
  command = ["run"];
32
32
  }
33
+ const script = command[0];
34
+ const args = command.slice(1);
33
35
  try {
34
- execa.sync("yarn", [...command], {
36
+ runScriptSync(script, args, {
35
37
  stdio: "inherit",
36
38
  cwd: absCfwPath,
37
39
  // @ts-expect-error - testUtils.d.ts augments ProcessEnv with
@@ -1,4 +1,5 @@
1
1
  import execa from "execa";
2
+ import { formatRunBinCommand } from "@cedarjs/cli-helpers/packageManager/display";
2
3
  import { getPaths } from "../lib/index.js";
3
4
  const handler = async ({
4
5
  _,
@@ -13,11 +14,11 @@ const handler = async ({
13
14
  args.push(name.length > 1 ? `--${name}` : `-${name}`);
14
15
  args.push(String(value));
15
16
  }
16
- let command = `yarn cedar-jobs ${args.join(" ")}`;
17
+ let command = formatRunBinCommand("cedar-jobs", args);
17
18
  const originalLogLevel = process.env.LOG_LEVEL;
18
19
  process.env.LOG_LEVEL = originalLogLevel || "warn";
19
20
  if (process.env.NODE_ENV !== "production") {
20
- command += " | yarn cedar-log-formatter";
21
+ command += ` | ${formatRunBinCommand("cedar-log-formatter")}`;
21
22
  process.env.LOG_LEVEL = originalLogLevel || "debug";
22
23
  }
23
24
  execa.commandSync(command, {
@@ -1,8 +1,11 @@
1
1
  import fs from "node:fs";
2
- import path from "node:path";
3
2
  import boxen from "boxen";
4
3
  import execa from "execa";
5
4
  import { recordTelemetryAttributes, colors as c } from "@cedarjs/cli-helpers";
5
+ import {
6
+ formatCedarCommand,
7
+ formatRunBinCommand
8
+ } from "@cedarjs/cli-helpers/packageManager/display";
6
9
  import { errorTelemetry } from "@cedarjs/telemetry";
7
10
  import { getPaths } from "../lib/index.js";
8
11
  const getErrorMessage = (error) => {
@@ -57,14 +60,12 @@ const handler = async ({
57
60
  }
58
61
  console.log();
59
62
  console.log(c.note("Running Prisma CLI..."));
60
- console.log(c.underline(`$ yarn prisma ${args.join(" ")}`));
63
+ console.log(c.underline(`$ npx prisma ${args.join(" ")}`));
61
64
  console.log();
62
65
  try {
63
- const prismaBin = path.join(cedarPaths.base, "node_modules/.bin/prisma");
64
- execa.sync(prismaBin, args, {
66
+ execa.sync("npx", ["prisma", ...args], {
65
67
  cwd: cedarPaths.base,
66
- stdio: "inherit",
67
- cleanup: true
68
+ stdio: "inherit"
68
69
  });
69
70
  if (hasHelpOption || args.length === 0) {
70
71
  printWrapInfo();
@@ -81,8 +82,8 @@ const printWrapInfo = () => {
81
82
  const message = [
82
83
  c.bold("Cedar CLI wraps Prisma CLI"),
83
84
  "",
84
- "Use `yarn cedar prisma` to automatically pass `--config` and `--preview-feature` options.",
85
- "Use `yarn prisma` to skip Cedar's automatic CLI options.",
85
+ `Use \`${formatCedarCommand(["prisma"])}\` to automatically pass \`--config\` and \`--preview-feature\` options.`,
86
+ `Use \`${formatRunBinCommand("prisma")}\` to skip Cedar's automatic CLI options.`,
86
87
  "",
87
88
  "Find more information in our docs:",
88
89
  c.underline("https://cedarjs.com/docs/cli-commands#prisma")
@@ -1,5 +1,7 @@
1
- import path from "path";
1
+ import fs from "node:fs";
2
+ import path from "node:path";
2
3
  import { Listr } from "listr2";
4
+ import prompts from "prompts";
3
5
  import { recordTelemetryAttributes, colors as c } from "@cedarjs/cli-helpers";
4
6
  import { errorTelemetry } from "@cedarjs/telemetry";
5
7
  import {
@@ -35,6 +37,24 @@ const handler = async ({ force }) => {
35
37
  command: "setup deploy baremetal",
36
38
  force
37
39
  });
40
+ if (fs.existsSync(path.join(getPaths().base, ".pnp.cjs"))) {
41
+ console.warn(
42
+ c.warning(
43
+ "Your project uses Yarn PnP (Plug'n'Play), which is not officially supported for Baremetal deployments. The generated ecosystem.config.js file uses node_modules/.bin/cedar as the PM2 script path, which will most likely not work under PnP.\n\nYou will need to manually configure the server. See also the packageManagerCommand field in deploy.toml."
44
+ )
45
+ );
46
+ console.log();
47
+ const { confirmed } = await prompts({
48
+ type: "confirm",
49
+ name: "confirmed",
50
+ message: "Generate the default config anyway? (You can edit it later)"
51
+ });
52
+ if (!confirmed) {
53
+ console.log("Aborting baremetal setup.");
54
+ return;
55
+ }
56
+ console.log();
57
+ }
38
58
  const tasks = new Listr(
39
59
  [
40
60
  await addPackagesTask({
@@ -4,7 +4,7 @@ const ECOSYSTEM = `module.exports = {
4
4
  {
5
5
  name: 'serve',
6
6
  cwd: 'current',
7
- script: 'node_modules/.bin/rw',
7
+ script: 'node_modules/.bin/cedar',
8
8
  args: 'serve',
9
9
  instances: 'max',
10
10
  exec_mode: 'cluster',
@@ -194,8 +194,7 @@ const handler = async (upgradeOptions) => {
194
194
  };
195
195
  async function packageManagerInstall({ verbose }) {
196
196
  try {
197
- await execa(`${getPackageManager()} ${install()}`, {
198
- shell: true,
197
+ await execa(getPackageManager(), [install()], {
199
198
  stdio: verbose ? "inherit" : "pipe",
200
199
  cwd: getPaths().base
201
200
  });
@@ -456,8 +455,7 @@ async function dedupeDeps(_task, { verbose }) {
456
455
  return;
457
456
  }
458
457
  try {
459
- await execa(`${getPackageManager()} ${dedupeCmd}`, {
460
- shell: true,
458
+ await execa(getPackageManager(), [dedupeCmd], {
461
459
  stdio: verbose ? "inherit" : "pipe",
462
460
  cwd: getPaths().base
463
461
  });
@@ -51,7 +51,7 @@ class CustomFileExporter {
51
51
  resultCallback({ code: 0 });
52
52
  }
53
53
  /** Stops the exporter. */
54
- shutdown() {
54
+ async shutdown() {
55
55
  if (!this.#isShutdown) {
56
56
  fs.truncateSync(
57
57
  this.#storageFilePath,
@@ -7,6 +7,7 @@ import {
7
7
  SamplingDecision
8
8
  } from "@opentelemetry/sdk-trace-node";
9
9
  import { hideBin } from "yargs/helpers";
10
+ import { getNodeRunnerArgs } from "@cedarjs/cli-helpers/packageManager/exec";
10
11
  import { spawnBackgroundProcess } from "../lib/background.js";
11
12
  import { CustomFileExporter } from "./exporter.js";
12
13
  let traceProvider;
@@ -69,10 +70,10 @@ function shutdownTelemetry() {
69
70
  opentelemetry.trace.getActiveSpan()?.end();
70
71
  }
71
72
  traceExporter?.shutdown();
72
- spawnBackgroundProcess("telemetry", "yarn", [
73
- "node",
73
+ const [cmd, args] = getNodeRunnerArgs(
74
74
  path.join(import.meta.dirname, "send.js")
75
- ]);
75
+ );
76
+ spawnBackgroundProcess("telemetry", cmd, args);
76
77
  } catch (error) {
77
78
  console.error("Telemetry error");
78
79
  console.error(error);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cedarjs/cli",
3
- "version": "5.0.0-canary.2526",
3
+ "version": "5.0.0-canary.2528",
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.7",
35
35
  "@babel/preset-typescript": "7.29.7",
36
- "@cedarjs/api-server": "5.0.0-canary.2526",
37
- "@cedarjs/cli-helpers": "5.0.0-canary.2526",
38
- "@cedarjs/fastify-web": "5.0.0-canary.2526",
39
- "@cedarjs/internal": "5.0.0-canary.2526",
40
- "@cedarjs/prerender": "5.0.0-canary.2526",
41
- "@cedarjs/project-config": "5.0.0-canary.2526",
42
- "@cedarjs/structure": "5.0.0-canary.2526",
43
- "@cedarjs/telemetry": "5.0.0-canary.2526",
44
- "@cedarjs/utils": "5.0.0-canary.2526",
45
- "@cedarjs/vite": "5.0.0-canary.2526",
46
- "@cedarjs/web-server": "5.0.0-canary.2526",
36
+ "@cedarjs/api-server": "5.0.0-canary.2528",
37
+ "@cedarjs/cli-helpers": "5.0.0-canary.2528",
38
+ "@cedarjs/fastify-web": "5.0.0-canary.2528",
39
+ "@cedarjs/internal": "5.0.0-canary.2528",
40
+ "@cedarjs/prerender": "5.0.0-canary.2528",
41
+ "@cedarjs/project-config": "5.0.0-canary.2528",
42
+ "@cedarjs/structure": "5.0.0-canary.2528",
43
+ "@cedarjs/telemetry": "5.0.0-canary.2528",
44
+ "@cedarjs/utils": "5.0.0-canary.2528",
45
+ "@cedarjs/vite": "5.0.0-canary.2528",
46
+ "@cedarjs/web-server": "5.0.0-canary.2528",
47
47
  "@listr2/prompt-adapter-enquirer": "4.2.1",
48
48
  "@opentelemetry/api": "1.9.1",
49
49
  "@opentelemetry/core": "1.30.1",