@catladder/cli 0.0.0-next-a2f59d07 → 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/bundles/catenv/index.js +31 -22
- package/dist/bundles/cli/index.js +31 -22
- 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
|
@@ -6445,7 +6445,7 @@ exports.createMeteorBuildJobs = createMeteorBuildJobs;
|
|
|
6445
6445
|
"use strict";
|
|
6446
6446
|
|
|
6447
6447
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
6448
|
-
exports.getDockerAppCopyAndBuildScript = exports.getPackageManagerInstall = exports.ensureNodeVersion = exports.getDefaultAuditCommand = void 0;
|
|
6448
|
+
exports.getDockerAppCopyAndBuildScript = exports.getPackageManagerInstall = exports.ensureNodeVersion = exports.getDefaultAuditCommand = exports.DEFAULT_AUDIT_LEVEL = void 0;
|
|
6449
6449
|
const bash_1 = __nccwpck_require__(94143);
|
|
6450
6450
|
const utils_1 = __nccwpck_require__(49401);
|
|
6451
6451
|
const gitlab_1 = __nccwpck_require__(86962);
|
|
@@ -6483,19 +6483,28 @@ const getPnpmInstallCommands = (context, packageManagerInfo) => [
|
|
|
6483
6483
|
getEnsurePnpmCommand(packageManagerInfo.version),
|
|
6484
6484
|
`pnpm install --frozen-lockfile --store-dir ${getPnpmStoreDirExpression(isInWorkspace(context, packageManagerInfo))}`,
|
|
6485
6485
|
];
|
|
6486
|
+
exports.DEFAULT_AUDIT_LEVEL = "critical";
|
|
6486
6487
|
/**
|
|
6487
|
-
* default `audit` job command per package manager
|
|
6488
|
-
*
|
|
6489
|
-
*
|
|
6488
|
+
* default `audit` job command per package manager, failing on advisories
|
|
6489
|
+
* of `level` and above. Exhaustive on the package-manager type and throws
|
|
6490
|
+
* for anything unsupported, so adding a new package manager surfaces every
|
|
6491
|
+
* place that needs a command here.
|
|
6490
6492
|
*/
|
|
6491
|
-
const getDefaultAuditCommand = (packageManagerInfo) => {
|
|
6493
|
+
const getDefaultAuditCommand = (packageManagerInfo, level = exports.DEFAULT_AUDIT_LEVEL) => {
|
|
6492
6494
|
switch (packageManagerInfo.type) {
|
|
6493
6495
|
case "pnpm":
|
|
6494
|
-
return
|
|
6496
|
+
return `pnpm audit --prod --audit-level ${level}`;
|
|
6495
6497
|
case "yarn":
|
|
6496
6498
|
return packageManagerInfo.isClassic
|
|
6497
|
-
?
|
|
6498
|
-
|
|
6499
|
+
? // classic walks the whole tree; --groups limits it to production
|
|
6500
|
+
`yarn audit --level ${level} --groups dependencies`
|
|
6501
|
+
: // yarn 2+ audits only the CURRENT workspace's DIRECT dependencies
|
|
6502
|
+
// by default — in a monorepo that is the root manifest, which
|
|
6503
|
+
// usually has no production dependencies at all, so the job passed
|
|
6504
|
+
// without checking anything. --all covers every workspace,
|
|
6505
|
+
// --recursive the transitive dependencies (what `pnpm audit` and
|
|
6506
|
+
// `yarn audit` classic do on their own).
|
|
6507
|
+
`yarn npm audit --environment production --severity ${level} --all --recursive`;
|
|
6499
6508
|
default:
|
|
6500
6509
|
throw new Error(`no audit command implemented for package manager "${packageManagerInfo.type}"`);
|
|
6501
6510
|
}
|
|
@@ -6608,7 +6617,7 @@ const cache_1 = __nccwpck_require__(74559);
|
|
|
6608
6617
|
const constants_1 = __nccwpck_require__(5576);
|
|
6609
6618
|
const packageManagerInstall_1 = __nccwpck_require__(28419);
|
|
6610
6619
|
const createNodeTestJobs = async (context) => {
|
|
6611
|
-
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;
|
|
6620
|
+
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;
|
|
6612
6621
|
// don't run tests after release
|
|
6613
6622
|
// TODO: this will be replaced by using rules
|
|
6614
6623
|
if (context.trigger === "taggedRelease") {
|
|
@@ -6654,11 +6663,11 @@ const createNodeTestJobs = async (context) => {
|
|
|
6654
6663
|
script: [
|
|
6655
6664
|
`cd ${context.build.dir}`,
|
|
6656
6665
|
...((_f = (0, utils_1.ensureArrayOrNull)((_e = buildConfig.audit) === null || _e === void 0 ? void 0 : _e.command)) !== null && _f !== void 0 ? _f : [
|
|
6657
|
-
(0, packageManagerInstall_1.getDefaultAuditCommand)(packageManagerInfo),
|
|
6666
|
+
(0, packageManagerInstall_1.getDefaultAuditCommand)(packageManagerInfo, (_g = buildConfig.audit) === null || _g === void 0 ? void 0 : _g.level),
|
|
6658
6667
|
]),
|
|
6659
6668
|
],
|
|
6660
|
-
allow_failure: (
|
|
6661
|
-
...(0, createArtifactsConfig_1.createArtifactsConfig)(context.build.dir, (
|
|
6669
|
+
allow_failure: (_j = (_h = buildConfig.audit) === null || _h === void 0 ? void 0 : _h.allowFailure) !== null && _j !== void 0 ? _j : true,
|
|
6670
|
+
...(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),
|
|
6662
6671
|
})
|
|
6663
6672
|
: null;
|
|
6664
6673
|
const lintJob = buildConfig.lint !== false
|
|
@@ -6667,20 +6676,20 @@ const createNodeTestJobs = async (context) => {
|
|
|
6667
6676
|
...base,
|
|
6668
6677
|
runnerVariables: {
|
|
6669
6678
|
...constants_1.NODE_RUNNER_BUILD_VARIABLES,
|
|
6670
|
-
...((
|
|
6679
|
+
...((_o = (_m = buildConfig.lint) === null || _m === void 0 ? void 0 : _m.runnerVariables) !== null && _o !== void 0 ? _o : {}),
|
|
6671
6680
|
},
|
|
6672
|
-
image: (
|
|
6681
|
+
image: (_q = (_p = buildConfig.lint) === null || _p === void 0 ? void 0 : _p.jobImage) !== null && _q !== void 0 ? _q : defaultImage,
|
|
6673
6682
|
caches: nodeCache,
|
|
6674
6683
|
script: [
|
|
6675
6684
|
...(0, packageManagerInstall_1.ensureNodeVersion)(context),
|
|
6676
6685
|
`cd ${context.build.dir}`,
|
|
6677
6686
|
...packageManagerInstall,
|
|
6678
|
-
...((
|
|
6687
|
+
...((_s = (0, utils_1.ensureArrayOrNull)((_r = buildConfig.lint) === null || _r === void 0 ? void 0 : _r.command)) !== null && _s !== void 0 ? _s : [
|
|
6679
6688
|
(0, runScript_1.runScript)(packageManagerInfo.type, "lint"),
|
|
6680
6689
|
]),
|
|
6681
6690
|
],
|
|
6682
|
-
allow_failure: (
|
|
6683
|
-
...(0, createArtifactsConfig_1.createArtifactsConfig)(context.build.dir, (
|
|
6691
|
+
allow_failure: (_t = buildConfig.lint) === null || _t === void 0 ? void 0 : _t.allowFailure,
|
|
6692
|
+
...(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),
|
|
6684
6693
|
})
|
|
6685
6694
|
: null;
|
|
6686
6695
|
const testJob = buildConfig.test !== false
|
|
@@ -6689,22 +6698,22 @@ const createNodeTestJobs = async (context) => {
|
|
|
6689
6698
|
...base,
|
|
6690
6699
|
runnerVariables: {
|
|
6691
6700
|
...constants_1.NODE_RUNNER_BUILD_VARIABLES,
|
|
6692
|
-
...((
|
|
6701
|
+
...((_x = (_w = buildConfig.test) === null || _w === void 0 ? void 0 : _w.runnerVariables) !== null && _x !== void 0 ? _x : {}),
|
|
6693
6702
|
},
|
|
6694
6703
|
// browser tests need a jobImage carrying the browser, e.g. the
|
|
6695
6704
|
// official playwright image (version-matched to the project)
|
|
6696
|
-
image: (
|
|
6705
|
+
image: (_z = (_y = buildConfig.test) === null || _y === void 0 ? void 0 : _y.jobImage) !== null && _z !== void 0 ? _z : (0, runner_1.getRunnerImage)("jobs-default"),
|
|
6697
6706
|
caches: nodeCache,
|
|
6698
6707
|
script: [
|
|
6699
6708
|
...(0, packageManagerInstall_1.ensureNodeVersion)(context),
|
|
6700
6709
|
`cd ${context.build.dir}`,
|
|
6701
6710
|
...packageManagerInstall,
|
|
6702
|
-
...((
|
|
6711
|
+
...((_1 = (0, utils_1.ensureArrayOrNull)((_0 = buildConfig.test) === null || _0 === void 0 ? void 0 : _0.command)) !== null && _1 !== void 0 ? _1 : [
|
|
6703
6712
|
(0, runScript_1.runScript)(packageManagerInfo.type, "test"),
|
|
6704
6713
|
]),
|
|
6705
6714
|
],
|
|
6706
|
-
allow_failure: (
|
|
6707
|
-
...(0, createArtifactsConfig_1.createArtifactsConfig)(context.build.dir, (
|
|
6715
|
+
allow_failure: (_2 = buildConfig.test) === null || _2 === void 0 ? void 0 : _2.allowFailure,
|
|
6716
|
+
...(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),
|
|
6708
6717
|
})
|
|
6709
6718
|
: null;
|
|
6710
6719
|
return [auditJob, lintJob, testJob].filter(utils_1.notNil);
|
|
@@ -12377,7 +12377,7 @@ exports.createMeteorBuildJobs = createMeteorBuildJobs;
|
|
|
12377
12377
|
"use strict";
|
|
12378
12378
|
|
|
12379
12379
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
12380
|
-
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;
|
|
12381
12381
|
const bash_1 = __nccwpck_require__(94143);
|
|
12382
12382
|
const utils_1 = __nccwpck_require__(49401);
|
|
12383
12383
|
const gitlab_1 = __nccwpck_require__(86962);
|
|
@@ -12415,19 +12415,28 @@ const getPnpmInstallCommands = (context, packageManagerInfo) => [
|
|
|
12415
12415
|
getEnsurePnpmCommand(packageManagerInfo.version),
|
|
12416
12416
|
`pnpm install --frozen-lockfile --store-dir ${getPnpmStoreDirExpression(isInWorkspace(context, packageManagerInfo))}`,
|
|
12417
12417
|
];
|
|
12418
|
+
exports.DEFAULT_AUDIT_LEVEL = "critical";
|
|
12418
12419
|
/**
|
|
12419
|
-
* default `audit` job command per package manager
|
|
12420
|
-
*
|
|
12421
|
-
*
|
|
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.
|
|
12422
12424
|
*/
|
|
12423
|
-
const getDefaultAuditCommand = (packageManagerInfo) => {
|
|
12425
|
+
const getDefaultAuditCommand = (packageManagerInfo, level = exports.DEFAULT_AUDIT_LEVEL) => {
|
|
12424
12426
|
switch (packageManagerInfo.type) {
|
|
12425
12427
|
case "pnpm":
|
|
12426
|
-
return
|
|
12428
|
+
return `pnpm audit --prod --audit-level ${level}`;
|
|
12427
12429
|
case "yarn":
|
|
12428
12430
|
return packageManagerInfo.isClassic
|
|
12429
|
-
?
|
|
12430
|
-
|
|
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`;
|
|
12431
12440
|
default:
|
|
12432
12441
|
throw new Error(`no audit command implemented for package manager "${packageManagerInfo.type}"`);
|
|
12433
12442
|
}
|
|
@@ -12540,7 +12549,7 @@ const cache_1 = __nccwpck_require__(74559);
|
|
|
12540
12549
|
const constants_1 = __nccwpck_require__(5576);
|
|
12541
12550
|
const packageManagerInstall_1 = __nccwpck_require__(28419);
|
|
12542
12551
|
const createNodeTestJobs = async (context) => {
|
|
12543
|
-
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;
|
|
12544
12553
|
// don't run tests after release
|
|
12545
12554
|
// TODO: this will be replaced by using rules
|
|
12546
12555
|
if (context.trigger === "taggedRelease") {
|
|
@@ -12586,11 +12595,11 @@ const createNodeTestJobs = async (context) => {
|
|
|
12586
12595
|
script: [
|
|
12587
12596
|
`cd ${context.build.dir}`,
|
|
12588
12597
|
...((_f = (0, utils_1.ensureArrayOrNull)((_e = buildConfig.audit) === null || _e === void 0 ? void 0 : _e.command)) !== null && _f !== void 0 ? _f : [
|
|
12589
|
-
(0, packageManagerInstall_1.getDefaultAuditCommand)(packageManagerInfo),
|
|
12598
|
+
(0, packageManagerInstall_1.getDefaultAuditCommand)(packageManagerInfo, (_g = buildConfig.audit) === null || _g === void 0 ? void 0 : _g.level),
|
|
12590
12599
|
]),
|
|
12591
12600
|
],
|
|
12592
|
-
allow_failure: (
|
|
12593
|
-
...(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),
|
|
12594
12603
|
})
|
|
12595
12604
|
: null;
|
|
12596
12605
|
const lintJob = buildConfig.lint !== false
|
|
@@ -12599,20 +12608,20 @@ const createNodeTestJobs = async (context) => {
|
|
|
12599
12608
|
...base,
|
|
12600
12609
|
runnerVariables: {
|
|
12601
12610
|
...constants_1.NODE_RUNNER_BUILD_VARIABLES,
|
|
12602
|
-
...((
|
|
12611
|
+
...((_o = (_m = buildConfig.lint) === null || _m === void 0 ? void 0 : _m.runnerVariables) !== null && _o !== void 0 ? _o : {}),
|
|
12603
12612
|
},
|
|
12604
|
-
image: (
|
|
12613
|
+
image: (_q = (_p = buildConfig.lint) === null || _p === void 0 ? void 0 : _p.jobImage) !== null && _q !== void 0 ? _q : defaultImage,
|
|
12605
12614
|
caches: nodeCache,
|
|
12606
12615
|
script: [
|
|
12607
12616
|
...(0, packageManagerInstall_1.ensureNodeVersion)(context),
|
|
12608
12617
|
`cd ${context.build.dir}`,
|
|
12609
12618
|
...packageManagerInstall,
|
|
12610
|
-
...((
|
|
12619
|
+
...((_s = (0, utils_1.ensureArrayOrNull)((_r = buildConfig.lint) === null || _r === void 0 ? void 0 : _r.command)) !== null && _s !== void 0 ? _s : [
|
|
12611
12620
|
(0, runScript_1.runScript)(packageManagerInfo.type, "lint"),
|
|
12612
12621
|
]),
|
|
12613
12622
|
],
|
|
12614
|
-
allow_failure: (
|
|
12615
|
-
...(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),
|
|
12616
12625
|
})
|
|
12617
12626
|
: null;
|
|
12618
12627
|
const testJob = buildConfig.test !== false
|
|
@@ -12621,22 +12630,22 @@ const createNodeTestJobs = async (context) => {
|
|
|
12621
12630
|
...base,
|
|
12622
12631
|
runnerVariables: {
|
|
12623
12632
|
...constants_1.NODE_RUNNER_BUILD_VARIABLES,
|
|
12624
|
-
...((
|
|
12633
|
+
...((_x = (_w = buildConfig.test) === null || _w === void 0 ? void 0 : _w.runnerVariables) !== null && _x !== void 0 ? _x : {}),
|
|
12625
12634
|
},
|
|
12626
12635
|
// browser tests need a jobImage carrying the browser, e.g. the
|
|
12627
12636
|
// official playwright image (version-matched to the project)
|
|
12628
|
-
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"),
|
|
12629
12638
|
caches: nodeCache,
|
|
12630
12639
|
script: [
|
|
12631
12640
|
...(0, packageManagerInstall_1.ensureNodeVersion)(context),
|
|
12632
12641
|
`cd ${context.build.dir}`,
|
|
12633
12642
|
...packageManagerInstall,
|
|
12634
|
-
...((
|
|
12643
|
+
...((_1 = (0, utils_1.ensureArrayOrNull)((_0 = buildConfig.test) === null || _0 === void 0 ? void 0 : _0.command)) !== null && _1 !== void 0 ? _1 : [
|
|
12635
12644
|
(0, runScript_1.runScript)(packageManagerInfo.type, "test"),
|
|
12636
12645
|
]),
|
|
12637
12646
|
],
|
|
12638
|
-
allow_failure: (
|
|
12639
|
-
...(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),
|
|
12640
12649
|
})
|
|
12641
12650
|
: null;
|
|
12642
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;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;;;;;;;GAOG;AACH,MAAM,yBAAyB,GAAG,CAAC,WAAoB,EAAE,EAAE,CACzD,WAAW;IACT,CAAC,CAAC,m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C9C,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,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,OAA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AAA,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.
|