@catladder/cli 0.0.0-next-a9386ffe → 0.0.0-next-1d12aca2
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/apps/cli/src/adapters/terminal.d.ts +8 -0
- package/dist/apps/cli/src/adapters/terminal.js +9 -2
- package/dist/apps/cli/src/adapters/terminal.js.map +1 -1
- package/dist/apps/cli/src/apps/catenv/catenv.d.ts +5 -0
- package/dist/apps/cli/src/apps/catenv/catenv.js +10 -1
- package/dist/apps/cli/src/apps/catenv/catenv.js.map +1 -1
- package/dist/apps/cli/src/catenv.js +7 -0
- package/dist/apps/cli/src/catenv.js.map +1 -1
- package/dist/apps/cli/src/utils/gitlab.js +5 -0
- package/dist/apps/cli/src/utils/gitlab.js.map +1 -1
- package/dist/apps/cli/src/vault/VaultManager.js +6 -1
- package/dist/apps/cli/src/vault/VaultManager.js.map +1 -1
- package/dist/bundles/catenv/index.js +17447 -8872
- package/dist/bundles/cli/index.js +51 -25
- package/dist/bundles/skills/catladder-builds/references/build-types.md +10 -0
- package/dist/bundles/skills/catladder-migrate-package-manager/SKILL.md +7 -1
- package/dist/bundles/skills/catladder-migrate-package-manager/references/yarn-to-pnpm-differences.md +10 -1
- package/dist/packages/pipeline/src/build/node/packageManagerInstall.d.ts +7 -4
- package/dist/packages/pipeline/src/build/node/packageManagerInstall.js +17 -8
- 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 +7 -1
- package/dist/skills/catladder-migrate-package-manager/references/yarn-to-pnpm-differences.md +10 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/src/adapters/terminal.ts +16 -2
- package/src/apps/catenv/catenv.ts +15 -1
- package/src/catenv.ts +12 -0
- package/src/utils/gitlab.ts +7 -0
- package/src/vault/VaultManager.ts +4 -1
|
@@ -219,9 +219,16 @@ function createTerminalIO(options = {}) {
|
|
|
219
219
|
var _a;
|
|
220
220
|
const io = {
|
|
221
221
|
interactive: (_a = options.interactive) !== null && _a !== void 0 ? _a : process.stdin.isTTY === true,
|
|
222
|
-
getVaultManager: (0, vaultManagerAccess_1.createVaultManagerGetter)(() => io
|
|
222
|
+
getVaultManager: (0, vaultManagerAccess_1.createVaultManagerGetter)(() => io, {
|
|
223
|
+
mode: options.vaultMode,
|
|
224
|
+
}),
|
|
223
225
|
log(message) {
|
|
224
|
-
|
|
226
|
+
if (options.logToStderr) {
|
|
227
|
+
console.error(message);
|
|
228
|
+
}
|
|
229
|
+
else {
|
|
230
|
+
console.log(message);
|
|
231
|
+
}
|
|
225
232
|
},
|
|
226
233
|
async confirm(message) {
|
|
227
234
|
var _a;
|
|
@@ -6711,6 +6718,11 @@ const getGitlabToken = async (io) => {
|
|
|
6711
6718
|
console.error("⚠️ gitlab token missing, please run catladder to set it up");
|
|
6712
6719
|
process.exit(1);
|
|
6713
6720
|
}
|
|
6721
|
+
if (!io.interactive) {
|
|
6722
|
+
// don't start the setup wizard in a context that cannot prompt
|
|
6723
|
+
// (direnv, turbo, CI) — fail with the remedy instead
|
|
6724
|
+
throw new Error("gitlab token missing — run `catenv` (or any `catladder` command) once in a terminal to set it up");
|
|
6725
|
+
}
|
|
6714
6726
|
await (0, exports.setupGitlabToken)(io);
|
|
6715
6727
|
}
|
|
6716
6728
|
return (0, preferences_1.getPreference)(TOKEN_KEY);
|
|
@@ -7428,12 +7440,17 @@ class VaultManager {
|
|
|
7428
7440
|
this.vault = this.createVault();
|
|
7429
7441
|
}
|
|
7430
7442
|
createVault() {
|
|
7443
|
+
var _a, _b;
|
|
7431
7444
|
const vaultConfig = (0, pipeline_1.getVaultConfig)(this.config);
|
|
7432
7445
|
switch (vaultConfig.type) {
|
|
7433
7446
|
case "gitlab":
|
|
7434
7447
|
return new GitlabVault_1.GitlabVault();
|
|
7435
7448
|
case "bitwarden":
|
|
7436
|
-
return new BitwardenVault_1.BitwardenVault(this.config, vaultConfig,
|
|
7449
|
+
return new BitwardenVault_1.BitwardenVault(this.config, vaultConfig,
|
|
7450
|
+
// unlock prompts need a mode that allows them AND an IO that
|
|
7451
|
+
// can actually prompt (catenv under direnv/turbo/CI cannot)
|
|
7452
|
+
(this.mode === "auto" || this.mode === "refresh") &&
|
|
7453
|
+
((_b = (_a = this.io) === null || _a === void 0 ? void 0 : _a.interactive) !== null && _b !== void 0 ? _b : true));
|
|
7437
7454
|
}
|
|
7438
7455
|
}
|
|
7439
7456
|
/**
|
|
@@ -12360,7 +12377,7 @@ exports.createMeteorBuildJobs = createMeteorBuildJobs;
|
|
|
12360
12377
|
"use strict";
|
|
12361
12378
|
|
|
12362
12379
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
12363
|
-
exports.getDockerAppCopyAndBuildScript = exports.getPackageManagerInstall = exports.ensureNodeVersion = exports.getDefaultAuditCommand = void 0;
|
|
12380
|
+
exports.getDockerAppCopyAndBuildScript = exports.getPackageManagerInstall = exports.ensureNodeVersion = exports.getDefaultAuditCommand = exports.DEFAULT_AUDIT_LEVEL = void 0;
|
|
12364
12381
|
const bash_1 = __nccwpck_require__(94143);
|
|
12365
12382
|
const utils_1 = __nccwpck_require__(49401);
|
|
12366
12383
|
const gitlab_1 = __nccwpck_require__(86962);
|
|
@@ -12398,19 +12415,28 @@ const getPnpmInstallCommands = (context, packageManagerInfo) => [
|
|
|
12398
12415
|
getEnsurePnpmCommand(packageManagerInfo.version),
|
|
12399
12416
|
`pnpm install --frozen-lockfile --store-dir ${getPnpmStoreDirExpression(isInWorkspace(context, packageManagerInfo))}`,
|
|
12400
12417
|
];
|
|
12418
|
+
exports.DEFAULT_AUDIT_LEVEL = "critical";
|
|
12401
12419
|
/**
|
|
12402
|
-
* default `audit` job command per package manager
|
|
12403
|
-
*
|
|
12404
|
-
*
|
|
12420
|
+
* default `audit` job command per package manager, failing on advisories
|
|
12421
|
+
* of `level` and above. Exhaustive on the package-manager type and throws
|
|
12422
|
+
* for anything unsupported, so adding a new package manager surfaces every
|
|
12423
|
+
* place that needs a command here.
|
|
12405
12424
|
*/
|
|
12406
|
-
const getDefaultAuditCommand = (packageManagerInfo) => {
|
|
12425
|
+
const getDefaultAuditCommand = (packageManagerInfo, level = exports.DEFAULT_AUDIT_LEVEL) => {
|
|
12407
12426
|
switch (packageManagerInfo.type) {
|
|
12408
12427
|
case "pnpm":
|
|
12409
|
-
return
|
|
12428
|
+
return `pnpm audit --prod --audit-level ${level}`;
|
|
12410
12429
|
case "yarn":
|
|
12411
12430
|
return packageManagerInfo.isClassic
|
|
12412
|
-
?
|
|
12413
|
-
|
|
12431
|
+
? // classic walks the whole tree; --groups limits it to production
|
|
12432
|
+
`yarn audit --level ${level} --groups dependencies`
|
|
12433
|
+
: // yarn 2+ audits only the CURRENT workspace's DIRECT dependencies
|
|
12434
|
+
// by default — in a monorepo that is the root manifest, which
|
|
12435
|
+
// usually has no production dependencies at all, so the job passed
|
|
12436
|
+
// without checking anything. --all covers every workspace,
|
|
12437
|
+
// --recursive the transitive dependencies (what `pnpm audit` and
|
|
12438
|
+
// `yarn audit` classic do on their own).
|
|
12439
|
+
`yarn npm audit --environment production --severity ${level} --all --recursive`;
|
|
12414
12440
|
default:
|
|
12415
12441
|
throw new Error(`no audit command implemented for package manager "${packageManagerInfo.type}"`);
|
|
12416
12442
|
}
|
|
@@ -12523,7 +12549,7 @@ const cache_1 = __nccwpck_require__(74559);
|
|
|
12523
12549
|
const constants_1 = __nccwpck_require__(5576);
|
|
12524
12550
|
const packageManagerInstall_1 = __nccwpck_require__(28419);
|
|
12525
12551
|
const createNodeTestJobs = async (context) => {
|
|
12526
|
-
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;
|
|
12552
|
+
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;
|
|
12527
12553
|
// don't run tests after release
|
|
12528
12554
|
// TODO: this will be replaced by using rules
|
|
12529
12555
|
if (context.trigger === "taggedRelease") {
|
|
@@ -12569,11 +12595,11 @@ const createNodeTestJobs = async (context) => {
|
|
|
12569
12595
|
script: [
|
|
12570
12596
|
`cd ${context.build.dir}`,
|
|
12571
12597
|
...((_f = (0, utils_1.ensureArrayOrNull)((_e = buildConfig.audit) === null || _e === void 0 ? void 0 : _e.command)) !== null && _f !== void 0 ? _f : [
|
|
12572
|
-
(0, packageManagerInstall_1.getDefaultAuditCommand)(packageManagerInfo),
|
|
12598
|
+
(0, packageManagerInstall_1.getDefaultAuditCommand)(packageManagerInfo, (_g = buildConfig.audit) === null || _g === void 0 ? void 0 : _g.level),
|
|
12573
12599
|
]),
|
|
12574
12600
|
],
|
|
12575
|
-
allow_failure: (
|
|
12576
|
-
...(0, createArtifactsConfig_1.createArtifactsConfig)(context.build.dir, (
|
|
12601
|
+
allow_failure: (_j = (_h = buildConfig.audit) === null || _h === void 0 ? void 0 : _h.allowFailure) !== null && _j !== void 0 ? _j : true,
|
|
12602
|
+
...(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),
|
|
12577
12603
|
})
|
|
12578
12604
|
: null;
|
|
12579
12605
|
const lintJob = buildConfig.lint !== false
|
|
@@ -12582,20 +12608,20 @@ const createNodeTestJobs = async (context) => {
|
|
|
12582
12608
|
...base,
|
|
12583
12609
|
runnerVariables: {
|
|
12584
12610
|
...constants_1.NODE_RUNNER_BUILD_VARIABLES,
|
|
12585
|
-
...((
|
|
12611
|
+
...((_o = (_m = buildConfig.lint) === null || _m === void 0 ? void 0 : _m.runnerVariables) !== null && _o !== void 0 ? _o : {}),
|
|
12586
12612
|
},
|
|
12587
|
-
image: (
|
|
12613
|
+
image: (_q = (_p = buildConfig.lint) === null || _p === void 0 ? void 0 : _p.jobImage) !== null && _q !== void 0 ? _q : defaultImage,
|
|
12588
12614
|
caches: nodeCache,
|
|
12589
12615
|
script: [
|
|
12590
12616
|
...(0, packageManagerInstall_1.ensureNodeVersion)(context),
|
|
12591
12617
|
`cd ${context.build.dir}`,
|
|
12592
12618
|
...packageManagerInstall,
|
|
12593
|
-
...((
|
|
12619
|
+
...((_s = (0, utils_1.ensureArrayOrNull)((_r = buildConfig.lint) === null || _r === void 0 ? void 0 : _r.command)) !== null && _s !== void 0 ? _s : [
|
|
12594
12620
|
(0, runScript_1.runScript)(packageManagerInfo.type, "lint"),
|
|
12595
12621
|
]),
|
|
12596
12622
|
],
|
|
12597
|
-
allow_failure: (
|
|
12598
|
-
...(0, createArtifactsConfig_1.createArtifactsConfig)(context.build.dir, (
|
|
12623
|
+
allow_failure: (_t = buildConfig.lint) === null || _t === void 0 ? void 0 : _t.allowFailure,
|
|
12624
|
+
...(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),
|
|
12599
12625
|
})
|
|
12600
12626
|
: null;
|
|
12601
12627
|
const testJob = buildConfig.test !== false
|
|
@@ -12604,22 +12630,22 @@ const createNodeTestJobs = async (context) => {
|
|
|
12604
12630
|
...base,
|
|
12605
12631
|
runnerVariables: {
|
|
12606
12632
|
...constants_1.NODE_RUNNER_BUILD_VARIABLES,
|
|
12607
|
-
...((
|
|
12633
|
+
...((_x = (_w = buildConfig.test) === null || _w === void 0 ? void 0 : _w.runnerVariables) !== null && _x !== void 0 ? _x : {}),
|
|
12608
12634
|
},
|
|
12609
12635
|
// browser tests need a jobImage carrying the browser, e.g. the
|
|
12610
12636
|
// official playwright image (version-matched to the project)
|
|
12611
|
-
image: (
|
|
12637
|
+
image: (_z = (_y = buildConfig.test) === null || _y === void 0 ? void 0 : _y.jobImage) !== null && _z !== void 0 ? _z : (0, runner_1.getRunnerImage)("jobs-default"),
|
|
12612
12638
|
caches: nodeCache,
|
|
12613
12639
|
script: [
|
|
12614
12640
|
...(0, packageManagerInstall_1.ensureNodeVersion)(context),
|
|
12615
12641
|
`cd ${context.build.dir}`,
|
|
12616
12642
|
...packageManagerInstall,
|
|
12617
|
-
...((
|
|
12643
|
+
...((_1 = (0, utils_1.ensureArrayOrNull)((_0 = buildConfig.test) === null || _0 === void 0 ? void 0 : _0.command)) !== null && _1 !== void 0 ? _1 : [
|
|
12618
12644
|
(0, runScript_1.runScript)(packageManagerInfo.type, "test"),
|
|
12619
12645
|
]),
|
|
12620
12646
|
],
|
|
12621
|
-
allow_failure: (
|
|
12622
|
-
...(0, createArtifactsConfig_1.createArtifactsConfig)(context.build.dir, (
|
|
12647
|
+
allow_failure: (_2 = buildConfig.test) === null || _2 === void 0 ? void 0 : _2.allowFailure,
|
|
12648
|
+
...(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),
|
|
12623
12649
|
})
|
|
12624
12650
|
: null;
|
|
12625
12651
|
return [auditJob, lintJob, testJob].filter(utils_1.notNil);
|
|
@@ -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`
|
|
@@ -44,9 +44,15 @@ change needed:
|
|
|
44
44
|
| download cache | `.yarn` zip cache | project-local `.pnpm-store`, cache slot scoped by pnpm major |
|
|
45
45
|
| node_modules cache | mutable slot per build dir | **lockfile-keyed** slot (a pnpm install over a foreign tree leaves orphaned `.pnpm` dirs) |
|
|
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.
|
package/dist/bundles/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
|
|
@@ -92,6 +92,15 @@ politely: it prints a `warn:` line and then crashes on
|
|
|
92
92
|
job image ships node 22 — the jobs run `nvm install` from `.nvmrc`, so
|
|
93
93
|
an `.nvmrc` of `20` downgrades the image right before the install.
|
|
94
94
|
|
|
95
|
+
**`pnpm audit` needs no scope flags.** It audits every workspace and the
|
|
96
|
+
whole transitive tree by default, which is what `yarn npm audit` only does
|
|
97
|
+
with `--all --recursive` (without them it checks the current workspace's
|
|
98
|
+
*direct* dependencies — in a monorepo root that is usually nothing at all).
|
|
99
|
+
Expect the pnpm audit job to surface vulnerabilities the yarn one never
|
|
100
|
+
reported. In return `--prod` is stricter than yarn's
|
|
101
|
+
`--environment production`: yarn still reports a devDependency of a
|
|
102
|
+
workspace, pnpm does not.
|
|
103
|
+
|
|
95
104
|
**`minimumReleaseAge`** defaults to 1440 minutes on pnpm 11: freshly
|
|
96
105
|
published versions are refused. Set it to `0` while migrating (it is a
|
|
97
106
|
supply-chain feature worth enabling deliberately later, not something to
|
|
@@ -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");
|
|
@@ -38,19 +38,28 @@ const getPnpmInstallCommands = (context, packageManagerInfo) => [
|
|
|
38
38
|
getEnsurePnpmCommand(packageManagerInfo.version),
|
|
39
39
|
`pnpm install --frozen-lockfile --store-dir ${getPnpmStoreDirExpression(isInWorkspace(context, packageManagerInfo))}`,
|
|
40
40
|
];
|
|
41
|
+
exports.DEFAULT_AUDIT_LEVEL = "critical";
|
|
41
42
|
/**
|
|
42
|
-
* default `audit` job command per package manager
|
|
43
|
-
*
|
|
44
|
-
*
|
|
43
|
+
* default `audit` job command per package manager, failing on advisories
|
|
44
|
+
* of `level` and above. Exhaustive on the package-manager type and throws
|
|
45
|
+
* for anything unsupported, so adding a new package manager surfaces every
|
|
46
|
+
* place that needs a command here.
|
|
45
47
|
*/
|
|
46
|
-
const getDefaultAuditCommand = (packageManagerInfo) => {
|
|
48
|
+
const getDefaultAuditCommand = (packageManagerInfo, level = exports.DEFAULT_AUDIT_LEVEL) => {
|
|
47
49
|
switch (packageManagerInfo.type) {
|
|
48
50
|
case "pnpm":
|
|
49
|
-
return
|
|
51
|
+
return `pnpm audit --prod --audit-level ${level}`;
|
|
50
52
|
case "yarn":
|
|
51
53
|
return packageManagerInfo.isClassic
|
|
52
|
-
?
|
|
53
|
-
|
|
54
|
+
? // classic walks the whole tree; --groups limits it to production
|
|
55
|
+
`yarn audit --level ${level} --groups dependencies`
|
|
56
|
+
: // yarn 2+ audits only the CURRENT workspace's DIRECT dependencies
|
|
57
|
+
// by default — in a monorepo that is the root manifest, which
|
|
58
|
+
// usually has no production dependencies at all, so the job passed
|
|
59
|
+
// without checking anything. --all covers every workspace,
|
|
60
|
+
// --recursive the transitive dependencies (what `pnpm audit` and
|
|
61
|
+
// `yarn audit` classic do on their own).
|
|
62
|
+
`yarn npm audit --environment production --severity ${level} --all --recursive`;
|
|
54
63
|
default:
|
|
55
64
|
throw new Error(`no audit command implemented for package manager "${packageManagerInfo.type}"`);
|
|
56
65
|
}
|
|
@@ -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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CAAC,oBAAoB,CAAC,cAAc,0CAC9C,kBAAkB,mCAAI,IAAI,CAAC;QACjC,CAAC,CAAC,IAAI,CAAC;IAEX,MAAM,kBAAkB,GACtB,QAAQ,IAAI,OAAO,CAAC,KAAK,CAAC,MAAM;QAChC,OAAO,CAAC,KAAK,CAAC,MAAM,CAAC,MAAM;QAC3B,oBAAoB,IAAI,OAAO,CAAC,KAAK,CAAC,MAAM,CAAC,MAAM;QACjD,CAAC,CAAC,CAAC,MAAA,OAAO,CAAC,KAAK,CAAC,MAAM,CAAC,MAAM,CAAC,kBAAkB,mCAC/C,yBAAyB,CAAC;QAC5B,CAAC,CAAC,yBAAyB,CAAC;IAEhC,wFAAwF;IACxF,8CAA8C;IAC9C,MAAM,6BAA6B,GAAG,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAC1D,kBAAkB,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC,CAAC,CACzC,CAAC;IACF,MAAM,6BAA6B,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,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,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,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,SA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AE,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;oBAClD,IAAA,qBAAS,EAAC,kBAAkB,CAAC,IAAI,EAAE,MAAM,CAAC;iBAC3C,CAAC;aACH;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;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`
|
|
@@ -44,9 +44,15 @@ change needed:
|
|
|
44
44
|
| download cache | `.yarn` zip cache | project-local `.pnpm-store`, cache slot scoped by pnpm major |
|
|
45
45
|
| node_modules cache | mutable slot per build dir | **lockfile-keyed** slot (a pnpm install over a foreign tree leaves orphaned `.pnpm` dirs) |
|
|
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.
|
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
|
|
@@ -92,6 +92,15 @@ politely: it prints a `warn:` line and then crashes on
|
|
|
92
92
|
job image ships node 22 — the jobs run `nvm install` from `.nvmrc`, so
|
|
93
93
|
an `.nvmrc` of `20` downgrades the image right before the install.
|
|
94
94
|
|
|
95
|
+
**`pnpm audit` needs no scope flags.** It audits every workspace and the
|
|
96
|
+
whole transitive tree by default, which is what `yarn npm audit` only does
|
|
97
|
+
with `--all --recursive` (without them it checks the current workspace's
|
|
98
|
+
*direct* dependencies — in a monorepo root that is usually nothing at all).
|
|
99
|
+
Expect the pnpm audit job to surface vulnerabilities the yarn one never
|
|
100
|
+
reported. In return `--prod` is stricter than yarn's
|
|
101
|
+
`--environment production`: yarn still reports a devDependency of a
|
|
102
|
+
workspace, pnpm does not.
|
|
103
|
+
|
|
95
104
|
**`minimumReleaseAge`** defaults to 1440 minutes on pnpm 11: freshly
|
|
96
105
|
published versions are refused. Set it to `0` while migrating (it is a
|
|
97
106
|
supply-chain feature worth enabling deliberately later, not something to
|