@cedarjs/cli 6.0.0-canary.2968 → 6.0.0-canary.2973

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.
@@ -4,6 +4,7 @@ import os from "node:os";
4
4
  import path from "node:path";
5
5
  import execa from "execa";
6
6
  import semver from "semver";
7
+ const MAIN_BRANCH_PRERELEASE_TAGS = ["canary"];
7
8
  function isExecaError(e) {
8
9
  return e instanceof Error && ("stdout" in e || "stderr" in e || "exitCode" in e);
9
10
  }
@@ -33,8 +34,15 @@ async function runPreUpgradeScripts(ctx, task, { verbose, force }) {
33
34
  if (!Array.isArray(manifest) || manifest.length === 0) {
34
35
  return;
35
36
  }
37
+ const prereleaseTag = parsed?.prerelease[0];
38
+ const isMainBranchPrerelease = typeof prereleaseTag === "string" && MAIN_BRANCH_PRERELEASE_TAGS.includes(prereleaseTag);
36
39
  const checkLevels = [];
37
- if (parsed && !parsed.prerelease.length) {
40
+ if (parsed && isMainBranchPrerelease) {
41
+ checkLevels.push({
42
+ id: "tag",
43
+ candidates: [`${prereleaseTag}.ts`, `${prereleaseTag}/index.ts`]
44
+ });
45
+ } else if (parsed) {
38
46
  checkLevels.push({
39
47
  id: "exact",
40
48
  candidates: [`${version}.ts`, `${version}/index.ts`]
@@ -50,14 +58,6 @@ async function runPreUpgradeScripts(ctx, task, { verbose, force }) {
50
58
  id: "minor",
51
59
  candidates: [`${parsed.major}.x.ts`, `${parsed.major}.x/index.ts`]
52
60
  });
53
- } else if (parsed && parsed.prerelease.length > 0) {
54
- checkLevels.push({
55
- id: "tag",
56
- candidates: [
57
- `${parsed.prerelease[0]}.ts`,
58
- `${parsed.prerelease[0]}/index.ts`
59
- ]
60
- });
61
61
  }
62
62
  const scriptsToRun = [];
63
63
  for (const level of checkLevels) {
@@ -3,6 +3,23 @@ import fs from "node:fs";
3
3
  import os from "os";
4
4
  import path from "path";
5
5
  import { getPaths } from "@cedarjs/project-config";
6
+ function quoteForWindowsShell(arg) {
7
+ let quoted = '"';
8
+ let backslashes = 0;
9
+ for (const char of arg) {
10
+ if (char === "\\") {
11
+ backslashes += 1;
12
+ continue;
13
+ }
14
+ if (char === '"') {
15
+ quoted += "\\".repeat(backslashes * 2 + 1) + '"';
16
+ } else {
17
+ quoted += "\\".repeat(backslashes) + char;
18
+ }
19
+ backslashes = 0;
20
+ }
21
+ return quoted + "\\".repeat(backslashes * 2) + '"';
22
+ }
6
23
  function spawnBackgroundProcess(name, cmd, args) {
7
24
  const logDirectory = path.join(getPaths().generated.base, "logs");
8
25
  fs.mkdirSync(logDirectory, { recursive: true });
@@ -37,7 +54,8 @@ function spawnBackgroundProcess(name, cmd, args) {
37
54
  shell: true,
38
55
  stdio: ["ignore", stdout, stderr]
39
56
  };
40
- const child = spawn(cmd + " " + args.join(" "), spawnOptions);
57
+ const command = [cmd, ...args].map(quoteForWindowsShell).join(" ");
58
+ const child = spawn(command, spawnOptions);
41
59
  child.unref();
42
60
  } else {
43
61
  const spawnOptions = {
@@ -51,5 +69,6 @@ function spawnBackgroundProcess(name, cmd, args) {
51
69
  fs.closeSync(stderr);
52
70
  }
53
71
  export {
72
+ quoteForWindowsShell,
54
73
  spawnBackgroundProcess
55
74
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cedarjs/cli",
3
- "version": "6.0.0-canary.2968",
3
+ "version": "6.0.0-canary.2973",
4
4
  "description": "The CedarJS Command Line",
5
5
  "repository": {
6
6
  "type": "git",
@@ -36,17 +36,17 @@
36
36
  "@babel/preset-typescript": "7.29.7",
37
37
  "@babel/traverse": "7.29.8",
38
38
  "@babel/types": "7.29.8",
39
- "@cedarjs/api-server": "6.0.0-canary.2968",
40
- "@cedarjs/babel-config": "6.0.0-canary.2968",
41
- "@cedarjs/cli-helpers": "6.0.0-canary.2968",
42
- "@cedarjs/internal": "6.0.0-canary.2968",
43
- "@cedarjs/prerender": "6.0.0-canary.2968",
44
- "@cedarjs/project-config": "6.0.0-canary.2968",
45
- "@cedarjs/structure": "6.0.0-canary.2968",
46
- "@cedarjs/telemetry": "6.0.0-canary.2968",
47
- "@cedarjs/utils": "6.0.0-canary.2968",
48
- "@cedarjs/vite": "6.0.0-canary.2968",
49
- "@cedarjs/web-server": "6.0.0-canary.2968",
39
+ "@cedarjs/api-server": "6.0.0-canary.2973",
40
+ "@cedarjs/babel-config": "6.0.0-canary.2973",
41
+ "@cedarjs/cli-helpers": "6.0.0-canary.2973",
42
+ "@cedarjs/internal": "6.0.0-canary.2973",
43
+ "@cedarjs/prerender": "6.0.0-canary.2973",
44
+ "@cedarjs/project-config": "6.0.0-canary.2973",
45
+ "@cedarjs/structure": "6.0.0-canary.2973",
46
+ "@cedarjs/telemetry": "6.0.0-canary.2973",
47
+ "@cedarjs/utils": "6.0.0-canary.2973",
48
+ "@cedarjs/vite": "6.0.0-canary.2973",
49
+ "@cedarjs/web-server": "6.0.0-canary.2973",
50
50
  "@listr2/prompt-adapter-enquirer": "4.3.0",
51
51
  "@opentelemetry/api": "1.9.1",
52
52
  "@opentelemetry/core": "1.30.1",
@@ -94,7 +94,7 @@
94
94
  "yargs": "17.7.3"
95
95
  },
96
96
  "devDependencies": {
97
- "@cedarjs/framework-tools": "6.0.0-canary.2968",
97
+ "@cedarjs/framework-tools": "6.0.0-canary.2973",
98
98
  "@prisma/dmmf": "7.8.0",
99
99
  "@types/archiver": "^7.0.0",
100
100
  "memfs": "4.68.1",