@catladder/cli 0.0.0-next-4adecfc9 → 0.0.0-next-2eda2fde

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.
Files changed (26) hide show
  1. package/dist/bundles/catenv/index.js +56 -19
  2. package/dist/bundles/cli/index.js +56 -19
  3. package/dist/bundles/skills/catladder-builds/SKILL.md +2 -0
  4. package/dist/bundles/skills/catladder-config/SKILL.md +2 -0
  5. package/dist/bundles/skills/catladder-migrate-ci-backend/SKILL.md +1 -0
  6. package/dist/bundles/skills/catladder-migrate-package-manager/SKILL.md +242 -0
  7. package/dist/bundles/skills/catladder-migrate-package-manager/references/yarn-to-pnpm-differences.md +103 -0
  8. package/dist/bundles/skills/catladder-migrate-release-method/SKILL.md +1 -0
  9. package/dist/packages/pipeline/src/build/index.js +8 -12
  10. package/dist/packages/pipeline/src/build/index.js.map +1 -1
  11. package/dist/packages/pipeline/src/build/node/testJob.js +7 -2
  12. package/dist/packages/pipeline/src/build/node/testJob.js.map +1 -1
  13. package/dist/packages/pipeline/src/build/runScript.d.ts +6 -0
  14. package/dist/packages/pipeline/src/build/runScript.js +10 -0
  15. package/dist/packages/pipeline/src/build/runScript.js.map +1 -0
  16. package/dist/packages/pipeline/src/pipeline/detectPackageManager.d.ts +11 -0
  17. package/dist/packages/pipeline/src/pipeline/detectPackageManager.js +24 -5
  18. package/dist/packages/pipeline/src/pipeline/detectPackageManager.js.map +1 -1
  19. package/dist/skills/catladder-builds/SKILL.md +2 -0
  20. package/dist/skills/catladder-config/SKILL.md +2 -0
  21. package/dist/skills/catladder-migrate-ci-backend/SKILL.md +1 -0
  22. package/dist/skills/catladder-migrate-package-manager/SKILL.md +242 -0
  23. package/dist/skills/catladder-migrate-package-manager/references/yarn-to-pnpm-differences.md +103 -0
  24. package/dist/skills/catladder-migrate-release-method/SKILL.md +1 -0
  25. package/dist/tsconfig.tsbuildinfo +1 -1
  26. package/package.json +1 -1
@@ -231,3 +231,4 @@ Same shape, mirrored, with one loss to flag up front:
231
231
  - `catladder-config` — catladder.ts structure and regeneration
232
232
  - `catladder-migrate-ci-backend` — migrating between GitLab CI and
233
233
  GitHub Actions
234
+ - `catladder-migrate-package-manager` — migrating between yarn and pnpm
@@ -18,19 +18,15 @@ exports.WORKSPACE_BUILD_TYPES = exports.BUILD_TYPES = void 0;
18
18
  const custom_1 = require("./custom");
19
19
  const node_1 = require("./node");
20
20
  const rails_1 = require("./rails");
21
+ const runScript_1 = require("./runScript");
21
22
  __exportStar(require("./node"), exports);
22
23
  __exportStar(require("./types"), exports);
23
- /**
24
- * run a package.json script with the project's package manager
25
- * (`yarn build` / `pnpm build`)
26
- */
27
- const runScript = (packageManager, script) => `${packageManager} ${script}`;
28
24
  exports.BUILD_TYPES = {
29
25
  node: {
30
26
  jobs: node_1.createNodeJobs,
31
27
  defaults: (_, pm) => ({
32
- buildCommand: runScript(pm, "build"),
33
- startCommand: runScript(pm, "start"),
28
+ buildCommand: (0, runScript_1.runScript)(pm, "build"),
29
+ startCommand: (0, runScript_1.runScript)(pm, "start"),
34
30
  artifactsPaths: ["dist", ".next"],
35
31
  artifactsExcludePaths: [".next/cache/**/*"],
36
32
  }),
@@ -38,14 +34,14 @@ exports.BUILD_TYPES = {
38
34
  "node-static": {
39
35
  jobs: node_1.createNodeJobs,
40
36
  defaults: (_, pm) => ({
41
- buildCommand: runScript(pm, "build"),
37
+ buildCommand: (0, runScript_1.runScript)(pm, "build"),
42
38
  artifactsPaths: ["dist"],
43
39
  }),
44
40
  },
45
41
  storybook: {
46
42
  jobs: node_1.createStorybookJobs,
47
43
  defaults: (_, pm) => ({
48
- buildCommand: [runScript(pm, "build-storybook --quiet -o ./dist")],
44
+ buildCommand: [(0, runScript_1.runScript)(pm, "build-storybook --quiet -o ./dist")],
49
45
  artifactsPaths: ["dist"],
50
46
  }),
51
47
  },
@@ -76,12 +72,12 @@ exports.WORKSPACE_BUILD_TYPES = {
76
72
  node: {
77
73
  jobs: node_1.createNodeJobs,
78
74
  defaults: (pm) => ({
79
- buildCommand: runScript(pm, "build"),
75
+ buildCommand: (0, runScript_1.runScript)(pm, "build"),
80
76
  lint: {
81
- command: runScript(pm, "lint"),
77
+ command: (0, runScript_1.runScript)(pm, "lint"),
82
78
  },
83
79
  test: {
84
- command: runScript(pm, "test"),
80
+ command: (0, runScript_1.runScript)(pm, "test"),
85
81
  },
86
82
  }),
87
83
  },
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../../packages/pipeline/src/build/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAQA,qCAA4C;AAC5C,iCAA+E;AAC/E,mCAA0C;AAO1C,yCAAuB;AACvB,0CAAwB;AAExB;;;GAGG;AACH,MAAM,SAAS,GAAG,CAAC,cAAkC,EAAE,MAAc,EAAE,EAAE,CACvE,GAAG,cAAc,IAAI,MAAM,EAAE,CAAC;AAcnB,QAAA,WAAW,GAAe;IACrC,IAAI,EAAE;QACJ,IAAI,EAAE,qBAAc;QACpB,QAAQ,EAAE,CAAC,CAAC,EAAE,EAAE,EAAE,EAAE,CAAC,CAAC;YACpB,YAAY,EAAE,SAAS,CAAC,EAAE,EAAE,OAAO,CAAC;YACpC,YAAY,EAAE,SAAS,CAAC,EAAE,EAAE,OAAO,CAAC;YACpC,cAAc,EAAE,CAAC,MAAM,EAAE,OAAO,CAAC;YACjC,qBAAqB,EAAE,CAAC,kBAAkB,CAAC;SAC5C,CAAC;KACH;IACD,aAAa,EAAE;QACb,IAAI,EAAE,qBAAc;QACpB,QAAQ,EAAE,CAAC,CAAC,EAAE,EAAE,EAAE,EAAE,CAAC,CAAC;YACpB,YAAY,EAAE,SAAS,CAAC,EAAE,EAAE,OAAO,CAAC;YACpC,cAAc,EAAE,CAAC,MAAM,CAAC;SACzB,CAAC;KACH;IACD,SAAS,EAAE;QACT,IAAI,EAAE,0BAAmB;QACzB,QAAQ,EAAE,CAAC,CAAC,EAAE,EAAE,EAAE,EAAE,CAAC,CAAC;YACpB,YAAY,EAAE,CAAC,SAAS,CAAC,EAAE,EAAE,mCAAmC,CAAC,CAAC;YAClE,cAAc,EAAE,CAAC,MAAM,CAAC;SACzB,CAAC;KACH;IACD,MAAM,EAAE;QACN,IAAI,EAAE,uBAAgB;QACtB,QAAQ,EAAE,GAAG,EAAE,CAAC,CAAC;YACf,YAAY,EAAE,cAAc;YAC5B,cAAc,EAAE,CAAC,MAAM,CAAC;SACzB,CAAC;KACH;IACD,MAAM,EAAE;QACN,IAAI,EAAE,yBAAgB;QACtB,QAAQ,EAAE,GAAG,EAAE,CAAC,CAAC;YACf,cAAc,EAAE,CAAC,MAAM,CAAC;SACzB,CAAC;KACH;IACD,KAAK,EAAE;QACL,IAAI,EAAE,uBAAe;QACrB,QAAQ,EAAE,GAAG,EAAE,CAAC,CAAC;YACf,UAAU,EAAE;gBACV,KAAK,EAAE,mBAAmB;gBAC1B,WAAW,EAAE,QAAQ;aACtB;SACF,CAAC;KACH;CACF,CAAC;AAaW,QAAA,qBAAqB,GAAwB;IACxD,IAAI,EAAE;QACJ,IAAI,EAAE,qBAAc;QACpB,QAAQ,EAAE,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC;YACjB,YAAY,EAAE,SAAS,CAAC,EAAE,EAAE,OAAO,CAAC;YACpC,IAAI,EAAE;gBACJ,OAAO,EAAE,SAAS,CAAC,EAAE,EAAE,MAAM,CAAC;aAC/B;YACD,IAAI,EAAE;gBACJ,OAAO,EAAE,SAAS,CAAC,EAAE,EAAE,MAAM,CAAC;aAC/B;SACF,CAAC;KACH;CACF,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../../packages/pipeline/src/build/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAQA,qCAA4C;AAC5C,iCAA+E;AAC/E,mCAA0C;AAC1C,2CAAwC;AAOxC,yCAAuB;AACvB,0CAAwB;AAcX,QAAA,WAAW,GAAe;IACrC,IAAI,EAAE;QACJ,IAAI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;SACF,CAAC;KACH;CACF,CAAC;AAaW,QAAA,qBAAqB,GAAwB;IACxD,IAAI,EAAE;QACJ,IAAI,EAAE,qBAAc;QACpB,QAAQ,EAAE,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC;YACjB,YAAY,EAAE,IAAA,qBAAS,EAAC,EAAE,EAAE,OAAO,CAAC;YACpC,IAAI,EAAE;gBACJ,OAAO,EAAE,IAAA,qBAAS,EAAC,EAAE,EAAE,MAAM,CAAC;aAC/B;YACD,IAAI,EAAE;gBACJ,OAAO,EAAE,IAAA,qBAAS,EAAC,EAAE,EAAE,MAAM,CAAC;aAC/B;SACF,CAAC;KACH;CACF,CAAC"}
@@ -6,6 +6,7 @@ const context_1 = require("../../types/context");
6
6
  const jobs_1 = require("../../types/jobs");
7
7
  const utils_1 = require("../../utils");
8
8
  const createArtifactsConfig_1 = require("../base/createArtifactsConfig");
9
+ const runScript_1 = require("../runScript");
9
10
  const cache_1 = require("./cache");
10
11
  const constants_1 = require("./constants");
11
12
  const packageManagerInstall_1 = require("./packageManagerInstall");
@@ -77,7 +78,9 @@ const createNodeTestJobs = async (context) => {
77
78
  ...(0, packageManagerInstall_1.ensureNodeVersion)(context),
78
79
  `cd ${context.build.dir}`,
79
80
  ...packageManagerInstall,
80
- ...((_r = (0, utils_1.ensureArrayOrNull)((_q = buildConfig.lint) === null || _q === void 0 ? void 0 : _q.command)) !== null && _r !== void 0 ? _r : ["yarn lint"]),
81
+ ...((_r = (0, utils_1.ensureArrayOrNull)((_q = buildConfig.lint) === null || _q === void 0 ? void 0 : _q.command)) !== null && _r !== void 0 ? _r : [
82
+ (0, runScript_1.runScript)(packageManagerInfo.type, "lint"),
83
+ ]),
81
84
  ],
82
85
  allow_failure: (_s = buildConfig.lint) === null || _s === void 0 ? void 0 : _s.allowFailure,
83
86
  ...(0, createArtifactsConfig_1.createArtifactsConfig)(context.build.dir, (_t = buildConfig.lint) === null || _t === void 0 ? void 0 : _t.artifactsReports, (_u = buildConfig.lint) === null || _u === void 0 ? void 0 : _u.artifacts),
@@ -99,7 +102,9 @@ const createNodeTestJobs = async (context) => {
99
102
  ...(0, packageManagerInstall_1.ensureNodeVersion)(context),
100
103
  `cd ${context.build.dir}`,
101
104
  ...packageManagerInstall,
102
- ...((_0 = (0, utils_1.ensureArrayOrNull)((_z = buildConfig.test) === null || _z === void 0 ? void 0 : _z.command)) !== null && _0 !== void 0 ? _0 : ["yarn test"]),
105
+ ...((_0 = (0, utils_1.ensureArrayOrNull)((_z = buildConfig.test) === null || _z === void 0 ? void 0 : _z.command)) !== null && _0 !== void 0 ? _0 : [
106
+ (0, runScript_1.runScript)(packageManagerInfo.type, "test"),
107
+ ]),
103
108
  ],
104
109
  allow_failure: (_1 = buildConfig.test) === null || _1 === void 0 ? void 0 : _1.allowFailure,
105
110
  ...(0, createArtifactsConfig_1.createArtifactsConfig)(context.build.dir, (_2 = buildConfig.test) === null || _2 === void 0 ? void 0 : _2.artifactsReports, (_3 = buildConfig.test) === null || _3 === void 0 ? void 0 : _3.artifacts),
@@ -1 +1 @@
1
- {"version":3,"file":"testJob.js","sourceRoot":"","sources":["../../../../../../../../packages/pipeline/src/build/node/testJob.ts"],"names":[],"mappings":";;;AAAA,yCAA8C;AAE9C,iDAG6B;AAE7B,2CAAgD;AAChD,uCAAwD;AACxD,yEAAsE;AACtE,mCAAuC;AACvC,2CAA0D;AAC1D,mEAIiC;AAE1B,MAAM,kBAAkB,GAAG,KAAK,EACrC,OAA4C,EACnB,EAAE;;IAC3B,gCAAgC;IAChC,6CAA6C;IAC7C,IAAI,OAAO,CAAC,OAAO,KAAK,eAAe,EAAE,CAAC;QACxC,OAAO,EAAE,CAAC;IACZ,CAAC;IACD,4DAA4D;IAC5D,IACE,OAAO,CAAC,IAAI,KAAK,WAAW;QAC5B,CAAC,IAAA,2CAAiC,EAAC,OAAO,CAAC,EAC3C,CAAC;QACD,OAAO,EAAE,CAAC;IACZ,CAAC;IAED,MAAM,YAAY,GAAG,IAAA,uBAAc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,KAAK,KAAK;QACxB,CAAC,CAAC,IAAI,mBAAY,CAAC;YACf,IAAI,EAAE,SAAS;YAEf,GAAG,IAAI;YACP,eAAe,EAAE;gBACf,GAAG,uCAA2B;gBAC9B,GAAG,CAAC,MAAA,MAAA,WAAW,CAAC,IAAI,0CAAE,eAAe,mCAAI,EAAE,CAAC;aAC7C;YACD,+DAA+D;YAC/D,6DAA6D;YAC7D,KAAK,EAAE,MAAA,MAAA,WAAW,CAAC,IAAI,0CAAE,QAAQ,mCAAI,IAAA,uBAAc,EAAC,cAAc,CAAC;YACnE,MAAM,EAAE,SAAS;YACjB,MAAM,EAAE;gBACN,GAAG,IAAA,yCAAiB,EAAC,OAAO,CAAC;gBAC7B,MAAM,OAAO,CAAC,KAAK,CAAC,GAAG,EAAE;gBACzB,GAAG,qBAAqB;gBACxB,GAAG,CAAC,MAAA,IAAA,yBAAiB,EAAC,MAAA,WAAW,CAAC,IAAI,0CAAE,OAAO,CAAC,mCAAI,CAAC,WAAW,CAAC,CAAC;aACnE;YACD,aAAa,EAAE,MAAA,WAAW,CAAC,IAAI,0CAAE,YAAY;YAC7C,GAAG,IAAA,6CAAqB,EACtB,OAAO,CAAC,KAAK,CAAC,GAAG,EACjB,MAAA,WAAW,CAAC,IAAI,0CAAE,gBAAgB,EAClC,MAAA,WAAW,CAAC,IAAI,0CAAE,SAAS,CAC5B;SACF,CAAC;QACJ,CAAC,CAAC,IAAI,CAAC;IACX,OAAO,CAAC,QAAQ,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC,MAAM,CAAC,cAAM,CAAC,CAAC;AACrD,CAAC,CAAC;AAvHW,QAAA,kBAAkB,sBAuH7B"}
1
+ {"version":3,"file":"testJob.js","sourceRoot":"","sources":["../../../../../../../../packages/pipeline/src/build/node/testJob.ts"],"names":[],"mappings":";;;AAAA,yCAA8C;AAE9C,iDAG6B;AAE7B,2CAAgD;AAChD,uCAAwD;AACxD,yEAAsE;AACtE,4CAAyC;AACzC,mCAAuC;AACvC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C,KAAK,CAAC,GAAG,EACjB,MAAA,WAAW,CAAC,IAAI,0CAAE,gBAAgB,EAClC,MAAA,WAAW,CAAC,IAAI,0CAAE,SAAS,CAC5B;SACF,CAAC;QACJ,CAAC,CAAC,IAAI,CAAC;IACX,OAAO,CAAC,QAAQ,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC,MAAM,CAAC,cAAM,CAAC,CAAC;AACrD,CAAC,CAAC;AA3HW,QAAA,kBAAkB,sBA2H7B"}
@@ -0,0 +1,6 @@
1
+ import type { PackageManagerType } from "../types/context";
2
+ /**
3
+ * run a package.json script with the project's package manager
4
+ * (`yarn build` / `pnpm build`)
5
+ */
6
+ export declare const runScript: (packageManager: PackageManagerType, script: string) => string;
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.runScript = void 0;
4
+ /**
5
+ * run a package.json script with the project's package manager
6
+ * (`yarn build` / `pnpm build`)
7
+ */
8
+ const runScript = (packageManager, script) => `${packageManager} ${script}`;
9
+ exports.runScript = runScript;
10
+ //# sourceMappingURL=runScript.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"runScript.js","sourceRoot":"","sources":["../../../../../../../packages/pipeline/src/build/runScript.ts"],"names":[],"mappings":";;;AAEA;;;GAGG;AACI,MAAM,SAAS,GAAG,CAAC,cAAkC,EAAE,MAAc,EAAE,EAAE,CAC9E,GAAG,cAAc,IAAI,MAAM,EAAE,CAAC;AADnB,QAAA,SAAS,aACU"}
@@ -4,6 +4,17 @@ export type DetectedPackageManager = {
4
4
  type: PackageManagerType;
5
5
  version: string;
6
6
  };
7
+ /**
8
+ * parse a `packageManager` field value (`pnpm@11.6.0`).
9
+ *
10
+ * `corepack use` appends an integrity hash (`pnpm@11.6.0+sha512.abc…`).
11
+ * That suffix is semver build metadata, and generated pipelines
12
+ * interpolate the version into `npm install -g <pm>@<version>` (docker
13
+ * builds, job images without the package manager) where it is not a
14
+ * valid spec — so it is dropped here, at the single place the field is
15
+ * read.
16
+ */
17
+ export declare const parsePackageManagerField: (value: unknown) => DetectedPackageManager | null;
7
18
  /**
8
19
  * detect which package manager the project uses (and its version).
9
20
  *
@@ -3,19 +3,38 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.detectPackageManager = void 0;
6
+ exports.detectPackageManager = exports.parsePackageManagerField = void 0;
7
7
  const child_process_promise_1 = require("child-process-promise");
8
8
  const fs_1 = require("fs");
9
9
  const promises_1 = require("fs/promises");
10
10
  const path_1 = require("path");
11
11
  const memoizee_1 = __importDefault(require("memoizee"));
12
+ /**
13
+ * parse a `packageManager` field value (`pnpm@11.6.0`).
14
+ *
15
+ * `corepack use` appends an integrity hash (`pnpm@11.6.0+sha512.abc…`).
16
+ * That suffix is semver build metadata, and generated pipelines
17
+ * interpolate the version into `npm install -g <pm>@<version>` (docker
18
+ * builds, job images without the package manager) where it is not a
19
+ * valid spec — so it is dropped here, at the single place the field is
20
+ * read.
21
+ */
22
+ const parsePackageManagerField = (value) => {
23
+ if (typeof value !== "string")
24
+ return null;
25
+ const match = /^(yarn|pnpm)@(.+)$/.exec(value);
26
+ if (!match)
27
+ return null;
28
+ const version = match[2].split("+")[0];
29
+ if (!version)
30
+ return null;
31
+ return { type: match[1], version };
32
+ };
33
+ exports.parsePackageManagerField = parsePackageManagerField;
12
34
  const readPackageManagerField = async (dir) => {
13
35
  try {
14
36
  const pkg = JSON.parse(await (0, promises_1.readFile)((0, path_1.join)(dir, "package.json"), "utf-8"));
15
- const match = /^(yarn|pnpm)@(.+)$/.exec(pkg.packageManager);
16
- if (!match)
17
- return null;
18
- return { type: match[1], version: match[2] };
37
+ return (0, exports.parsePackageManagerField)(pkg.packageManager);
19
38
  }
20
39
  catch (_a) {
21
40
  return null;
@@ -1 +1 @@
1
- {"version":3,"file":"detectPackageManager.js","sourceRoot":"","sources":["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AE,OAAO,EAAE,IAAI,EAAE,CAClB,CAAC"}
1
+ {"version":3,"file":"detectPackageManager.js","sourceRoot":"","sources":["../../../../../../../packages/pipeline/src/pipeline/detectPackageManager.ts"],"names":[],"mappings":";;;;;;AAAA,iEAA6C;AAC7C,2BAAgC;AAChC,0CAAuC;AACvC,+BAA4B;AAC5B,wDAAgC;AAQhC;;;;;;;;;GASG;AACI,MAAM,wBAAwB,GAAG,CACtC,KAAc,EACiB,EAAE;IACjC,IAAI,OAAO,KAAK,KAAK,QAAQ;QAAE,OAAO,IAAI,CAAC;IAC3C,MAAM,KAAK,GAAG,oBAAoB,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IAC/C,IAAI,CAAC,KAAK;QAAE,OAAO,IAAI,CAAC;IACxB,MAAM,OAAO,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;IACvC,IAAI,CAAC,OAAO;QAAE,OAAO,IAAI,CAAC;IAC1B,OAAO,EAAE,IAAI,EAAE,KAAK,CAAC,CAAC,CAAuB,EAAE,OAAO,EAAE,CAAC;AAC3D,CAAC,CAAC;AATW,QAAA,wBAAwB,4BASnC;AAEF,MAAM,uBAAuB,GAAG,KAAK,EACnC,GAAW,EAC6B,EAAE;IAC1C,IAAI,CAAC;QACH,MAAM,GAAG,GAAG,IAAI,CAAC,KAAK,CAAC,MAAM,IAAA,mBAAQ,EAAC,IAAA,WAAI,EAAC,GAAG,EAAE,cAAc,CAAC,EAAE,OAAO,CAAC,CAAC,CAAC;QAC3E,OAAO,IAAA,gCAAwB,EAAC,GAAG,CAAC,cAAc,CAAC,CAAC;IACtD,CAAC;IAAC,WAAM,CAAC;QACP,OAAO,IAAI,CAAC;IACd,CAAC;AACH,CAAC,CAAC;AAEF,MAAM,gBAAgB,GAAG,CAAC,GAAW,EAA6B,EAAE;IAClE,IAAI,IAAA,eAAU,EAAC,IAAA,WAAI,EAAC,GAAG,EAAE,gBA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AA,YAAY,aAAZ,YAAY,cAAZ,YAAY,GACZ,SAAS,aAAT,SAAS,uBAAT,SAAS,CAAE,IAAI,mCACf,KAAK,CAAC,GAAG,CAAC,gBAAgB,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,mCACzC,MAAM,CAAC;IAET,MAAM,OAAO,GACX,CAAA,SAAS,aAAT,SAAS,uBAAT,SAAS,CAAE,IAAI,MAAK,YAAY;QAC9B,CAAC,CAAC,SAAS,CAAC,OAAO;QACnB,CAAC,CAAC,MAAM,mBAAmB,CAAC,YAAY,CAAC,CAAC;IAE9C,OAAO,EAAE,IAAI,EAAE,YAAY,EAAE,OAAO,EAAE,CAAC;AACzC,CAAC,EACD,EAAE,OAAO,EAAE,IAAI,EAAE,CAClB,CAAC"}
@@ -150,3 +150,5 @@ build type's options, the `docker` sub-config, and the exact defaults.
150
150
  - `catladder-deploys` — the matching `deploy` config
151
151
  - `catladder-pipelines` — how build jobs, caching and job images work
152
152
  - `catladder-secrets` — env vars available at build time
153
+ - `catladder-migrate-package-manager` — migrating a project from yarn
154
+ to pnpm (or back)
@@ -121,3 +121,5 @@ escape hatches to shrink over time, not accumulate.
121
121
  and GitHub Actions
122
122
  - `catladder-migrate-release-method` — switching between
123
123
  semantic-release and changesets
124
+ - `catladder-migrate-package-manager` — switching a project between
125
+ yarn and pnpm
@@ -283,3 +283,4 @@ now-wrong `gitRemote`, regenerate once more, and finish with
283
283
  - `catladder-releases` — release jobs and how they differ per backend
284
284
  - `catladder-pipelines` — triggers, generated file layout, debugging CI
285
285
  - `catladder-cli` — `project doctor`, `project setup`, non-interactive usage
286
+ - `catladder-migrate-package-manager` — migrating between yarn and pnpm
@@ -0,0 +1,242 @@
1
+ ---
2
+ name: catladder-migrate-package-manager
3
+ description: Migrating a catladder project's node package manager — yarn → pnpm (via `pnpm import`, keeping the resolved versions) or pnpm → yarn — including the workspace file, the yarn-isms in scripts and catladder.ts, phantom dependencies, and what changes in the generated pipeline. Use when a project should switch package managers, when `pnpm import` is mentioned, or when a pnpm migration breaks builds or docker images. Triggers on "migrate to pnpm", "switch to pnpm", "yarn to pnpm", "use pnpm instead of yarn", "pnpm import", "back to yarn", "change package manager", "pnpm-workspace.yaml", "phantom dependency", "frozen-lockfile fails".
4
+ ---
5
+
6
+ # Migrating the package manager (yarn ↔ pnpm)
7
+
8
+ catladder supports **yarn** (classic and berry) and **pnpm** for the
9
+ node build family, and autodetects which one a project uses. So the
10
+ catladder side of this migration is nearly free — the work is in the
11
+ repository: lockfile, workspace file, scripts, and the dependencies
12
+ that only ever resolved because yarn hoisted them.
13
+
14
+ Typical motivation: pnpm is substantially faster in CI (a real project
15
+ saw lint 584s → 187s, app build 470s → 228s, docker builds 2–3× faster
16
+ on warm caches).
17
+
18
+ **Do this on a branch and expect several iterations.** The first
19
+ pipeline will not be green. Plan for it instead of promising a one-shot
20
+ migration.
21
+
22
+ ## What catladder detects, and what it generates
23
+
24
+ Detection order (`packageManager` in `catladder.ts` → `packageManager`
25
+ field in package.json → lockfile → yarn fallback):
26
+
27
+ ```ts
28
+ // catladder.ts — only needed to override the detection
29
+ packageManager: "pnpm",
30
+ ```
31
+
32
+ Prefer the `packageManager` field in the root `package.json`
33
+ (`"packageManager": "pnpm@11.6.0"`) — it drives local dev, corepack and
34
+ catladder at once, and catladder installs *that* version in the docker
35
+ build. Corepack's `+sha512…` integrity suffix is fine; catladder strips
36
+ it before using the version as an npm spec.
37
+
38
+ Once detected, catladder switches all of this automatically — no config
39
+ change needed:
40
+
41
+ | | yarn | pnpm |
42
+ |---|---|---|
43
+ | CI install | `yarn install --immutable` | `pnpm install --frozen-lockfile --store-dir …` |
44
+ | download cache | `.yarn` zip cache | project-local `.pnpm-store`, cache slot scoped by pnpm major |
45
+ | node_modules cache | mutable slot per build dir | **lockfile-keyed** slot (a pnpm install over a foreign tree leaves orphaned `.pnpm` dirs) |
46
+ | docker prod install | `yarn workspaces focus --production` | `pnpm install --prod --frozen-lockfile --filter <pkg>...` |
47
+ | audit job | `yarn npm audit …` | `pnpm audit --prod --audit-level critical` |
48
+ | build/start defaults | `yarn build` / `yarn start` | `pnpm build` / `pnpm start` |
49
+
50
+ Because the cache keys differ per package manager, the first pnpm
51
+ pipeline runs **cold** (and rebuilds job images). Judge speed on the
52
+ second run, not the first.
53
+
54
+ ## Step 0 — check the blockers
55
+
56
+ - **`build: { type: "meteor" }`** — yarn-only in catladder; generation
57
+ fails outright. That component blocks the migration.
58
+ - **Yarn PnP** (`nodeLinker: pnp`, `.pnp.cjs`) — the migration is bigger
59
+ than a lockfile swap: everything that relied on PnP resolution changes.
60
+ Say so before starting.
61
+ - **Yarn plugins** (`.yarn/plugins`, `yarn workspaces focus`,
62
+ `yarn-plugin-*`) — no pnpm equivalent; each needs a decision.
63
+ - **catladder version** — pnpm support landed in catladder 5. On an
64
+ older version, upgrade first.
65
+ - **`docker: { yarnRebuildEnabled }`** in a build config — yarn-only;
66
+ it is silently ignored under pnpm. Remove it as cleanup.
67
+
68
+ ## Step 1 — inventory the yarn-isms
69
+
70
+ Grep the repo, not just `catladder.ts`. Every one of these needs a
71
+ decision *before* the lockfile changes:
72
+
73
+ ```bash
74
+ grep -rn "yarn " --include=package.json --include="*.ts" --include="*.md" --include="*.yml" --include="*.yaml" --include=Dockerfile* .
75
+ ```
76
+
77
+ Look at: package.json `scripts`, `catladder.ts`
78
+ (`buildCommand`, `startCommand`, `postInstall`, `lint`/`test`/`audit`
79
+ `command`, deploy `command`/`script`, `customJobs`), Dockerfiles,
80
+ husky hooks, `lint-staged`, `.github/`-adjacent tooling, and the README.
81
+
82
+ The mapping table is in
83
+ [references/yarn-to-pnpm-differences.md](references/yarn-to-pnpm-differences.md)
84
+ — read it before rewriting scripts; several of the entries there
85
+ (root-script fallback, shell globs, the `pnpm run` banner) have caused
86
+ silent, hard-to-debug breakage in production images.
87
+
88
+ ## Step 2 — write `pnpm-workspace.yaml` first
89
+
90
+ `pnpm import` **requires the workspace file to exist already**, or it
91
+ generates a lockfile for the root package only.
92
+
93
+ Translate, in one file:
94
+
95
+ ```yaml
96
+ packages: # from package.json "workspaces"
97
+ - "packages/*"
98
+ - "apps/*"
99
+
100
+ overrides: # from package.json "resolutions"
101
+ some-pkg: 1.2.3
102
+
103
+ patchedDependencies: # from yarn's .yarn/patches + resolutions patch: entries
104
+ some-pkg@1.2.3: patches/some-pkg.patch
105
+
106
+ allowBuilds: # deps whose install scripts may run (see step 4)
107
+ esbuild: true
108
+ prisma: true
109
+
110
+ minimumReleaseAge: 0 # pnpm 11 defaults to 1440 (min); 0 keeps yarn's behavior
111
+ ```
112
+
113
+ On **pnpm 11+ nearly all settings live in `pnpm-workspace.yaml` only** —
114
+ `pnpm.overrides` in package.json and non-auth settings in `.npmrc` are
115
+ ignored (pnpm 10 read them; this reversal silently drops overrides).
116
+ `.npmrc` keeps auth and registry settings.
117
+
118
+ The yarn patches themselves (`.yarn/patches/*.patch`) can be reused as
119
+ files; move them somewhere neutral (`patches/`) and reference them from
120
+ `patchedDependencies`.
121
+
122
+ ## Step 3 — import the lockfile
123
+
124
+ ```bash
125
+ pnpm import # yarn.lock -> pnpm-lock.yaml, keeping resolved versions
126
+ rm -rf yarn.lock node_modules **/node_modules .yarn/cache .yarn/install-state.gz
127
+ pnpm install
128
+ ```
129
+
130
+ `pnpm import` is what keeps this migration honest: it preserves the
131
+ versions yarn had resolved instead of re-resolving every range. Do not
132
+ skip it and run a bare `pnpm install` — that silently upgrades hundreds
133
+ of transitive dependencies at the same time as the package manager
134
+ changes, and you will not know which change broke what.
135
+
136
+ Then set the `packageManager` field, and update `.gitignore`:
137
+ `.pnpm-store/` in, `.yarn/*` entries out (keep `.yarn/patches` only if
138
+ you left the patches there).
139
+
140
+ ## Step 4 — fix the fallout locally
141
+
142
+ Work through these *before* touching CI; every one of them fails the
143
+ same way in the pipeline, only slower.
144
+
145
+ 1. **Phantom dependencies** — pnpm does not hoist. Every package your
146
+ code imports must be in *its own* `package.json`. This is the single
147
+ biggest source of failures, and the nastiest ones surface only in the
148
+ docker image (a bundler happily resolved the hoisted copy at build
149
+ time; the prod install does not ship it). Fix by declaring, never by
150
+ `shamefully-hoist`.
151
+ 2. **Install scripts are not run** unless approved. `pnpm install`
152
+ prints the list it skipped → add them to `allowBuilds`
153
+ (pnpm 11; `onlyBuiltDependencies` list on pnpm 10). Missing prisma,
154
+ esbuild, sharp, playwright, husky, … show up as "works locally,
155
+ fails in the image".
156
+ 3. **Root `prepare` runs in the production install** (docker), where
157
+ devDependencies are absent: `"prepare": "husky || true"`.
158
+ 4. **Quote your globs.** yarn berry's built-in shell expands `**`;
159
+ pnpm's `sh` does not. `node build.mjs ./entrypoints/**/*.ts` silently
160
+ builds fewer files → a container that boots without its entrypoint.
161
+ Quote the pattern and let the tool expand it.
162
+ 5. **`pnpm run` prints a banner to stdout** — any script whose output is
163
+ piped needs `pnpm --silent run …`.
164
+ 6. **No root-script fallback**: yarn berry falls back to the root
165
+ package's scripts, pnpm does not. Inline shared scripts into each
166
+ workspace (the root `node_modules/.bin` *is* on the script PATH).
167
+
168
+ Then, still locally: full build, typecheck, lint and test — and
169
+ `docker build` at least one generated Dockerfile and boot the image.
170
+ That catches phantom dependencies far faster than a pipeline round-trip.
171
+
172
+ ## Step 5 — regenerate the pipeline
173
+
174
+ Nothing in `catladder.ts` needs to change beyond the yarn-isms from
175
+ step 1 (and, optionally, an explicit `packageManager: "pnpm"`).
176
+
177
+ ```bash
178
+ pnpm catenv
179
+ ```
180
+
181
+ Commit the regenerated `.catladder-generated/`, `.gitlab-ci.yml` and
182
+ `.github/workflows/catladder-*` with the rest — see `catladder-config`.
183
+
184
+ Review the diff: install commands, cache keys/paths, the default
185
+ build/lint/test commands and the docker install lines should have
186
+ flipped to pnpm everywhere. Anything still saying `yarn` is a command
187
+ you spelled out yourself in `catladder.ts` (step 1), not a default.
188
+
189
+ ## Step 6 — verify in CI
190
+
191
+ - The first pipeline is cold and rebuilds job images — slow by design.
192
+ - Expect the failures to arrive **in waves**: install → build → docker →
193
+ deploy. A green build job says nothing about the images.
194
+ - If a docker job fails on `--frozen-lockfile`, the cause is almost
195
+ always a file missing from the build context (a workspace manifest, a
196
+ patch file) or a lockfile that was not regenerated after a
197
+ package.json edit.
198
+ - Deploy at least one component to a review/dev environment and check it
199
+ actually boots — bundlers hide missing dependencies until runtime.
200
+ - Compare timings against the **second** run.
201
+
202
+ ## Step 7 — hand over to the team
203
+
204
+ Tell the user what changes for everyone:
205
+
206
+ - `yarn <x>` → `pnpm <x>`; `yarn workspace a b` → `pnpm --filter a b`;
207
+ `yarn dlx` → `pnpm dlx`. The CLIs become `pnpm catenv` / `pnpm catladder`.
208
+ - new dependencies must be declared where they are imported — the
209
+ hoisting safety net is gone
210
+ - a dependency with an install script needs an `allowBuilds` entry
211
+ - update the README / contributing docs and any developer onboarding
212
+ script in the same MR
213
+
214
+ ## The other direction: pnpm → yarn
215
+
216
+ Mirrored, with one loss to state up front: **there is no importer back**.
217
+ `yarn import` only reads npm lockfiles, so yarn berry has to re-resolve
218
+ every range — the migration necessarily bumps transitive versions.
219
+ Do it deliberately:
220
+
221
+ 1. Delete `pnpm-lock.yaml`, `pnpm-workspace.yaml`, `.pnpm-store`, and the
222
+ `node_modules` trees.
223
+ 2. Move `packages:` back into package.json `workspaces`, `overrides` →
224
+ `resolutions`, `patchedDependencies` → yarn's patch protocol,
225
+ `allowBuilds` → (yarn runs build scripts by default; nothing needed).
226
+ 3. `yarn install`, then re-run the whole local verification of step 4 —
227
+ the version drift is the risk here, not the tooling.
228
+ 4. Set `packageManager: "yarn@x.y.z"`, drop `packageManager: "pnpm"`
229
+ from `catladder.ts` if it was set, run `yarn catenv`, commit the
230
+ regenerated files.
231
+
232
+ ## Related skills
233
+
234
+ - `catladder-builds` — the `build` config, pnpm gotchas per build type,
235
+ workspace builds
236
+ - `catladder-config` — catladder.ts structure, `packageManager`,
237
+ regeneration
238
+ - `catladder-pipelines` — caching, job images, debugging CI
239
+ - `catladder-migrate-ci-backend` — moving between GitLab CI and GitHub
240
+ Actions
241
+ - `catladder-migrate-release-method` — switching between
242
+ semantic-release and changesets
@@ -0,0 +1,103 @@
1
+ # yarn → pnpm: what actually differs
2
+
3
+ Companion to the `catladder-migrate-package-manager` skill. Everything
4
+ here has bitten a real catladder project during a migration.
5
+
6
+ ## Command mapping
7
+
8
+ | yarn | pnpm |
9
+ |---|---|
10
+ | `yarn` / `yarn install` | `pnpm install` |
11
+ | `yarn install --immutable` (`--frozen-lockfile` classic) | `pnpm install --frozen-lockfile` |
12
+ | `yarn add x` / `yarn add -D x` | `pnpm add x` / `pnpm add -D x` |
13
+ | `yarn remove x` | `pnpm remove x` |
14
+ | `yarn up x` (berry) | `pnpm update x` |
15
+ | `yarn <script>` | `pnpm <script>` (or `pnpm run <script>`) |
16
+ | `yarn workspace pkg <script>` | `pnpm --filter pkg <script>` |
17
+ | `yarn workspaces foreach …` | `pnpm -r <script>` |
18
+ | `yarn workspaces focus --production` | `pnpm install --prod --filter pkg...` |
19
+ | `yarn run -T x` / `yarn -T x` (berry top-level) | `x` (root `node_modules/.bin` is on the script PATH) |
20
+ | `yarn dlx x` | `pnpm dlx x` |
21
+ | `yarn node x` / `yarn exec x` | `pnpm exec x` |
22
+ | `yarn npm audit --environment production` | `pnpm audit --prod` |
23
+ | `yarn bin x` | `pnpm bin x` |
24
+
25
+ ## Configuration mapping
26
+
27
+ | yarn | pnpm |
28
+ |---|---|
29
+ | package.json `workspaces` | `packages:` in `pnpm-workspace.yaml` |
30
+ | package.json `resolutions` | `overrides:` in `pnpm-workspace.yaml` |
31
+ | `.yarn/patches/*` + `patch:` resolutions | `patchedDependencies:` in `pnpm-workspace.yaml` |
32
+ | `.yarnrc.yml` settings | `pnpm-workspace.yaml` (auth/registry stay in `.npmrc`) |
33
+ | `.yarnrc.yml` `npmScopes` / auth | `.npmrc` |
34
+ | `catalog:` / `catalogs:` in `.yarnrc.yml` | `catalog:` / `catalogs:` in `pnpm-workspace.yaml` |
35
+ | (yarn runs install scripts by default) | `allowBuilds:` map — pnpm 11; `onlyBuiltDependencies:` list on pnpm 10 |
36
+ | `.yarn/cache` (zip cache) | the content-addressable store (catladder points it at a project-local `.pnpm-store`) |
37
+
38
+ **pnpm 11 reads settings from `pnpm-workspace.yaml` only.** A
39
+ `pnpm` section in package.json (`pnpm.overrides`,
40
+ `pnpm.patchedDependencies`) works on pnpm 10 and is *silently ignored*
41
+ on 11 — the opposite of what most migration guides written for pnpm 10
42
+ say. `.npmrc` keeps auth/registry settings and nothing else.
43
+
44
+ ## Behavioral differences that break things
45
+
46
+ **No hoisting → phantom dependencies.** yarn flattens
47
+ `node_modules`, so a package you never declared is importable anyway.
48
+ pnpm's symlinked layout does not. Every undeclared import fails —
49
+ sometimes only inside the production docker image, where the bundler is
50
+ no longer there to paper over it. The fix is always to declare the
51
+ dependency; `shamefully-hoist` only postpones the failure.
52
+
53
+ **Install scripts are opt-in.** `pnpm install` skips dependency build
54
+ scripts and prints the list. Anything with a native build or a
55
+ generator step (prisma, esbuild, sharp, playwright, husky, …) needs an
56
+ `allowBuilds` entry, or it is missing at runtime.
57
+
58
+ **The root `prepare` script runs during `--prod` installs.** In the
59
+ docker image, devDependencies are gone: `"prepare": "husky"` fails the
60
+ build. Use `"prepare": "husky || true"`.
61
+
62
+ **`pnpm run` writes a banner to stdout.** yarn does not. Any script
63
+ whose output is piped or captured (`pnpm build:x > out.json`, generated
64
+ supergraph schemas, …) must use `pnpm --silent run …`.
65
+
66
+ **Scripts run in `sh`, not yarn's built-in shell.** yarn berry ships a
67
+ POSIX-ish shell that expands `**` recursively; `sh` does not. An
68
+ unquoted `./src/**/*.ts` silently matches *fewer* files. Quote the
69
+ pattern and let the receiving tool expand it. This is the failure mode
70
+ that ships a container missing half its entrypoints and still boots the
71
+ build job green.
72
+
73
+ **No root-script fallback.** yarn berry falls back to the root
74
+ package's scripts when a workspace has none; pnpm errors. Inline shared
75
+ scripts into each workspace, or add a thin per-workspace wrapper.
76
+
77
+ **`--frozen-lockfile` verifies every importer.** pnpm checks that every
78
+ workspace listed in the lockfile exists on disk, and that every
79
+ `patchedDependencies` patch file is present with the right hash — which
80
+ is why catladder copies all workspace manifests and all patch files into
81
+ the docker build context.
82
+
83
+ **Version drift in `--prod` installs.** `pnpm install --prod` on a
84
+ node_modules tree from a *different* lockfile does not prune orphaned
85
+ `.pnpm` directories. That is why catladder keys the pnpm node_modules
86
+ cache by the lockfile instead of reusing a mutable slot — and why you
87
+ should never reuse a yarn branch's cache for a pnpm branch.
88
+
89
+ **`minimumReleaseAge`** defaults to 1440 minutes on pnpm 11: freshly
90
+ published versions are refused. Set it to `0` while migrating (it is a
91
+ supply-chain feature worth enabling deliberately later, not something to
92
+ discover mid-migration).
93
+
94
+ ## catladder-specific notes
95
+
96
+ - The `packageManager` field feeds the pnpm version installed in the
97
+ docker build; corepack's `+sha512…` integrity suffix is stripped.
98
+ - `build: { type: "meteor" }` is yarn-only in catladder and fails
99
+ generation under pnpm.
100
+ - `docker: { yarnRebuildEnabled }` applies to yarn berry only.
101
+ - The job image ships pnpm; custom `jobImage`s and custom
102
+ `dockerfileContent` images get a `npm install -g pnpm@<version>`
103
+ fallback injected, so they work too — but they pay for it on every job.
@@ -231,3 +231,4 @@ Same shape, mirrored, with one loss to flag up front:
231
231
  - `catladder-config` — catladder.ts structure and regeneration
232
232
  - `catladder-migrate-ci-backend` — migrating between GitLab CI and
233
233
  GitHub Actions
234
+ - `catladder-migrate-package-manager` — migrating between yarn and pnpm