@catladder/cli 0.0.0-next-1d12aca2 → 0.0.0-next-cf4e99eb
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/bundles/catenv/index.js +61 -80
- package/dist/bundles/cli/index.js +61 -80
- package/dist/bundles/skills/catladder-migrate-package-manager/SKILL.md +8 -8
- package/dist/bundles/skills/catladder-migrate-package-manager/references/yarn-to-pnpm-differences.md +20 -3
- package/dist/bundles/skills/catladder-pipelines/SKILL.md +7 -6
- package/dist/packages/pipeline/src/build/node/buildJob.js +11 -14
- package/dist/packages/pipeline/src/build/node/buildJob.js.map +1 -1
- package/dist/packages/pipeline/src/build/node/cache.d.ts +8 -3
- package/dist/packages/pipeline/src/build/node/cache.js +34 -47
- package/dist/packages/pipeline/src/build/node/cache.js.map +1 -1
- package/dist/packages/pipeline/src/build/node/packageManagerInstall.js +15 -18
- package/dist/packages/pipeline/src/build/node/packageManagerInstall.js.map +1 -1
- package/dist/skills/catladder-migrate-package-manager/SKILL.md +8 -8
- package/dist/skills/catladder-migrate-package-manager/references/yarn-to-pnpm-differences.md +20 -3
- package/dist/skills/catladder-pipelines/SKILL.md +7 -6
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"buildJob.js","sourceRoot":"","sources":["../../../../../../../../packages/pipeline/src/build/node/buildJob.ts"],"names":[],"mappings":";;;AAKA,iDAG6B;AAM7B,kCAA6E;AAC7E,+EAA4E;AAC5E,sCAAsE;AAEtE,mCAAqD;AACrD,mEAGiC;AAE1B,MAAM,mBAAmB,GAAG,KAAK,EACtC,OAAqD,EAC5B,EAAE;IAC3B,IAAI,OAAO,CAAC,IAAI,KAAK,WAAW,EAAE,CAAC;QACjC,OAAO,IAAA,+BAAwB,EAAC,OAAO,EAAE;YACvC,QAAQ,EAAE,MAAM,IAAA,oCAA4B,EAAC,OAAO,CAAC;SACtD,CAAC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DAA0D;oBAC1D,yDAAyD;oBACzD,qCAAqC;iBACtC,CAAC,IAAI,CAAC,IAAI,CAAC;gBACd,CAAC,CAAC,kBAAkB,CAAC,mBAAmB;qBACnC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,0BAA0B,GAAG,SAAS,GAAG,EAAE,CAAC;qBACzD,IAAI,CAAC,IAAI,CAAC;YACjB,iEAAiE;YACjE,kDAAkD;YAClD,GAAG,CAAC,MAAM;gBACR,CAAC,CAAC;oBACE,4BAA4B,EAAE,2BAA2B,kBAAkB,CAAC,OAAO,EAAE;iBACtF;gBACH,CAAC,CAAC,EAAE,CAAC;SACR;KACF,CAAC;AACJ,CAAC,CAAC;AAtEW,QAAA,6BAA6B,iCAsExC"}
|
|
@@ -1,9 +1,14 @@
|
|
|
1
1
|
import type { Context } from "../../types/context";
|
|
2
2
|
import type { CacheConfig } from "../types";
|
|
3
3
|
/**
|
|
4
|
-
* the package manager's download cache: yarn's `.yarn` zip cache
|
|
5
|
-
*
|
|
6
|
-
*
|
|
4
|
+
* the package manager's download cache: yarn's `.yarn` zip cache.
|
|
5
|
+
*
|
|
6
|
+
* pnpm gets nothing. Its store is a content-addressable tree of
|
|
7
|
+
* hundreds of thousands of small files, and moving it costs more than
|
|
8
|
+
* the install it saves: measured on a 3800-package monorepo, restoring
|
|
9
|
+
* the 1 GB store took ~53s on gitlab (which zips file by file) and
|
|
10
|
+
* ~23s on github, against a from-registry install of ~30-40s. See
|
|
11
|
+
* getNodeModulesCache for the node_modules half of the same finding.
|
|
7
12
|
*/
|
|
8
13
|
export declare const getYarnCache: (context: Context, policy?: string) => Promise<CacheConfig[]>;
|
|
9
14
|
export declare const getNodeModulesCache: (context: Context, policy?: string) => Promise<CacheConfig[]>;
|
|
@@ -8,10 +8,9 @@ const lodash_es_1 = require("lodash-es");
|
|
|
8
8
|
const path_1 = require("path");
|
|
9
9
|
const slugify_1 = __importDefault(require("slugify"));
|
|
10
10
|
/**
|
|
11
|
-
* stable reference between the two
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
* ~0.6GB download on warm runs)
|
|
11
|
+
* stable reference between the two yarn caches: the zip cache declares
|
|
12
|
+
* itself redundant when the node_modules cache scored an exact-lockfile
|
|
13
|
+
* hit (github skips the ~0.6GB download on warm runs)
|
|
15
14
|
*/
|
|
16
15
|
const NODE_MODULES_CACHE_ID = "node-modules";
|
|
17
16
|
/**
|
|
@@ -39,36 +38,36 @@ const getCacheBaseDir = async (context) => {
|
|
|
39
38
|
: ".";
|
|
40
39
|
};
|
|
41
40
|
/**
|
|
42
|
-
* the package manager's download cache: yarn's `.yarn` zip cache
|
|
43
|
-
*
|
|
44
|
-
*
|
|
41
|
+
* the package manager's download cache: yarn's `.yarn` zip cache.
|
|
42
|
+
*
|
|
43
|
+
* pnpm gets nothing. Its store is a content-addressable tree of
|
|
44
|
+
* hundreds of thousands of small files, and moving it costs more than
|
|
45
|
+
* the install it saves: measured on a 3800-package monorepo, restoring
|
|
46
|
+
* the 1 GB store took ~53s on gitlab (which zips file by file) and
|
|
47
|
+
* ~23s on github, against a from-registry install of ~30-40s. See
|
|
48
|
+
* getNodeModulesCache for the node_modules half of the same finding.
|
|
45
49
|
*/
|
|
46
50
|
const getYarnCache = async (context, policy = "pull-push") => {
|
|
47
51
|
const packageManagerInfo = await context.packageManagerInfo;
|
|
48
|
-
|
|
52
|
+
if (packageManagerInfo.type === "pnpm")
|
|
53
|
+
return [];
|
|
49
54
|
const baseDir = await getCacheBaseDir(context);
|
|
50
|
-
// pnpm keeps its store in a format-versioned subdir (v10, v11, ...)
|
|
51
|
-
// and never cleans old ones up — scope the cache slot by major so a
|
|
52
|
-
// pnpm upgrade starts a fresh slot instead of dragging the dead old
|
|
53
|
-
// store tree along in every cache transfer (formats change only on
|
|
54
|
-
// majors)
|
|
55
|
-
const pnpmStoreKey = `pnpm-v${packageManagerInfo.version.split(".")[0]}`;
|
|
56
55
|
return [
|
|
57
56
|
{
|
|
58
57
|
scope: "buildDir",
|
|
59
58
|
pathMode: "relative",
|
|
60
59
|
buildDir: baseDir,
|
|
61
|
-
key:
|
|
60
|
+
key: "yarn",
|
|
62
61
|
policy,
|
|
63
|
-
paths: [
|
|
62
|
+
paths: [".yarn"],
|
|
64
63
|
// content-key for immutable-cache backends (github); the lockfile
|
|
65
64
|
// decides whether the cached content could have changed
|
|
66
|
-
keyFiles: [
|
|
67
|
-
// the
|
|
68
|
-
//
|
|
69
|
-
//
|
|
70
|
-
//
|
|
71
|
-
//
|
|
65
|
+
keyFiles: ["yarn.lock"],
|
|
66
|
+
// the yarn zip cache (~hundreds of MB) is only read when packages
|
|
67
|
+
// have to be (re)installed. When the node_modules cache hit for
|
|
68
|
+
// the same lockfile, install verifies its state file and never
|
|
69
|
+
// touches the zips — so github skips downloading this cache
|
|
70
|
+
// entirely
|
|
72
71
|
redundantOnExactHitOf: NODE_MODULES_CACHE_ID,
|
|
73
72
|
},
|
|
74
73
|
];
|
|
@@ -77,12 +76,18 @@ exports.getYarnCache = getYarnCache;
|
|
|
77
76
|
const getNodeModulesCache = async (context, policy = "pull-push") => {
|
|
78
77
|
const packageManagerInfo = await context.packageManagerInfo;
|
|
79
78
|
const baseDir = await getCacheBaseDir(context);
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
//
|
|
84
|
-
//
|
|
85
|
-
|
|
79
|
+
// pnpm gets no node_modules cache either: archiving the tree (root
|
|
80
|
+
// plus every workspace's symlink farm, >1GB in real monorepos) costs
|
|
81
|
+
// ~190s per saving job to spare ~6s of install, and a safe pnpm slot
|
|
82
|
+
// must be keyed by lockfile hash (a pnpm install over a node_modules
|
|
83
|
+
// from a different lockfile leaves orphaned .pnpm dirs that break
|
|
84
|
+
// type identity), so it misses on every dependency change anyway.
|
|
85
|
+
// pnpm projects run entirely uncached — see getYarnCache
|
|
86
|
+
if (packageManagerInfo.type === "pnpm")
|
|
87
|
+
return [];
|
|
88
|
+
const lockFileName = "yarn.lock";
|
|
89
|
+
// yarn berry tracks install state in .yarn/install-state.gz
|
|
90
|
+
const hasInstallState = !packageManagerInfo.isClassic;
|
|
86
91
|
// We intentionally do not use the contents of the lockfile as a cache key, as install should always guarantee that the files are updated, but it can still use part of the cache if not all packages are up-to-date.
|
|
87
92
|
// It would slow down all pipelines whenever one adds a new dependency as it will need to download all node_modules again.
|
|
88
93
|
return [
|
|
@@ -90,19 +95,7 @@ const getNodeModulesCache = async (context, policy = "pull-push") => {
|
|
|
90
95
|
scope: "global",
|
|
91
96
|
pathMode: "absolute",
|
|
92
97
|
// we use the dirname, not the component name, because in certain cases we have two apps in the same directory and want to share the cache, e.g. when having storybook in the same package.json
|
|
93
|
-
|
|
94
|
-
// pnpm gets its own, lockfile-keyed cache: node_modules layouts
|
|
95
|
-
// are not compatible between package managers (a migrating
|
|
96
|
-
// project must not inherit the yarn slot), and unlike yarn, a
|
|
97
|
-
// pnpm install on top of a node_modules from a different lockfile
|
|
98
|
-
// leaves orphaned .pnpm dirs behind that break type identity —
|
|
99
|
-
// so the slot changes whenever the lockfile changes
|
|
100
|
-
key: isPnpm
|
|
101
|
-
? {
|
|
102
|
-
prefix: "pnpm-" + (0, slugify_1.default)(baseDir) + "-node-modules",
|
|
103
|
-
files: [(0, path_1.join)(baseDir, "pnpm-lock.yaml")],
|
|
104
|
-
}
|
|
105
|
-
: (0, slugify_1.default)(baseDir) + "-node-modules",
|
|
98
|
+
key: (0, slugify_1.default)(baseDir) + "-node-modules",
|
|
106
99
|
// content-key for immutable-cache backends (github); the lockfile
|
|
107
100
|
// decides whether the cached content could have changed (absolute
|
|
108
101
|
// pathMode: resolve the lockfile explicitly)
|
|
@@ -113,12 +106,6 @@ const getNodeModulesCache = async (context, policy = "pull-push") => {
|
|
|
113
106
|
policy,
|
|
114
107
|
paths: (0, lodash_es_1.uniq)([
|
|
115
108
|
(0, path_1.join)(baseDir, "node_modules"),
|
|
116
|
-
// pnpm's per-package node_modules are symlink farms worth
|
|
117
|
-
// keeping warm (yarn hoists into the root, so root-only
|
|
118
|
-
// matches its historical behavior)
|
|
119
|
-
...(isPnpm
|
|
120
|
-
? workspaces.map((w) => (0, path_1.join)(w.location, "node_modules"))
|
|
121
|
-
: []),
|
|
122
109
|
...(hasInstallState ? [(0, path_1.join)(baseDir, ".yarn/install-state.gz")] : []),
|
|
123
110
|
]),
|
|
124
111
|
},
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cache.js","sourceRoot":"","sources":["../../../../../../../../packages/pipeline/src/build/node/cache.ts"],"names":[],"mappings":";;;;;;AAAA,yCAAiC;AACjC,+BAA4B;AAC5B,sDAA8B;AAK9B
|
|
1
|
+
{"version":3,"file":"cache.js","sourceRoot":"","sources":["../../../../../../../../packages/pipeline/src/build/node/cache.ts"],"names":[],"mappings":";;;;;;AAAA,yCAAiC;AACjC,+BAA4B;AAC5B,sDAA8B;AAK9B;;;;GAIG;AACH,MAAM,qBAAqB,GAAG,cAAc,CAAC;AAE7C;;;;;;;;GAQG;AACH,MAAM,eAAe,GAAG,KAAK,EAAE,OAAgB,EAAmB,EAAE;;IAClE,MAAM,kBAAkB,GAAG,MAAM,OAAO,CAAC,kBAAkB,CAAC;IAC5D,MAAM,sBAAsB,GAC1B,OAAO,CAAC,IAAI,KAAK,WAAW;QAC5B,wBAAwB,IAAI,kBAAkB;QAC9C,kBAAkB,CAAC,sBAAsB,CAAC;IAC5C,IAAI,CAAC,sBAAsB;QAAE,OAAO,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC;IACtD,+DAA+D;IAC/D,gEAAgE;IAChE,+BAA+B;IAC/B,OAAO,OAAO,CAAC,KAAK,CAAC,IAAI,KAAK,eAAe;QAC3C,CAAC,CAAC,CAAC,MAAA,OAAO,CAAC,KAAK,CAAC,oBAAoB,CAAC,GAAG,mCAAI,GAAG,CAAC;QACjD,CAAC,CAAC,GAAG,CAAC;AACV,CAAC,CAAC;AAEF;;;;;;;;;GASG;AACI,MAAM,YAAY,GAAG,KAAK,EAC/B,OA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E,IAAA,iBAAO,EAAC,OAAO,CAAC,GAAG,eAAe;YACvC,kEAAkE;YAClE,kEAAkE;YAClE,6CAA6C;YAC7C,QAAQ,EAAE,CAAC,IAAA,WAAI,EAAC,OAAO,EAAE,YAAY,CAAC,CAAC;YACvC,mEAAmE;YACnE,6DAA6D;YAC7D,OAAO,EAAE,qBAAqB;YAC9B,MAAM;YACN,KAAK,EAAE,IAAA,gBAAI,EAAC;gBACV,IAAA,WAAI,EAAC,OAAO,EAAE,cAAc,CAAC;gBAC7B,GAAG,CAAC,eAAe,CAAC,CAAC,CAAC,CAAC,IAAA,WAAI,EAAC,OAAO,EAAE,wBAAwB,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;aACtE,CAAC;SACH;KACF,CAAC;AACJ,CAAC,CAAC;AA3CW,QAAA,mBAAmB,uBA2C9B;AACK,MAAM,YAAY,GAAG,KAAK,EAC/B,OAAgB,EAChB,MAAM,GAAG,WAAW,EACI,EAAE;IAC1B,OAAO;QACL,GAAG,CAAC,MAAM,IAAA,oBAAY,EAAC,OAAO,EAAE,MAAM,CAAC,CAAC;QACxC,GAAG,CAAC,MAAM,IAAA,2BAAmB,EAAC,OAAO,EAAE,MAAM,CAAC,CAAC;KAChD,CAAC;AACJ,CAAC,CAAC;AARW,QAAA,YAAY,gBAQvB"}
|
|
@@ -24,19 +24,15 @@ const isInWorkspace = (context, packageManagerInfo) => context.type === "workspa
|
|
|
24
24
|
*/
|
|
25
25
|
const getEnsurePnpmCommand = (version) => `if ! command -v pnpm &> /dev/null; then corepack enable pnpm 2>/dev/null || npm install -g pnpm@${version}; fi`;
|
|
26
26
|
/**
|
|
27
|
-
* pnpm's
|
|
28
|
-
*
|
|
29
|
-
*
|
|
30
|
-
* the
|
|
31
|
-
*
|
|
32
|
-
* v10 and v11
|
|
27
|
+
* pnpm jobs use pnpm's own (global, per-runner) store location. There
|
|
28
|
+
* used to be a `--store-dir` pointing at a project-local
|
|
29
|
+
* `.pnpm-store`, so CI could cache it — that cache is gone (see
|
|
30
|
+
* getYarnCache), and keeping the store inside the repo only meant it
|
|
31
|
+
* landed in docker build contexts.
|
|
33
32
|
*/
|
|
34
|
-
const
|
|
35
|
-
? `"$(git rev-parse --show-toplevel 2>/dev/null || pwd)/.pnpm-store"`
|
|
36
|
-
: `"$PWD/.pnpm-store"`;
|
|
37
|
-
const getPnpmInstallCommands = (context, packageManagerInfo) => [
|
|
33
|
+
const getPnpmInstallCommands = (packageManagerInfo) => [
|
|
38
34
|
getEnsurePnpmCommand(packageManagerInfo.version),
|
|
39
|
-
`pnpm install --frozen-lockfile
|
|
35
|
+
`pnpm install --frozen-lockfile`,
|
|
40
36
|
];
|
|
41
37
|
exports.DEFAULT_AUDIT_LEVEL = "critical";
|
|
42
38
|
/**
|
|
@@ -80,7 +76,7 @@ const getPackageManagerInstall = async (context, options) => {
|
|
|
80
76
|
? context.build.config.postInstall
|
|
81
77
|
: null;
|
|
82
78
|
const installSection = packageManagerInfo.type === "pnpm"
|
|
83
|
-
? (0, gitlab_1.collapseableSection)("pnpminstall", "pnpm install")(getPnpmInstallCommands(
|
|
79
|
+
? (0, gitlab_1.collapseableSection)("pnpminstall", "pnpm install")(getPnpmInstallCommands(packageManagerInfo))
|
|
84
80
|
: (0, gitlab_1.collapseableSection)("yarninstall", "Yarn install")([getYarnInstallCommand(packageManagerInfo)]);
|
|
85
81
|
return [
|
|
86
82
|
...(0, exports.ensureNodeVersion)(context),
|
|
@@ -93,11 +89,12 @@ const getPackageManagerInstall = async (context, options) => {
|
|
|
93
89
|
exports.getPackageManagerInstall = getPackageManagerInstall;
|
|
94
90
|
const DOCKER_COPY_FILES = `COPY --chown=node:node $APP_DIR .`;
|
|
95
91
|
const getPnpmDockerAppCopyAndBuildScript = (packageManagerInfo) => {
|
|
96
|
-
// the
|
|
97
|
-
// the
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
92
|
+
// the prod install downloads from the registry: nothing is copied
|
|
93
|
+
// into the image to link from (see createNodeDockerJobDefinition).
|
|
94
|
+
// The store it fills is scratch space outside /app, dropped in the
|
|
95
|
+
// same layer so the packages ship once — node_modules holds
|
|
96
|
+
// hardlinks, so removing the store keeps the files alive
|
|
97
|
+
const storeDir = "/tmp/pnpm-store";
|
|
101
98
|
// in a workspace, only install the component (and its workspace
|
|
102
99
|
// dependencies) — the pnpm equivalent of `yarn workspaces focus`.
|
|
103
100
|
// npm package names are shell-safe unquoted (the whole script is
|
|
@@ -109,7 +106,7 @@ const getPnpmDockerAppCopyAndBuildScript = (packageManagerInfo) => {
|
|
|
109
106
|
return new bash_1.BashExpression(`
|
|
110
107
|
${DOCKER_COPY_FILES}
|
|
111
108
|
RUN command -v pnpm >/dev/null 2>&1 || npm install -g pnpm@${packageManagerInfo.version}
|
|
112
|
-
RUN pnpm install --prod --frozen-lockfile --store-dir ${storeDir}${filter}
|
|
109
|
+
RUN pnpm install --prod --frozen-lockfile --store-dir ${storeDir}${filter} && rm -rf ${storeDir}
|
|
113
110
|
`.trim());
|
|
114
111
|
};
|
|
115
112
|
const getDockerAppCopyAndBuildScript = async (context) => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"packageManagerInstall.js","sourceRoot":"","sources":["../../../../../../../../packages/pipeline/src/build/node/packageManagerInstall.ts"],"names":[],"mappings":";;;AAAA,0CAAiD;AAQjD,uCAA0C;AAC1C,+CAAyD;AAEzD,MAAM,oBAAoB,GAAG,gCAAgC,CAAC;AAE9D,MAAM,uBAAuB,GAAG,oCAAoC,CAAC;AACrE,8CAA8C;AAC9C,MAAM,uBAAuB,GAAG,cAAc,CAAC;AAE/C,MAAM,qBAAqB,GAAG,CAC5B,kBAA6D,EAC7D,EAAE;IACF,IAAI,kBAAkB,CAAC,SAAS,EAAE,CAAC;QACjC,OAAO,oBAAoB,CAAC;IAC9B,CAAC;IACD,2GAA2G;IAC3G,OAAO,0CAA0C,CAAC;AACpD,CAAC,CAAC;AAEF,MAAM,aAAa,GAAG,CACpB,OAAgB,EAChB,kBAAwE,EACxE,EAAE,CACF,OAAO,CAAC,IAAI,KAAK,WAAW;IAC5B,CAAC,wBAAwB,IAAI,kBAAkB;QAC7C,kBAAkB,CAAC,sBAAsB,CAAC,CAAC;AAE/C;;;GAGG;AACH,MAAM,oBAAoB,GAAG,CAAC,OAAe,EAAE,EAAE,CAC/C,mGAAmG,OAAO,MAAM,CAAC;AAEnH
|
|
1
|
+
{"version":3,"file":"packageManagerInstall.js","sourceRoot":"","sources":["../../../../../../../../packages/pipeline/src/build/node/packageManagerInstall.ts"],"names":[],"mappings":";;;AAAA,0CAAiD;AAQjD,uCAA0C;AAC1C,+CAAyD;AAEzD,MAAM,oBAAoB,GAAG,gCAAgC,CAAC;AAE9D,MAAM,uBAAuB,GAAG,oCAAoC,CAAC;AACrE,8CAA8C;AAC9C,MAAM,uBAAuB,GAAG,cAAc,CAAC;AAE/C,MAAM,qBAAqB,GAAG,CAC5B,kBAA6D,EAC7D,EAAE;IACF,IAAI,kBAAkB,CAAC,SAAS,EAAE,CAAC;QACjC,OAAO,oBAAoB,CAAC;IAC9B,CAAC;IACD,2GAA2G;IAC3G,OAAO,0CAA0C,CAAC;AACpD,CAAC,CAAC;AAEF,MAAM,aAAa,GAAG,CACpB,OAAgB,EAChB,kBAAwE,EACxE,EAAE,CACF,OAAO,CAAC,IAAI,KAAK,WAAW;IAC5B,CAAC,wBAAwB,IAAI,kBAAkB;QAC7C,kBAAkB,CAAC,sBAAsB,CAAC,CAAC;AAE/C;;;GAGG;AACH,MAAM,oBAAoB,GAAG,CAAC,OAAe,EAAE,EAAE,CAC/C,mGAAmG,OAAO,MAAM,CAAC;AAEnH;;;;;;GAMG;AACH,MAAM,sBAAsB,GAAG,CAC7B,kBAA6D,EAC7D,EAAE,CAAC;IACH,oBAAoB,CAAC,kBAAkB,CAAC,OAAO,CAAC;IAChD,gCAAgC;CACjC,CAAC;AAEW,QAAA,mBAAmB,GAAe,UAAU,CAAC;AAE1D;;;;;GAKG;AACI,M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EACjB,6BAA6B;MACzB,uBAAuB;EAC3B,kBAAkB,CAAC,CAAC,CAAC,OAAO,uBAAuB,EAAE,CAAC,CAAC,CAAC,EAAE;;KAEvD,CAAC,IAAI,EAAE,CACT,CAAC;AACJ,CAAC,CAAC;AApDW,QAAA,8BAA8B,kCAoDzC"}
|
|
@@ -40,9 +40,9 @@ change needed:
|
|
|
40
40
|
|
|
41
41
|
| | yarn | pnpm |
|
|
42
42
|
|---|---|---|
|
|
43
|
-
| CI install | `yarn install --immutable` | `pnpm install --frozen-lockfile
|
|
44
|
-
| download cache | `.yarn` zip cache |
|
|
45
|
-
| node_modules cache | mutable slot per build dir | **
|
|
43
|
+
| CI install | `yarn install --immutable` | `pnpm install --frozen-lockfile` |
|
|
44
|
+
| download cache | `.yarn` zip cache | **none** — installing from the registry is cheaper than moving the store |
|
|
45
|
+
| node_modules cache | mutable slot per build dir | **none** (measured: the archive costs more than the install it saves) |
|
|
46
46
|
| docker prod install | `yarn workspaces focus --production` | `pnpm install --prod --frozen-lockfile --filter <pkg>...` |
|
|
47
47
|
| audit job | `yarn npm audit … --all --recursive` | `pnpm audit --prod --audit-level critical` |
|
|
48
48
|
| build/start defaults | `yarn build` / `yarn start` | `pnpm build` / `pnpm start` |
|
|
@@ -146,9 +146,9 @@ skip it and run a bare `pnpm install` — that silently upgrades hundreds
|
|
|
146
146
|
of transitive dependencies at the same time as the package manager
|
|
147
147
|
changes, and you will not know which change broke what.
|
|
148
148
|
|
|
149
|
-
Then set the `packageManager` field, and update `.gitignore`:
|
|
150
|
-
|
|
151
|
-
|
|
149
|
+
Then set the `packageManager` field, and update `.gitignore`: `.yarn/*`
|
|
150
|
+
entries out (keep `.yarn/patches` only if you left the patches there).
|
|
151
|
+
Nothing pnpm-specific needs ignoring — the store lives outside the repo.
|
|
152
152
|
|
|
153
153
|
## Step 4 — fix the fallout locally
|
|
154
154
|
|
|
@@ -231,8 +231,8 @@ Mirrored, with one loss to state up front: **there is no importer back**.
|
|
|
231
231
|
every range — the migration necessarily bumps transitive versions.
|
|
232
232
|
Do it deliberately:
|
|
233
233
|
|
|
234
|
-
1. Delete `pnpm-lock.yaml`, `pnpm-workspace.yaml`,
|
|
235
|
-
|
|
234
|
+
1. Delete `pnpm-lock.yaml`, `pnpm-workspace.yaml`, and the `node_modules`
|
|
235
|
+
trees.
|
|
236
236
|
2. Move `packages:` back into package.json `workspaces`, `overrides` →
|
|
237
237
|
`resolutions`, `patchedDependencies` → yarn's patch protocol,
|
|
238
238
|
`allowBuilds` → (yarn runs build scripts by default; nothing needed).
|
package/dist/skills/catladder-migrate-package-manager/references/yarn-to-pnpm-differences.md
CHANGED
|
@@ -82,9 +82,26 @@ the docker build context.
|
|
|
82
82
|
|
|
83
83
|
**Version drift in `--prod` installs.** `pnpm install --prod` on a
|
|
84
84
|
node_modules tree from a *different* lockfile does not prune orphaned
|
|
85
|
-
`.pnpm` directories
|
|
86
|
-
|
|
87
|
-
|
|
85
|
+
`.pnpm` directories — never reuse one branch's node_modules for another
|
|
86
|
+
lockfile, and never a yarn tree for a pnpm branch.
|
|
87
|
+
|
|
88
|
+
**Nothing is cached.** A yarn pipeline caches its zip cache and
|
|
89
|
+
node_modules; a pnpm pipeline caches neither, and does not copy a store
|
|
90
|
+
into docker images either. pnpm installs a 3800-package monorepo from
|
|
91
|
+
the registry in 30-40s, which is less than it costs to move a 1 GB
|
|
92
|
+
store or a 1.3 GB node_modules tree through a CI cache — measured
|
|
93
|
+
side-by-side, caching made jobs about twice as slow on gitlab. Two
|
|
94
|
+
consequences when migrating: CI pulls more from the registry than the
|
|
95
|
+
yarn setup did (worth a registry proxy if that matters to you), and
|
|
96
|
+
`.pnpm-store` should not appear anywhere in the repo or a build
|
|
97
|
+
context.
|
|
98
|
+
|
|
99
|
+
**Docker images must not carry the store.** If a store is copied into
|
|
100
|
+
an image, it lands in a layer below `node_modules`, pnpm cannot hardlink
|
|
101
|
+
across the overlay boundary, and every package is copied instead — the
|
|
102
|
+
install gets *slower* (28s vs 10s from the registry) and the image
|
|
103
|
+
carries the packages twice. Let the `--prod` install download, into a
|
|
104
|
+
store outside the app directory that the same `RUN` layer deletes.
|
|
88
105
|
|
|
89
106
|
**pnpm 11 needs node ≥ 22.13** (pnpm 10: ≥ 18.12), and it does not fail
|
|
90
107
|
politely: it prints a `warn:` line and then crashes on
|
|
@@ -58,12 +58,13 @@ the registry.
|
|
|
58
58
|
|
|
59
59
|
## Caching
|
|
60
60
|
|
|
61
|
-
Cache configuration is generated per build type
|
|
62
|
-
`node_modules` and the
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
61
|
+
Cache configuration is generated per build type. **yarn** node builds
|
|
62
|
+
cache `node_modules` and the `.yarn` zip cache; GitLab uses mutable
|
|
63
|
+
caches with fallback keys (review branches fall back to the dev cache),
|
|
64
|
+
GitHub immutable lockfile-keyed caches where only the build job writes.
|
|
65
|
+
**pnpm** builds cache nothing: measured on a 3800-package monorepo,
|
|
66
|
+
moving the store or node_modules through a CI cache costs more than
|
|
67
|
+
pnpm's from-registry install.
|
|
67
68
|
Caching behavior is changed via the build config in `catladder.ts`,
|
|
68
69
|
not in the YAML.
|
|
69
70
|
|