@catladder/cli 0.0.0-next-a2f59d07 → 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 +92 -102
- package/dist/bundles/cli/index.js +92 -102
- package/dist/bundles/skills/catladder-builds/references/build-types.md +10 -0
- package/dist/bundles/skills/catladder-migrate-package-manager/SKILL.md +15 -9
- package/dist/bundles/skills/catladder-migrate-package-manager/references/yarn-to-pnpm-differences.md +30 -4
- 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.d.ts +7 -4
- package/dist/packages/pipeline/src/build/node/packageManagerInstall.js +32 -26
- package/dist/packages/pipeline/src/build/node/packageManagerInstall.js.map +1 -1
- package/dist/packages/pipeline/src/build/node/testJob.js +14 -14
- package/dist/packages/pipeline/src/build/node/testJob.js.map +1 -1
- package/dist/packages/pipeline/src/build/types.d.ts +17 -3
- package/dist/packages/pipeline/src/build/types.js.map +1 -1
- package/dist/skills/catladder-builds/references/build-types.md +10 -0
- package/dist/skills/catladder-migrate-package-manager/SKILL.md +15 -9
- package/dist/skills/catladder-migrate-package-manager/references/yarn-to-pnpm-differences.md +30 -4
- package/dist/skills/catladder-pipelines/SKILL.md +7 -6
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
|
@@ -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,OAAgB,EAChB,MAAM,GAAG,WAAW,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AAC,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"}
|
|
@@ -1,12 +1,15 @@
|
|
|
1
1
|
import { BashExpression } from "../../../../bash/src/index.js";
|
|
2
2
|
import type { ComponentContextWithBuild, PackageManagerInfoBase } from "../../types";
|
|
3
|
+
import type { AuditLevel } from "../types";
|
|
3
4
|
import { type Context } from "../../types";
|
|
5
|
+
export declare const DEFAULT_AUDIT_LEVEL: AuditLevel;
|
|
4
6
|
/**
|
|
5
|
-
* default `audit` job command per package manager
|
|
6
|
-
*
|
|
7
|
-
*
|
|
7
|
+
* default `audit` job command per package manager, failing on advisories
|
|
8
|
+
* of `level` and above. Exhaustive on the package-manager type and throws
|
|
9
|
+
* for anything unsupported, so adding a new package manager surfaces every
|
|
10
|
+
* place that needs a command here.
|
|
8
11
|
*/
|
|
9
|
-
export declare const getDefaultAuditCommand: (packageManagerInfo: PackageManagerInfoBase) => string;
|
|
12
|
+
export declare const getDefaultAuditCommand: (packageManagerInfo: PackageManagerInfoBase, level?: AuditLevel) => string;
|
|
10
13
|
export declare const ensureNodeVersion: (context: Context) => string[];
|
|
11
14
|
export declare const getPackageManagerInstall: (context: Context, options?: {
|
|
12
15
|
noCustomPostInstall: boolean;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getDockerAppCopyAndBuildScript = exports.getPackageManagerInstall = exports.ensureNodeVersion = exports.getDefaultAuditCommand = void 0;
|
|
3
|
+
exports.getDockerAppCopyAndBuildScript = exports.getPackageManagerInstall = exports.ensureNodeVersion = exports.getDefaultAuditCommand = exports.DEFAULT_AUDIT_LEVEL = void 0;
|
|
4
4
|
const bash_1 = require("../../../../bash/src/index.js");
|
|
5
5
|
const utils_1 = require("../../utils");
|
|
6
6
|
const gitlab_1 = require("../../utils/gitlab");
|
|
@@ -24,33 +24,38 @@ 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
|
];
|
|
37
|
+
exports.DEFAULT_AUDIT_LEVEL = "critical";
|
|
41
38
|
/**
|
|
42
|
-
* default `audit` job command per package manager
|
|
43
|
-
*
|
|
44
|
-
*
|
|
39
|
+
* default `audit` job command per package manager, failing on advisories
|
|
40
|
+
* of `level` and above. Exhaustive on the package-manager type and throws
|
|
41
|
+
* for anything unsupported, so adding a new package manager surfaces every
|
|
42
|
+
* place that needs a command here.
|
|
45
43
|
*/
|
|
46
|
-
const getDefaultAuditCommand = (packageManagerInfo) => {
|
|
44
|
+
const getDefaultAuditCommand = (packageManagerInfo, level = exports.DEFAULT_AUDIT_LEVEL) => {
|
|
47
45
|
switch (packageManagerInfo.type) {
|
|
48
46
|
case "pnpm":
|
|
49
|
-
return
|
|
47
|
+
return `pnpm audit --prod --audit-level ${level}`;
|
|
50
48
|
case "yarn":
|
|
51
49
|
return packageManagerInfo.isClassic
|
|
52
|
-
?
|
|
53
|
-
|
|
50
|
+
? // classic walks the whole tree; --groups limits it to production
|
|
51
|
+
`yarn audit --level ${level} --groups dependencies`
|
|
52
|
+
: // yarn 2+ audits only the CURRENT workspace's DIRECT dependencies
|
|
53
|
+
// by default — in a monorepo that is the root manifest, which
|
|
54
|
+
// usually has no production dependencies at all, so the job passed
|
|
55
|
+
// without checking anything. --all covers every workspace,
|
|
56
|
+
// --recursive the transitive dependencies (what `pnpm audit` and
|
|
57
|
+
// `yarn audit` classic do on their own).
|
|
58
|
+
`yarn npm audit --environment production --severity ${level} --all --recursive`;
|
|
54
59
|
default:
|
|
55
60
|
throw new Error(`no audit command implemented for package manager "${packageManagerInfo.type}"`);
|
|
56
61
|
}
|
|
@@ -71,7 +76,7 @@ const getPackageManagerInstall = async (context, options) => {
|
|
|
71
76
|
? context.build.config.postInstall
|
|
72
77
|
: null;
|
|
73
78
|
const installSection = packageManagerInfo.type === "pnpm"
|
|
74
|
-
? (0, gitlab_1.collapseableSection)("pnpminstall", "pnpm install")(getPnpmInstallCommands(
|
|
79
|
+
? (0, gitlab_1.collapseableSection)("pnpminstall", "pnpm install")(getPnpmInstallCommands(packageManagerInfo))
|
|
75
80
|
: (0, gitlab_1.collapseableSection)("yarninstall", "Yarn install")([getYarnInstallCommand(packageManagerInfo)]);
|
|
76
81
|
return [
|
|
77
82
|
...(0, exports.ensureNodeVersion)(context),
|
|
@@ -84,11 +89,12 @@ const getPackageManagerInstall = async (context, options) => {
|
|
|
84
89
|
exports.getPackageManagerInstall = getPackageManagerInstall;
|
|
85
90
|
const DOCKER_COPY_FILES = `COPY --chown=node:node $APP_DIR .`;
|
|
86
91
|
const getPnpmDockerAppCopyAndBuildScript = (packageManagerInfo) => {
|
|
87
|
-
// the
|
|
88
|
-
// the
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
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";
|
|
92
98
|
// in a workspace, only install the component (and its workspace
|
|
93
99
|
// dependencies) — the pnpm equivalent of `yarn workspaces focus`.
|
|
94
100
|
// npm package names are shell-safe unquoted (the whole script is
|
|
@@ -100,7 +106,7 @@ const getPnpmDockerAppCopyAndBuildScript = (packageManagerInfo) => {
|
|
|
100
106
|
return new bash_1.BashExpression(`
|
|
101
107
|
${DOCKER_COPY_FILES}
|
|
102
108
|
RUN command -v pnpm >/dev/null 2>&1 || npm install -g pnpm@${packageManagerInfo.version}
|
|
103
|
-
RUN pnpm install --prod --frozen-lockfile --store-dir ${storeDir}${filter}
|
|
109
|
+
RUN pnpm install --prod --frozen-lockfile --store-dir ${storeDir}${filter} && rm -rf ${storeDir}
|
|
104
110
|
`.trim());
|
|
105
111
|
};
|
|
106
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;
|
|
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,E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A6B,GAAG,6BAA6B;QACjE,CAAC,CAAC,wCAAwC;QAC1C,CAAC,CAAC,EAAE,CAAC;IAEP,yCAAyC;IACzC,iGAAiG;IACjG,OAAO,IAAI,qBAAc,CACvB;;EAEF,iBAAiB;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"}
|
|
@@ -11,7 +11,7 @@ const cache_1 = require("./cache");
|
|
|
11
11
|
const constants_1 = require("./constants");
|
|
12
12
|
const packageManagerInstall_1 = require("./packageManagerInstall");
|
|
13
13
|
const createNodeTestJobs = async (context) => {
|
|
14
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3;
|
|
14
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4;
|
|
15
15
|
// don't run tests after release
|
|
16
16
|
// TODO: this will be replaced by using rules
|
|
17
17
|
if (context.trigger === "taggedRelease") {
|
|
@@ -57,11 +57,11 @@ const createNodeTestJobs = async (context) => {
|
|
|
57
57
|
script: [
|
|
58
58
|
`cd ${context.build.dir}`,
|
|
59
59
|
...((_f = (0, utils_1.ensureArrayOrNull)((_e = buildConfig.audit) === null || _e === void 0 ? void 0 : _e.command)) !== null && _f !== void 0 ? _f : [
|
|
60
|
-
(0, packageManagerInstall_1.getDefaultAuditCommand)(packageManagerInfo),
|
|
60
|
+
(0, packageManagerInstall_1.getDefaultAuditCommand)(packageManagerInfo, (_g = buildConfig.audit) === null || _g === void 0 ? void 0 : _g.level),
|
|
61
61
|
]),
|
|
62
62
|
],
|
|
63
|
-
allow_failure: (
|
|
64
|
-
...(0, createArtifactsConfig_1.createArtifactsConfig)(context.build.dir, (
|
|
63
|
+
allow_failure: (_j = (_h = buildConfig.audit) === null || _h === void 0 ? void 0 : _h.allowFailure) !== null && _j !== void 0 ? _j : true,
|
|
64
|
+
...(0, createArtifactsConfig_1.createArtifactsConfig)(context.build.dir, (_k = buildConfig.audit) === null || _k === void 0 ? void 0 : _k.artifactsReports, (_l = buildConfig.audit) === null || _l === void 0 ? void 0 : _l.artifacts),
|
|
65
65
|
})
|
|
66
66
|
: null;
|
|
67
67
|
const lintJob = buildConfig.lint !== false
|
|
@@ -70,20 +70,20 @@ const createNodeTestJobs = async (context) => {
|
|
|
70
70
|
...base,
|
|
71
71
|
runnerVariables: {
|
|
72
72
|
...constants_1.NODE_RUNNER_BUILD_VARIABLES,
|
|
73
|
-
...((
|
|
73
|
+
...((_o = (_m = buildConfig.lint) === null || _m === void 0 ? void 0 : _m.runnerVariables) !== null && _o !== void 0 ? _o : {}),
|
|
74
74
|
},
|
|
75
|
-
image: (
|
|
75
|
+
image: (_q = (_p = buildConfig.lint) === null || _p === void 0 ? void 0 : _p.jobImage) !== null && _q !== void 0 ? _q : defaultImage,
|
|
76
76
|
caches: nodeCache,
|
|
77
77
|
script: [
|
|
78
78
|
...(0, packageManagerInstall_1.ensureNodeVersion)(context),
|
|
79
79
|
`cd ${context.build.dir}`,
|
|
80
80
|
...packageManagerInstall,
|
|
81
|
-
...((
|
|
81
|
+
...((_s = (0, utils_1.ensureArrayOrNull)((_r = buildConfig.lint) === null || _r === void 0 ? void 0 : _r.command)) !== null && _s !== void 0 ? _s : [
|
|
82
82
|
(0, runScript_1.runScript)(packageManagerInfo.type, "lint"),
|
|
83
83
|
]),
|
|
84
84
|
],
|
|
85
|
-
allow_failure: (
|
|
86
|
-
...(0, createArtifactsConfig_1.createArtifactsConfig)(context.build.dir, (
|
|
85
|
+
allow_failure: (_t = buildConfig.lint) === null || _t === void 0 ? void 0 : _t.allowFailure,
|
|
86
|
+
...(0, createArtifactsConfig_1.createArtifactsConfig)(context.build.dir, (_u = buildConfig.lint) === null || _u === void 0 ? void 0 : _u.artifactsReports, (_v = buildConfig.lint) === null || _v === void 0 ? void 0 : _v.artifacts),
|
|
87
87
|
})
|
|
88
88
|
: null;
|
|
89
89
|
const testJob = buildConfig.test !== false
|
|
@@ -92,22 +92,22 @@ const createNodeTestJobs = async (context) => {
|
|
|
92
92
|
...base,
|
|
93
93
|
runnerVariables: {
|
|
94
94
|
...constants_1.NODE_RUNNER_BUILD_VARIABLES,
|
|
95
|
-
...((
|
|
95
|
+
...((_x = (_w = buildConfig.test) === null || _w === void 0 ? void 0 : _w.runnerVariables) !== null && _x !== void 0 ? _x : {}),
|
|
96
96
|
},
|
|
97
97
|
// browser tests need a jobImage carrying the browser, e.g. the
|
|
98
98
|
// official playwright image (version-matched to the project)
|
|
99
|
-
image: (
|
|
99
|
+
image: (_z = (_y = buildConfig.test) === null || _y === void 0 ? void 0 : _y.jobImage) !== null && _z !== void 0 ? _z : (0, runner_1.getRunnerImage)("jobs-default"),
|
|
100
100
|
caches: nodeCache,
|
|
101
101
|
script: [
|
|
102
102
|
...(0, packageManagerInstall_1.ensureNodeVersion)(context),
|
|
103
103
|
`cd ${context.build.dir}`,
|
|
104
104
|
...packageManagerInstall,
|
|
105
|
-
...((
|
|
105
|
+
...((_1 = (0, utils_1.ensureArrayOrNull)((_0 = buildConfig.test) === null || _0 === void 0 ? void 0 : _0.command)) !== null && _1 !== void 0 ? _1 : [
|
|
106
106
|
(0, runScript_1.runScript)(packageManagerInfo.type, "test"),
|
|
107
107
|
]),
|
|
108
108
|
],
|
|
109
|
-
allow_failure: (
|
|
110
|
-
...(0, createArtifactsConfig_1.createArtifactsConfig)(context.build.dir, (
|
|
109
|
+
allow_failure: (_2 = buildConfig.test) === null || _2 === void 0 ? void 0 : _2.allowFailure,
|
|
110
|
+
...(0, createArtifactsConfig_1.createArtifactsConfig)(context.build.dir, (_3 = buildConfig.test) === null || _3 === void 0 ? void 0 : _3.artifactsReports, (_4 = buildConfig.test) === null || _4 === void 0 ? void 0 : _4.artifacts),
|
|
111
111
|
})
|
|
112
112
|
: null;
|
|
113
113
|
return [auditJob, lintJob, testJob].filter(utils_1.notNil);
|
|
@@ -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,4CAAyC;AACzC,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,EAAC,cAAc,CAAC,CAAC;IACpD,MAAM,IAAI,GAA8C;QACtD,SAAS,EAAE;YACT,QAAQ,EAAE,OAAO,CAAC,KAAK,CAAC,GAAG;YAC3B,GAAG,CAAC,OAAO,CAAC,IAAI,KAAK,WAAW;gBAC9B,CAAC,CAAC;oBACE,GAAG,OAAO,CAAC,WAAW,CAAC,WAAW,CAAC,KAAK,CAAC,OAAO;iBACjD;gBACH,CAAC,CAAC,EAAE,CAAC;SACR;QAED,KAAK,EAAE,MAAM;QACb,KAAK,EAAE,EAAE;KACV,CAAC;IACF,MAAM,WAAW,GAAG,OAAO,CAAC,KAAK,CAAC,MAAM,CAAC;IACzC,MAAM,CAAC,qBAAqB,EAAE,kBAAkB,EAAE,SAAS,CAAC,GAC1D,MAAM,OAAO,CAAC,GAAG,CAAC;QAChB,IAAA,gDAAwB,EAAC,OAAO,CAAC;QACjC,OAAO,CAAC,kBAAkB;QAC1B,qEAAqE;QACrE,mEAAmE;QACnE,kEAAkE;QAClE,IAAA,oBAAY,EAAC,OAAO,EAAE,MAAM,CAAC;KAC9B,CAAC,CAAC;IACL,MAAM,QAAQ,GACZ,WAAW,CAAC,KAAK,KAAK,KAAK;QACzB,CAAC,CAAC,IAAI,mBAAY,CAAC;YACf,IAAI,EAAE,UAAU;YAChB,GAAG,IAAI;YACP,eAAe,EAAE;gBACf,GAAG,uCAA2B;gBAC9B,GAAG,CAAC,MAAA,MAAA,WAAW,CAAC,KAAK,0CAAE,eAAe,mCAAI,EAAE,CAAC;aAC9C;YACD,KAAK,EAAE,MAAA,MAAA,WAAW,CAAC,KAAK,0CAAE,QAAQ,mCAAI,YAAY;YAClD,MAAM,EAAE,SAAS,EAAE,8CAA8C;YACjE,MAAM,EAAE;gBACN,MAAM,OAAO,CAAC,KAAK,CAAC,GAAG,EAAE;gBACzB,GAAG,CAAC,MAAA,IAAA,yBAAiB,EAAC,MAAA,WAAW,CAAC,KAAK,0CAAE,OAAO,CAAC,mCAAI;oBACnD,IAAA,8CAAsB,
|
|
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,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,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C,CAAC,MAAM,CAAC,cAAM,CAAC,CAAC;AACrD,CAAC,CAAC;AA9HW,QAAA,kBAAkB,sBA8H7B"}
|
|
@@ -103,6 +103,20 @@ export type TestJobCustom = {
|
|
|
103
103
|
*/
|
|
104
104
|
allowFailure?: boolean;
|
|
105
105
|
};
|
|
106
|
+
/**
|
|
107
|
+
* severity threshold of the 🛡 audit job: an advisory at this level or
|
|
108
|
+
* above fails the job. Maps to the package manager's own flag
|
|
109
|
+
* (`pnpm audit --audit-level`, `yarn npm audit --severity`,
|
|
110
|
+
* classic `yarn audit --level`).
|
|
111
|
+
*/
|
|
112
|
+
export type AuditLevel = "info" | "low" | "moderate" | "high" | "critical";
|
|
113
|
+
export type AuditJobCustom = TestJobCustom & {
|
|
114
|
+
/**
|
|
115
|
+
* lowest severity that fails the job, defaults to `"critical"`.
|
|
116
|
+
* Ignored when {@link TestJobCustom.command} spells out its own command.
|
|
117
|
+
*/
|
|
118
|
+
level?: AuditLevel;
|
|
119
|
+
};
|
|
106
120
|
export type BuildConfigBase = {
|
|
107
121
|
/**
|
|
108
122
|
* command to run on the image to start the app (e.g. yarn start)
|
|
@@ -134,7 +148,7 @@ export type BuildConfigBase = {
|
|
|
134
148
|
/**
|
|
135
149
|
* customize audit, set false to disable
|
|
136
150
|
*/
|
|
137
|
-
audit?: false |
|
|
151
|
+
audit?: false | AuditJobCustom;
|
|
138
152
|
/**
|
|
139
153
|
* additional paths for artifacts,
|
|
140
154
|
* by default "dist" and ".next" are allways included
|
|
@@ -266,7 +280,7 @@ export type BuildConfigCustom = Omit<BuildConfigBase, "lint" | "test" | "audit">
|
|
|
266
280
|
/**
|
|
267
281
|
* custom audit, disabled when not set
|
|
268
282
|
*/
|
|
269
|
-
audit?:
|
|
283
|
+
audit?: AuditJobCustom;
|
|
270
284
|
};
|
|
271
285
|
export type BuildConfigRails = BuildConfigBase & {
|
|
272
286
|
type: "rails";
|
|
@@ -366,7 +380,7 @@ export type WorkspaceBuildConfigBase = {
|
|
|
366
380
|
/**
|
|
367
381
|
* customize audit, set false to disable
|
|
368
382
|
*/
|
|
369
|
-
audit?: false |
|
|
383
|
+
audit?: false | AuditJobCustom;
|
|
370
384
|
/**
|
|
371
385
|
* additional vars only for the build job.
|
|
372
386
|
* Also if you use services: that require env vars, you need to set them here.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../../../../packages/pipeline/src/build/types.ts"],"names":[],"mappings":";;;AA+
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../../../../packages/pipeline/src/build/types.ts"],"names":[],"mappings":";;;AA+aO,MAAM,uBAAuB,GAAG,CACrC,CAAsB,EACM,EAAE;IAC9B,IAAI,CAAC,CAAC;QAAE,OAAO,KAAK,CAAC;IACrB,OAAO,CAAC,CAAC,MAAM,IAAI,CAAC,CAAC,CAAC;AACxB,CAAC,CAAC;AALW,QAAA,uBAAuB,2BAKlC;AAEK,MAAM,aAAa,GAAG,CAC3B,CAAc,EACd,GAAG,KAAQ,EACqC,EAAE;IAClD,IAAI,CAAC,IAAA,+BAAuB,EAAC,CAAC,CAAC;QAAE,OAAO,KAAK,CAAC;IAC9C,OAAO,KAAK,CAAC,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;AAChC,CAAC,CAAC;AANW,QAAA,aAAa,iBAMxB"}
|
|
@@ -26,6 +26,16 @@ generated pipeline files.
|
|
|
26
26
|
`artifactsReports`, `artifacts`, `runnerVariables`, `allowFailure`
|
|
27
27
|
(`allowFailure` defaults to `true` for `audit`).
|
|
28
28
|
|
|
29
|
+
`audit` additionally takes `level`: `"info" | "low" | "moderate" | "high" |
|
|
30
|
+
"critical"` (default `"critical"`) — the lowest severity that fails the job,
|
|
31
|
+
translated to the package manager's own flag (`pnpm audit --audit-level`,
|
|
32
|
+
`yarn npm audit --severity`, classic `yarn audit --level`). Ignored when
|
|
33
|
+
`command` spells out its own command:
|
|
34
|
+
|
|
35
|
+
```ts
|
|
36
|
+
audit: { level: "high" }, // fail on high and critical advisories
|
|
37
|
+
```
|
|
38
|
+
|
|
29
39
|
## Per-type options & defaults
|
|
30
40
|
|
|
31
41
|
### `node`
|
|
@@ -40,13 +40,19 @@ 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
|
-
| audit job | `yarn npm audit
|
|
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` |
|
|
49
49
|
|
|
50
|
+
The audit job is the one place where the two are not equivalent in
|
|
51
|
+
practice: it is easy to have a yarn pipeline whose audit checked nothing
|
|
52
|
+
(before catladder 5 the generated command lacked `--all --recursive`), so
|
|
53
|
+
the pnpm job can turn up long-standing vulnerabilities. Read them as
|
|
54
|
+
pre-existing, not as caused by the migration.
|
|
55
|
+
|
|
50
56
|
Because the cache keys differ per package manager, the first pnpm
|
|
51
57
|
pipeline runs **cold** (and rebuilds job images). Judge speed on the
|
|
52
58
|
second run, not the first.
|
|
@@ -140,9 +146,9 @@ skip it and run a bare `pnpm install` — that silently upgrades hundreds
|
|
|
140
146
|
of transitive dependencies at the same time as the package manager
|
|
141
147
|
changes, and you will not know which change broke what.
|
|
142
148
|
|
|
143
|
-
Then set the `packageManager` field, and update `.gitignore`:
|
|
144
|
-
|
|
145
|
-
|
|
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.
|
|
146
152
|
|
|
147
153
|
## Step 4 — fix the fallout locally
|
|
148
154
|
|
|
@@ -225,8 +231,8 @@ Mirrored, with one loss to state up front: **there is no importer back**.
|
|
|
225
231
|
every range — the migration necessarily bumps transitive versions.
|
|
226
232
|
Do it deliberately:
|
|
227
233
|
|
|
228
|
-
1. Delete `pnpm-lock.yaml`, `pnpm-workspace.yaml`,
|
|
229
|
-
|
|
234
|
+
1. Delete `pnpm-lock.yaml`, `pnpm-workspace.yaml`, and the `node_modules`
|
|
235
|
+
trees.
|
|
230
236
|
2. Move `packages:` back into package.json `workspaces`, `overrides` →
|
|
231
237
|
`resolutions`, `patchedDependencies` → yarn's patch protocol,
|
|
232
238
|
`allowBuilds` → (yarn runs build scripts by default; nothing needed).
|
package/dist/skills/catladder-migrate-package-manager/references/yarn-to-pnpm-differences.md
CHANGED
|
@@ -19,7 +19,7 @@ here has bitten a real catladder project during a migration.
|
|
|
19
19
|
| `yarn run -T x` / `yarn -T x` (berry top-level) | `x` (root `node_modules/.bin` is on the script PATH) |
|
|
20
20
|
| `yarn dlx x` | `pnpm dlx x` |
|
|
21
21
|
| `yarn node x` / `yarn exec x` | `pnpm exec x` |
|
|
22
|
-
| `yarn npm audit --environment production` | `pnpm audit --prod` |
|
|
22
|
+
| `yarn npm audit --environment production --all --recursive` | `pnpm audit --prod` |
|
|
23
23
|
| `yarn bin x` | `pnpm bin x` |
|
|
24
24
|
|
|
25
25
|
## Configuration mapping
|
|
@@ -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
|
|
@@ -92,6 +109,15 @@ politely: it prints a `warn:` line and then crashes on
|
|
|
92
109
|
job image ships node 22 — the jobs run `nvm install` from `.nvmrc`, so
|
|
93
110
|
an `.nvmrc` of `20` downgrades the image right before the install.
|
|
94
111
|
|
|
112
|
+
**`pnpm audit` needs no scope flags.** It audits every workspace and the
|
|
113
|
+
whole transitive tree by default, which is what `yarn npm audit` only does
|
|
114
|
+
with `--all --recursive` (without them it checks the current workspace's
|
|
115
|
+
*direct* dependencies — in a monorepo root that is usually nothing at all).
|
|
116
|
+
Expect the pnpm audit job to surface vulnerabilities the yarn one never
|
|
117
|
+
reported. In return `--prod` is stricter than yarn's
|
|
118
|
+
`--environment production`: yarn still reports a devDependency of a
|
|
119
|
+
workspace, pnpm does not.
|
|
120
|
+
|
|
95
121
|
**`minimumReleaseAge`** defaults to 1440 minutes on pnpm 11: freshly
|
|
96
122
|
published versions are refused. Set it to `0` while migrating (it is a
|
|
97
123
|
supply-chain feature worth enabling deliberately later, not something to
|
|
@@ -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
|
|