@mark1russell7/conventions 0.29.2 → 0.29.4
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/README.md +4 -0
- package/build/cli.js +1 -1
- package/build/index.d.ts +46 -27
- package/build/index.d.ts.map +1 -1
- package/build/index.js +2 -2
- package/build/{run-NWNXpkly.js → run-D9GKNsry.js} +622 -448
- package/build/run-D9GKNsry.js.map +1 -0
- package/package.json +2 -2
- package/build/run-NWNXpkly.js.map +0 -1
|
@@ -1015,6 +1015,31 @@ if (board) {
|
|
|
1015
1015
|
apply(false);
|
|
1016
1016
|
}
|
|
1017
1017
|
`;
|
|
1018
|
+
// ../site-pages/src/check/freshness.ts
|
|
1019
|
+
/**
|
|
1020
|
+
* This function gives each line `cron:` of a workflow. It is the one reader of these lines: the freshness gate and the rule `runner-budget` of conventions use it.
|
|
1021
|
+
* It skips a comment line. It reads a quoted key, a list item, a quoted value and a comment at the end of the line.
|
|
1022
|
+
*/
|
|
1023
|
+
function cronLines(workflow) {
|
|
1024
|
+
return workflow.split(/\r?\n/).flatMap((raw, index) => {
|
|
1025
|
+
const text = raw.trim().replace(/^- */, "");
|
|
1026
|
+
const key = [
|
|
1027
|
+
"cron:",
|
|
1028
|
+
"\"cron\":",
|
|
1029
|
+
"'cron':"
|
|
1030
|
+
].find((form) => text.startsWith(form));
|
|
1031
|
+
if (key === void 0) return [];
|
|
1032
|
+
const rest = text.slice(key.length);
|
|
1033
|
+
const comment = rest.search(/\s#/);
|
|
1034
|
+
const value = (comment >= 0 ? rest.slice(0, comment) : rest).trim();
|
|
1035
|
+
const quote = value.charAt(0);
|
|
1036
|
+
const quoted = value.length >= 2 && (quote === "\"" || quote === "'") && value.endsWith(quote);
|
|
1037
|
+
return [{
|
|
1038
|
+
line: index + 1,
|
|
1039
|
+
cron: quoted ? value.slice(1, -1).trim() : value
|
|
1040
|
+
}];
|
|
1041
|
+
});
|
|
1042
|
+
}
|
|
1018
1043
|
// src/rules/changelog-version.ts
|
|
1019
1044
|
/**
|
|
1020
1045
|
* The rule `changelog-version`: the top release section of the changelog of a package is not above the version of
|
|
@@ -9413,189 +9438,607 @@ const pushMainOnly = {
|
|
|
9413
9438
|
return breaks;
|
|
9414
9439
|
}
|
|
9415
9440
|
};
|
|
9416
|
-
// src/rules/
|
|
9441
|
+
// src/rules/unreleased-change.ts
|
|
9417
9442
|
/**
|
|
9418
|
-
* The rule `
|
|
9419
|
-
* that
|
|
9443
|
+
* The rule `unreleased-change`: a change does not set a version that npm has. With the option `versionEachChange`, a
|
|
9444
|
+
* change of the files that a published package ships also raises its version. Else the release skips the change.
|
|
9420
9445
|
*/
|
|
9421
|
-
/**
|
|
9422
|
-
|
|
9423
|
-
|
|
9424
|
-
|
|
9446
|
+
/** The registry of npm. */
|
|
9447
|
+
const NPM_REGISTRY = "https://registry.npmjs.org";
|
|
9448
|
+
/** The globs of the files of a package, relative to its folder, that do not ship: tests, fixtures, docs and configs. */
|
|
9449
|
+
const UNSHIPPED_FILES = [
|
|
9450
|
+
"**/*.md",
|
|
9451
|
+
"**/*.{test,spec}.*",
|
|
9452
|
+
"**/{test,tests,__tests__,fixtures,__fixtures__,__snapshots__,bench,benches,benchmarks,e2e}/**",
|
|
9453
|
+
"**/*.{bench,e2e}.*",
|
|
9454
|
+
"**/.*/**",
|
|
9455
|
+
"**/tsconfig*.json",
|
|
9456
|
+
"**/*.config.*",
|
|
9457
|
+
"docs/**",
|
|
9458
|
+
"examples/**",
|
|
9459
|
+
"scripts/**",
|
|
9460
|
+
"site/**",
|
|
9461
|
+
"LICENSE*",
|
|
9462
|
+
"pnpm-lock.yaml",
|
|
9463
|
+
"pnpm-workspace.yaml"
|
|
9464
|
+
];
|
|
9465
|
+
/** The fields of `package.json` that change what the package gives to a user. A change of the dependencies is not here. */
|
|
9466
|
+
const SHIPPED_FIELDS = [
|
|
9467
|
+
"main",
|
|
9468
|
+
"module",
|
|
9469
|
+
"types",
|
|
9470
|
+
"typings",
|
|
9471
|
+
"exports",
|
|
9472
|
+
"imports",
|
|
9473
|
+
"bin",
|
|
9474
|
+
"files",
|
|
9475
|
+
"type",
|
|
9476
|
+
"publishConfig",
|
|
9477
|
+
"sideEffects",
|
|
9478
|
+
"browser"
|
|
9479
|
+
];
|
|
9480
|
+
/** The script that `npmLookup` starts in a child process of Node, so that the rule stays synchronous. */
|
|
9481
|
+
const LOOKUP_SCRIPT = `
|
|
9482
|
+
const [registry, ...names] = process.argv.slice(1);
|
|
9483
|
+
let base = registry;
|
|
9484
|
+
while (base.endsWith("/")) base = base.slice(0, -1);
|
|
9485
|
+
Promise.all(names.map(async (name) => {
|
|
9486
|
+
try {
|
|
9487
|
+
const response = await fetch(base + "/" + name.replace("/", "%2f"), { headers: { accept: "application/json" }, signal: AbortSignal.timeout(20000) });
|
|
9488
|
+
if (response.status === 404) return [name, { versions: [] }];
|
|
9489
|
+
if (!response.ok) return [name, { error: "HTTP " + response.status }];
|
|
9490
|
+
const data = await response.json();
|
|
9491
|
+
const times = Object.fromEntries(Object.entries(data.time ?? {}).filter(([key]) => key !== "created" && key !== "modified"));
|
|
9492
|
+
return [name, { versions: [...new Set([...Object.keys(data.versions ?? {}), ...Object.keys(times)])], times, latest: data["dist-tags"]?.latest }];
|
|
9493
|
+
} catch (error) {
|
|
9494
|
+
return [name, { error: String(error && error.message ? error.message : error) }];
|
|
9495
|
+
}
|
|
9496
|
+
})).then((entries) => process.stdout.write(JSON.stringify(Object.fromEntries(entries))));
|
|
9497
|
+
`;
|
|
9498
|
+
/**
|
|
9499
|
+
* This function asks the registry for the versions of each package, in one child process of Node. A version that npm
|
|
9500
|
+
* removed stays in the answer, because npm does not accept it again.
|
|
9501
|
+
*/
|
|
9502
|
+
const npmLookup = (names, registry) => {
|
|
9503
|
+
const fail = (error) => new Map(names.map((name) => [name, { error }]));
|
|
9504
|
+
if (names.length === 0) return /* @__PURE__ */ new Map();
|
|
9505
|
+
const result = spawnSync(process.execPath, [
|
|
9506
|
+
"-e",
|
|
9507
|
+
LOOKUP_SCRIPT,
|
|
9508
|
+
registry,
|
|
9509
|
+
...names
|
|
9510
|
+
], {
|
|
9511
|
+
encoding: "utf8",
|
|
9512
|
+
timeout: 6e4,
|
|
9513
|
+
windowsHide: true
|
|
9514
|
+
});
|
|
9515
|
+
if (result.error !== void 0 || result.status !== 0) return fail(result.error?.message ?? `the lookup ended with exit code ${String(result.status)}`);
|
|
9425
9516
|
try {
|
|
9426
|
-
const
|
|
9427
|
-
|
|
9428
|
-
const commits = event.pull_request?.commits;
|
|
9429
|
-
return typeof commits === "number" ? {
|
|
9430
|
-
body,
|
|
9431
|
-
commits
|
|
9432
|
-
} : { body };
|
|
9517
|
+
const answers = JSON.parse(result.stdout);
|
|
9518
|
+
return new Map(names.map((name) => [name, answers[name] ?? { error: "no answer" }]));
|
|
9433
9519
|
} catch {
|
|
9434
|
-
return
|
|
9435
|
-
}
|
|
9436
|
-
}
|
|
9437
|
-
/** This function escapes the special characters of a regular expression. */
|
|
9438
|
-
const escape = (text) => text.replace(/[\\^$.|?*+()[\]{}]/g, "\\$&");
|
|
9439
|
-
const releaseFiles = {
|
|
9440
|
-
id: "release-files",
|
|
9441
|
-
title: "A pull request changes `.github/workflows/release.yml` or `scripts/release/` only with a `Release-Edit: <reason>` line.",
|
|
9442
|
-
reason: "The release flow publishes to npm with trusted publishing. A change of its files by a session that does not own the release can stop or break each release.",
|
|
9443
|
-
fix: "Revert the change of the release files. When the owner asked for the change, add the line `Release-Edit: <reason>` to the last commit message or to the body of the pull request. A re-run of a job reads the body of the event that started the run, so after a change of the body, push a commit.",
|
|
9444
|
-
sources: [
|
|
9445
|
-
{
|
|
9446
|
-
repo: "coeval",
|
|
9447
|
-
rule: "no-release-edit",
|
|
9448
|
-
doc: "CLAUDE.md:40"
|
|
9449
|
-
},
|
|
9450
|
-
{
|
|
9451
|
-
repo: "coeval",
|
|
9452
|
-
rule: "no-release-edits",
|
|
9453
|
-
doc: "CLAUDE.md:40"
|
|
9454
|
-
},
|
|
9455
|
-
{
|
|
9456
|
-
repo: "crawler",
|
|
9457
|
-
rule: "no-release-edit",
|
|
9458
|
-
doc: "CLAUDE.md:80"
|
|
9459
|
-
},
|
|
9460
|
-
{
|
|
9461
|
-
repo: "crawler",
|
|
9462
|
-
rule: "no-release-edits",
|
|
9463
|
-
doc: "CLAUDE.md:80"
|
|
9464
|
-
},
|
|
9465
|
-
{
|
|
9466
|
-
repo: "headroom",
|
|
9467
|
-
rule: "no-release-edits",
|
|
9468
|
-
doc: "CLAUDE.md:37"
|
|
9469
|
-
},
|
|
9470
|
-
{
|
|
9471
|
-
repo: "headroom",
|
|
9472
|
-
rule: "release-files-frozen",
|
|
9473
|
-
doc: "CLAUDE.md:37"
|
|
9474
|
-
}
|
|
9475
|
-
],
|
|
9476
|
-
options: {
|
|
9477
|
-
paths: {
|
|
9478
|
-
type: "strings",
|
|
9479
|
-
default: [".github/workflows/release.yml", "scripts/release/**"],
|
|
9480
|
-
description: "The globs of the files that the release flow owns."
|
|
9481
|
-
},
|
|
9482
|
-
trailer: {
|
|
9483
|
-
type: "string",
|
|
9484
|
-
default: "Release-Edit",
|
|
9485
|
-
description: "The key of the line that gives the reason of a change."
|
|
9486
|
-
},
|
|
9487
|
-
authors: {
|
|
9488
|
-
type: "strings",
|
|
9489
|
-
default: ["mark1russell7-release-train[bot]"],
|
|
9490
|
-
description: "The authors of the release flow. A change of the release files in commits of only these authors (the sync of the template) needs no reason."
|
|
9491
|
-
}
|
|
9492
|
-
},
|
|
9493
|
-
check(context, options) {
|
|
9494
|
-
const range = rangeOf(context);
|
|
9495
|
-
if ("skipped" in range) return range;
|
|
9496
|
-
const globs = Array.isArray(options["paths"]) ? options["paths"] : [];
|
|
9497
|
-
const changed = (context.git([
|
|
9498
|
-
"diff",
|
|
9499
|
-
"--name-only",
|
|
9500
|
-
...range.diff
|
|
9501
|
-
]) ?? "").split(/\r?\n/).filter((file) => file !== "" && matchesAny(file, globs));
|
|
9502
|
-
if (changed.length === 0) return [];
|
|
9503
|
-
const trailer = typeof options["trailer"] === "string" ? options["trailer"] : "Release-Edit";
|
|
9504
|
-
const line = new RegExp(`^${escape(trailer)}:[ \\t]*\\S`, "im");
|
|
9505
|
-
const pullRequest = pullRequestOf(context);
|
|
9506
|
-
if (line.test(pullRequest.body)) return [];
|
|
9507
|
-
if (!(pullRequest.commits === 1 && context.git([
|
|
9508
|
-
"rev-parse",
|
|
9509
|
-
"--verify",
|
|
9510
|
-
"--quiet",
|
|
9511
|
-
`${range.ends[1]}^2`
|
|
9512
|
-
]) === void 0) && context.git(["merge-base", ...range.ends]) === void 0) throw new Error(`The checkout does not have the merge base of ${range.ends.join(" and ")}, so the rule cannot read each commit of the change. Use fetch-depth 0, or the CI of the template, which deepens the checkout of a pull request to its merge base.`);
|
|
9513
|
-
const messages = context.git([
|
|
9514
|
-
"log",
|
|
9515
|
-
"--no-merges",
|
|
9516
|
-
"--format=%B",
|
|
9517
|
-
...range.log
|
|
9518
|
-
]) ?? "";
|
|
9519
|
-
if (line.test(messages)) return [];
|
|
9520
|
-
const authors = new Set(Array.isArray(options["authors"]) ? options["authors"] : []);
|
|
9521
|
-
const changers = (context.git([
|
|
9522
|
-
"log",
|
|
9523
|
-
"--no-merges",
|
|
9524
|
-
"--format=%an",
|
|
9525
|
-
...range.log,
|
|
9526
|
-
"--",
|
|
9527
|
-
...changed
|
|
9528
|
-
]) ?? "").split(/\r?\n/).filter((name) => name !== "");
|
|
9529
|
-
if (changers.length > 0 && changers.every((name) => authors.has(name))) return [];
|
|
9530
|
-
return changed.map((file) => ({
|
|
9531
|
-
file,
|
|
9532
|
-
message: `The change edits ${file}, a file of the release flow, with no "${trailer}: <reason>" line.`
|
|
9533
|
-
}));
|
|
9520
|
+
return fail("the lookup gave no JSON");
|
|
9534
9521
|
}
|
|
9535
9522
|
};
|
|
9536
|
-
|
|
9537
|
-
|
|
9538
|
-
|
|
9539
|
-
|
|
9540
|
-
/** The package of the STE linter. */
|
|
9541
|
-
const STE_LINT = "@mark1russell7/ste-lint";
|
|
9542
|
-
/** The configuration file of the STE linter. */
|
|
9543
|
-
const STE_CONFIG = "ste.config.json";
|
|
9544
|
-
/** The examples of the scripts that the fix shows. */
|
|
9545
|
-
const EXAMPLES = {
|
|
9546
|
-
"lint:ste": "ste-lint",
|
|
9547
|
-
typecheck: "pnpm -r run typecheck"
|
|
9523
|
+
/** This function gives the strings of a field of `package.json` that is a list of strings. */
|
|
9524
|
+
const stringsOf = (manifest, field) => {
|
|
9525
|
+
const value = manifest[field];
|
|
9526
|
+
return Array.isArray(value) ? value.filter((item) => typeof item === "string") : [];
|
|
9548
9527
|
};
|
|
9549
|
-
/**
|
|
9550
|
-
|
|
9551
|
-
|
|
9552
|
-
|
|
9553
|
-
|
|
9554
|
-
|
|
9555
|
-
|
|
9556
|
-
|
|
9528
|
+
/** This function tells if a path relative to the root is in the folder `folder`. The root is `""`. */
|
|
9529
|
+
const inside = (folder, path) => folder === "" || path.startsWith(`${folder}/`);
|
|
9530
|
+
/** This function gives the globs of an entry of the field `files`: the entry, and each path under it. */
|
|
9531
|
+
const entryGlobs = (entry) => {
|
|
9532
|
+
let glob = cleanPath(entry);
|
|
9533
|
+
while (glob.endsWith("/")) glob = glob.slice(0, -1);
|
|
9534
|
+
return [glob, `${glob}/**`];
|
|
9535
|
+
};
|
|
9536
|
+
/** This function reads the manifest of the text of a `package.json` file, or gives undefined. */
|
|
9537
|
+
function parseManifest(text) {
|
|
9538
|
+
if (text === void 0) return void 0;
|
|
9539
|
+
try {
|
|
9540
|
+
const parsed = JSON.parse(text);
|
|
9541
|
+
return typeof parsed === "object" && parsed !== null && !Array.isArray(parsed) ? parsed : void 0;
|
|
9542
|
+
} catch {
|
|
9543
|
+
return;
|
|
9544
|
+
}
|
|
9557
9545
|
}
|
|
9558
|
-
|
|
9559
|
-
|
|
9560
|
-
|
|
9561
|
-
|
|
9562
|
-
|
|
9563
|
-
|
|
9564
|
-
|
|
9565
|
-
|
|
9566
|
-
|
|
9567
|
-
|
|
9568
|
-
|
|
9569
|
-
|
|
9570
|
-
|
|
9571
|
-
|
|
9572
|
-
|
|
9573
|
-
|
|
9574
|
-
|
|
9575
|
-
|
|
9576
|
-
|
|
9577
|
-
|
|
9546
|
+
/** This function tells if a version is a placeholder before the first release: `0.0.0` or `0.0.0-<stage>`. */
|
|
9547
|
+
const isPlaceholder = (version) => /^0\.0\.0(?:[-+].*)?$/.test(version);
|
|
9548
|
+
/** The published packages of the repository: the root package and the code packages that are not private and have a name and a version. */
|
|
9549
|
+
function publishedOf(context) {
|
|
9550
|
+
const all = [context.rootPackage, ...codePackages(context)];
|
|
9551
|
+
return all.filter((pkg, index) => all.findIndex((other) => other.file === pkg.file) === index).filter((pkg) => pkg.manifest["private"] !== true && typeof pkg.manifest["name"] === "string" && typeof pkg.manifest["version"] === "string");
|
|
9552
|
+
}
|
|
9553
|
+
/** This function gives the time of the push in milliseconds, from the field `repository.pushed_at` of the event file. */
|
|
9554
|
+
function pushedAt(context) {
|
|
9555
|
+
const file = context.env["GITHUB_EVENT_PATH"];
|
|
9556
|
+
if (file === void 0 || file === "" || !existsSync(file)) return void 0;
|
|
9557
|
+
try {
|
|
9558
|
+
const value = JSON.parse(readFileSync(file, "utf8")).repository?.pushed_at;
|
|
9559
|
+
if (typeof value === "number") return value * 1e3;
|
|
9560
|
+
return typeof value === "string" && !Number.isNaN(Date.parse(value)) ? Date.parse(value) : void 0;
|
|
9561
|
+
} catch {
|
|
9562
|
+
return;
|
|
9563
|
+
}
|
|
9564
|
+
}
|
|
9565
|
+
/** This function gives the shipped files of `pkg` in the list `changed`, relative to the folder of the package. */
|
|
9566
|
+
function shippedFiles(pkg, changed, before, context, unshipped, fields) {
|
|
9567
|
+
const folders = context.packages.map((other) => other.folder).filter((folder) => folder !== "");
|
|
9568
|
+
const own = (path) => inside(pkg.folder, path) && (pkg.folder !== "" || !folders.some((folder) => inside(folder, path)));
|
|
9569
|
+
const relative = (path) => pkg.folder === "" ? path : path.slice(pkg.folder.length + 1);
|
|
9570
|
+
const entries = stringsOf(pkg.manifest, "files");
|
|
9571
|
+
const positive = entries.filter((entry) => !entry.startsWith("!"));
|
|
9572
|
+
const negative = entries.filter((entry) => entry.startsWith("!")).flatMap((entry) => entryGlobs(entry.slice(1)));
|
|
9573
|
+
const ownTracked = (context.gitFiles() ?? []).filter(own).map(relative);
|
|
9574
|
+
const whitelist = positive.length > 0 && positive.every((entry) => ownTracked.some((path) => matchesAny(path, entryGlobs(entry))));
|
|
9575
|
+
const ships = (path) => path !== "package.json" && !matchesAny(path, unshipped) && (!whitelist || positive.some((entry) => matchesAny(path, entryGlobs(entry))) && !matchesAny(path, negative));
|
|
9576
|
+
const files = changed.filter(own).map(relative).filter(ships);
|
|
9577
|
+
if (changed.includes(pkg.file) && before !== void 0 && fields.some((field) => JSON.stringify(before[field]) !== JSON.stringify(pkg.manifest[field]))) files.push("package.json");
|
|
9578
|
+
return files;
|
|
9579
|
+
}
|
|
9580
|
+
/** This function makes the rule with the registry lookup `lookup`. The tests give a fake lookup. */
|
|
9581
|
+
function unreleasedChangeRule(lookup = npmLookup) {
|
|
9582
|
+
return {
|
|
9583
|
+
id: "unreleased-change",
|
|
9584
|
+
changeScoped: true,
|
|
9585
|
+
title: "A change does not set a version that npm has. With `versionEachChange`, a change of the shipped files also raises the version.",
|
|
9586
|
+
reason: "The release workflow publishes each version that npm does not have, and it skips the others. When two pull requests set the same version, the second merge changes the code but no version, and nothing fails (rigor #18 and #20, 2026-11-02).",
|
|
9587
|
+
fix: "Raise the version of the package in a pull request to a version that npm does not have, with the SemVer rules (RELEASING.md). Then the release workflow publishes the change.",
|
|
9588
|
+
sources: [{
|
|
9589
|
+
repo: "rigor",
|
|
9590
|
+
rule: "unreleased-change",
|
|
9591
|
+
doc: "pull requests #18 and #20 (2026-11-02): two pull requests set the same version"
|
|
9592
|
+
}, ...[
|
|
9593
|
+
"crawler",
|
|
9594
|
+
"coeval",
|
|
9595
|
+
"template"
|
|
9596
|
+
].map((repo) => ({
|
|
9597
|
+
repo,
|
|
9598
|
+
rule: "unreleased-change",
|
|
9599
|
+
doc: ".github/workflows/release.yml (it starts on a change of a version, and it skips each version that npm has)"
|
|
9600
|
+
}))],
|
|
9601
|
+
options: {
|
|
9602
|
+
versionEachChange: {
|
|
9603
|
+
type: "boolean",
|
|
9604
|
+
default: false,
|
|
9605
|
+
description: "True when each pull request sets its version: a change of the shipped files with a version that npm has breaks, also on a push. False when a separate pull request raises the version."
|
|
9606
|
+
},
|
|
9607
|
+
unshipped: {
|
|
9608
|
+
type: "strings",
|
|
9609
|
+
default: UNSHIPPED_FILES,
|
|
9610
|
+
description: "With `versionEachChange`: the globs of the files of a package, relative to its folder, that do not ship."
|
|
9611
|
+
},
|
|
9612
|
+
fields: {
|
|
9613
|
+
type: "strings",
|
|
9614
|
+
default: SHIPPED_FIELDS,
|
|
9615
|
+
description: "With `versionEachChange`: the fields of `package.json` whose change ships. The dependencies are not in the default list."
|
|
9616
|
+
},
|
|
9617
|
+
registry: {
|
|
9618
|
+
type: "string",
|
|
9619
|
+
default: NPM_REGISTRY,
|
|
9620
|
+
description: "The URL of the registry that has the versions."
|
|
9621
|
+
}
|
|
9578
9622
|
},
|
|
9579
|
-
{
|
|
9623
|
+
check(context, options) {
|
|
9624
|
+
if (hasFile(context.root, ".changeset/config.json")) return { skipped: "the repository uses Changesets: the changesets raise the versions, and the changeset check examines them" };
|
|
9625
|
+
const published = publishedOf(context).filter((pkg) => !isPlaceholder(String(pkg.manifest["version"])));
|
|
9626
|
+
if (published.length === 0) return { skipped: "the repository has no published package with a release version" };
|
|
9627
|
+
const range = rangeOf(context, { push: true });
|
|
9628
|
+
if ("skipped" in range) return range;
|
|
9629
|
+
const strict = options["versionEachChange"] === true;
|
|
9630
|
+
const push = context.base === void 0 && context.env["GITHUB_EVENT_NAME"] === "push";
|
|
9631
|
+
const out = strict ? context.git([
|
|
9632
|
+
"diff",
|
|
9633
|
+
"--name-only",
|
|
9634
|
+
"--no-renames",
|
|
9635
|
+
...range.diff
|
|
9636
|
+
]) : "";
|
|
9637
|
+
if (out === void 0) return { skipped: "git cannot give the changed files of the change" };
|
|
9638
|
+
const changed = out.split(/\r?\n/).filter((file) => file !== "");
|
|
9639
|
+
const unshipped = Array.isArray(options["unshipped"]) ? options["unshipped"] : UNSHIPPED_FILES;
|
|
9640
|
+
const fields = Array.isArray(options["fields"]) ? options["fields"] : SHIPPED_FIELDS;
|
|
9641
|
+
const registry = typeof options["registry"] === "string" ? options["registry"] : NPM_REGISTRY;
|
|
9642
|
+
const fork = push ? range.ends[0] : context.git(["merge-base", ...range.ends])?.trim();
|
|
9643
|
+
const notes = [];
|
|
9644
|
+
if (fork === void 0) notes.push(`the checkout does not have the merge base of ${range.ends.join(" and ")}, so the rule cannot tell if the change sets a version`);
|
|
9645
|
+
const manifestAt = (ref, pkg) => ref === "HEAD" ? pkg.manifest : parseManifest(context.git(["show", `${ref}:${pkg.file}`]));
|
|
9646
|
+
const versionOf = (manifest) => typeof manifest?.["version"] === "string" ? manifest["version"] : void 0;
|
|
9647
|
+
const candidates = [];
|
|
9648
|
+
for (const pkg of published) {
|
|
9649
|
+
const atStart = manifestAt(range.ends[0], pkg);
|
|
9650
|
+
const set = versionOf(manifestAt(range.ends[1], pkg));
|
|
9651
|
+
const before = fork === void 0 ? void 0 : versionOf(fork === range.ends[0] ? atStart : manifestAt(fork, pkg));
|
|
9652
|
+
const sets = fork !== void 0 && set !== void 0 && !isPlaceholder(set) && set !== before ? set : void 0;
|
|
9653
|
+
const files = strict ? shippedFiles(pkg, changed, atStart, context, unshipped, fields) : [];
|
|
9654
|
+
if (sets === void 0 && files.length === 0) continue;
|
|
9655
|
+
candidates.push({
|
|
9656
|
+
pkg,
|
|
9657
|
+
name: String(pkg.manifest["name"]),
|
|
9658
|
+
version: String(pkg.manifest["version"]),
|
|
9659
|
+
sets,
|
|
9660
|
+
start: versionOf(atStart),
|
|
9661
|
+
files
|
|
9662
|
+
});
|
|
9663
|
+
}
|
|
9664
|
+
if (candidates.length === 0) return notes.length > 0 ? { skipped: notes.join("; ") } : [];
|
|
9665
|
+
const answers = lookup(candidates.map((candidate) => candidate.name), registry);
|
|
9666
|
+
const pushTime = push ? pushedAt(context) : void 0;
|
|
9667
|
+
const breaks = [];
|
|
9668
|
+
for (const candidate of candidates) {
|
|
9669
|
+
const answer = answers.get(candidate.name) ?? { error: "no answer" };
|
|
9670
|
+
if ("error" in answer) {
|
|
9671
|
+
notes.push(`the registry did not answer for ${candidate.name}: ${answer.error}`);
|
|
9672
|
+
continue;
|
|
9673
|
+
}
|
|
9674
|
+
const line = lineOf(candidate.pkg.text, "\"version\"");
|
|
9675
|
+
const at = {
|
|
9676
|
+
file: candidate.pkg.file,
|
|
9677
|
+
...line === void 0 ? {} : { line }
|
|
9678
|
+
};
|
|
9679
|
+
if (candidate.sets !== void 0) {
|
|
9680
|
+
const sets = candidate.sets;
|
|
9681
|
+
if (!answer.versions.includes(sets)) continue;
|
|
9682
|
+
if (push) {
|
|
9683
|
+
const time = Date.parse(answer.times?.[sets] ?? "");
|
|
9684
|
+
if (pushTime === void 0 || Number.isNaN(time)) {
|
|
9685
|
+
notes.push(`the rule cannot tell if npm had ${candidate.name}@${sets} before the push`);
|
|
9686
|
+
continue;
|
|
9687
|
+
}
|
|
9688
|
+
if (time >= pushTime) continue;
|
|
9689
|
+
}
|
|
9690
|
+
breaks.push({
|
|
9691
|
+
...at,
|
|
9692
|
+
message: `${candidate.name}: the change sets the version ${sets}, but ${sets} is on npm already. Raise the version (SemVer) in a pull request.`
|
|
9693
|
+
});
|
|
9694
|
+
} else if (strict && candidate.files.length > 0 && candidate.start === candidate.version && answer.versions.includes(candidate.version)) {
|
|
9695
|
+
const shown = candidate.files.slice(0, 3).map((file) => candidate.pkg.folder === "" ? file : `${candidate.pkg.folder}/${file}`);
|
|
9696
|
+
const more = candidate.files.length > shown.length ? ` and ${String(candidate.files.length - shown.length)} more` : "";
|
|
9697
|
+
breaks.push({
|
|
9698
|
+
...at,
|
|
9699
|
+
message: `${candidate.name}: the change is not released, because ${candidate.version} is on npm already. Raise the version (SemVer) in a pull request. The change ships ${shown.join(", ")}${more}.`
|
|
9700
|
+
});
|
|
9701
|
+
}
|
|
9702
|
+
}
|
|
9703
|
+
if (breaks.length === 0 && notes.length > 0) return { skipped: notes.join("; ") };
|
|
9704
|
+
return breaks;
|
|
9705
|
+
}
|
|
9706
|
+
};
|
|
9707
|
+
}
|
|
9708
|
+
const unreleasedChange = unreleasedChangeRule();
|
|
9709
|
+
// src/rules/published-minor.ts
|
|
9710
|
+
/**
|
|
9711
|
+
* The rule `published-minor`: a consumer does not stay behind the newest published minor of a package that the option
|
|
9712
|
+
* `packages` names. A caret range of a `0.x` version cannot reach the next minor, so such a consumer stays behind with
|
|
9713
|
+
* no failure. The lockfile can also hold an old version that the range admits.
|
|
9714
|
+
*/
|
|
9715
|
+
/** This function gives the major and the minor of a release version, or undefined for a pre-release and for other text. */
|
|
9716
|
+
function minorOf(version) {
|
|
9717
|
+
const release = version.trim().split("(", 1)[0]?.split("+", 1)[0] ?? "";
|
|
9718
|
+
const match = /^(\d+)\.(\d+)\.\d+$/.exec(release);
|
|
9719
|
+
return match === null ? void 0 : [Number(match[1]), Number(match[2])];
|
|
9720
|
+
}
|
|
9721
|
+
/**
|
|
9722
|
+
* This function gives the highest minor that a range can reach. It gives undefined for a form that the rule does not read.
|
|
9723
|
+
* These forms are a `workspace:` or `github:` specifier, a tag, a partial version and a compound range. Below `1.0.0`, a caret stays in
|
|
9724
|
+
* its minor. From `1.0.0`, a caret reaches each minor of its major.
|
|
9725
|
+
*/
|
|
9726
|
+
function reachOf(specifier) {
|
|
9727
|
+
const match = /^([\^~]?)(\d+)\.(\d+)\.\d+(?:[-+].*)?$/.exec(specifier.trim());
|
|
9728
|
+
if (match === null) return void 0;
|
|
9729
|
+
const major = Number(match[2]);
|
|
9730
|
+
return match[1] === "^" && major > 0 ? [major, Number.POSITIVE_INFINITY] : [major, Number(match[3])];
|
|
9731
|
+
}
|
|
9732
|
+
/** This function tells if the minor `have` is before the minor `other`. */
|
|
9733
|
+
const behind = (have, other) => have[0] < other[0] || have[0] === other[0] && have[1] < other[1];
|
|
9734
|
+
/** This function gives the indent, the key and the value of one line of YAML. It cuts the line by position, with no pattern. */
|
|
9735
|
+
function yamlEntry(line) {
|
|
9736
|
+
const text = line.trimEnd();
|
|
9737
|
+
const body = text.trimStart();
|
|
9738
|
+
const colon = body.indexOf(": ");
|
|
9739
|
+
const key = colon >= 0 ? body.slice(0, colon) : body.endsWith(":") ? body.slice(0, -1) : "";
|
|
9740
|
+
return key === "" ? void 0 : {
|
|
9741
|
+
indent: text.length - body.length,
|
|
9742
|
+
key,
|
|
9743
|
+
value: colon >= 0 ? body.slice(colon + 2) : ""
|
|
9744
|
+
};
|
|
9745
|
+
}
|
|
9746
|
+
/**
|
|
9747
|
+
* This function gives the locked version of each dependency of each importer of the text of a `pnpm-lock.yaml` file. The
|
|
9748
|
+
* key of the outer map is the folder of the importer, with `""` for the root.
|
|
9749
|
+
*/
|
|
9750
|
+
function lockedVersions(text) {
|
|
9751
|
+
const importers = /* @__PURE__ */ new Map();
|
|
9752
|
+
let inside = false;
|
|
9753
|
+
let importer;
|
|
9754
|
+
let name;
|
|
9755
|
+
for (const line of text.split(/\r?\n/)) {
|
|
9756
|
+
if (/^\S/.test(line)) inside = line.trimEnd() === "importers:";
|
|
9757
|
+
if (!inside) continue;
|
|
9758
|
+
const entry = yamlEntry(line);
|
|
9759
|
+
if (entry === void 0) continue;
|
|
9760
|
+
const { indent, value } = entry;
|
|
9761
|
+
const key = entry.key.replace(/^['"]|['"]$/g, "");
|
|
9762
|
+
if (indent === 2) {
|
|
9763
|
+
importer = /* @__PURE__ */ new Map();
|
|
9764
|
+
importers.set(key === "." ? "" : key, importer);
|
|
9765
|
+
} else if (indent === 6) name = key;
|
|
9766
|
+
else if (indent === 8 && key === "version" && name !== void 0) importer?.set(name, value);
|
|
9767
|
+
}
|
|
9768
|
+
return importers;
|
|
9769
|
+
}
|
|
9770
|
+
/** This function gives the time in milliseconds of the first release that `have` is behind, or undefined when npm gives no time. */
|
|
9771
|
+
function firstAhead(answer, have) {
|
|
9772
|
+
const times = Object.entries(answer.times ?? {}).flatMap(([version, time]) => {
|
|
9773
|
+
const minor = minorOf(version);
|
|
9774
|
+
return minor !== void 0 && behind(have, minor) && !Number.isNaN(Date.parse(time)) ? [Date.parse(time)] : [];
|
|
9775
|
+
});
|
|
9776
|
+
return times.length === 0 ? void 0 : Math.min(...times);
|
|
9777
|
+
}
|
|
9778
|
+
/** This function makes the rule with the registry lookup `lookup` and the clock `now`. The tests give fakes. */
|
|
9779
|
+
function publishedMinorRule(lookup = npmLookup, now = Date.now) {
|
|
9780
|
+
return {
|
|
9781
|
+
id: "published-minor",
|
|
9782
|
+
title: "A consumer does not stay behind the newest published minor of a package that the option `packages` names.",
|
|
9783
|
+
reason: "A caret range of a 0.x version cannot reach the next minor, and a lockfile can hold an old version that a range admits. A test that holds the choices of today does not show it, so a consumer can stay behind for many releases with no failure.",
|
|
9784
|
+
fix: "Raise the range of the dependency to the newest published minor, and update the lockfile. Read the changes of the release first.",
|
|
9785
|
+
sources: [{
|
|
9580
9786
|
repo: "private",
|
|
9581
|
-
rule: "
|
|
9582
|
-
doc: "
|
|
9787
|
+
rule: "published-minor",
|
|
9788
|
+
doc: "docs/STRATEGY.md (2026-11-04, a consumer behind a published minor)"
|
|
9789
|
+
}],
|
|
9790
|
+
options: {
|
|
9791
|
+
packages: {
|
|
9792
|
+
type: "strings",
|
|
9793
|
+
default: [],
|
|
9794
|
+
description: "The patterns of the package names that the rule examines, for example `@scope/*`. With no pattern, the rule does not start."
|
|
9795
|
+
},
|
|
9796
|
+
graceDays: {
|
|
9797
|
+
type: "number",
|
|
9798
|
+
default: 0,
|
|
9799
|
+
description: "The days that a consumer has, from the first publish of a minor that it does not have."
|
|
9800
|
+
},
|
|
9801
|
+
registry: {
|
|
9802
|
+
type: "string",
|
|
9803
|
+
default: NPM_REGISTRY,
|
|
9804
|
+
description: "The URL of the registry that has the versions."
|
|
9805
|
+
}
|
|
9583
9806
|
},
|
|
9807
|
+
check(context, options) {
|
|
9808
|
+
const patterns = Array.isArray(options["packages"]) ? options["packages"] : [];
|
|
9809
|
+
if (patterns.length === 0) return { skipped: "the option `packages` names no package" };
|
|
9810
|
+
const all = [context.rootPackage, ...context.packages];
|
|
9811
|
+
const consumers = all.filter((pkg, index) => all.findIndex((other) => other.file === pkg.file) === index);
|
|
9812
|
+
const uses = [];
|
|
9813
|
+
for (const pkg of consumers) for (const field of DEPENDENCY_FIELDS) for (const [name, specifier] of specifiersOf(pkg.manifest, field)) {
|
|
9814
|
+
const reach = reachOf(specifier);
|
|
9815
|
+
if (reach !== void 0 && matchesAny(name, patterns)) uses.push({
|
|
9816
|
+
pkg,
|
|
9817
|
+
field,
|
|
9818
|
+
name,
|
|
9819
|
+
reach
|
|
9820
|
+
});
|
|
9821
|
+
}
|
|
9822
|
+
if (uses.length === 0) return { skipped: "no dependency has a range and a name that the option `packages` names" };
|
|
9823
|
+
const answers = lookup([...new Set(uses.map((use) => use.name))], typeof options["registry"] === "string" ? options["registry"] : NPM_REGISTRY);
|
|
9824
|
+
const locked = hasFile(context.root, "pnpm-lock.yaml") ? lockedVersions(readFileSync(join(context.root, "pnpm-lock.yaml"), "utf8")) : /* @__PURE__ */ new Map();
|
|
9825
|
+
const grace = (typeof options["graceDays"] === "number" ? options["graceDays"] : 0) * 864e5;
|
|
9826
|
+
const breaks = [];
|
|
9827
|
+
const notes = /* @__PURE__ */ new Set();
|
|
9828
|
+
for (const { pkg, field, name, reach } of uses) {
|
|
9829
|
+
const answer = answers.get(name) ?? { error: "no answer" };
|
|
9830
|
+
if ("error" in answer) {
|
|
9831
|
+
notes.add(`the registry did not answer for ${name}: ${answer.error}`);
|
|
9832
|
+
continue;
|
|
9833
|
+
}
|
|
9834
|
+
const latest = answer.latest === void 0 ? void 0 : minorOf(answer.latest);
|
|
9835
|
+
if (latest === void 0) continue;
|
|
9836
|
+
const version = locked.get(pkg.folder)?.get(name);
|
|
9837
|
+
const lockMinor = version === void 0 ? void 0 : minorOf(version);
|
|
9838
|
+
const have = behind(reach, latest) ? reach : lockMinor;
|
|
9839
|
+
if (have === void 0 || !behind(have, latest)) continue;
|
|
9840
|
+
const since = firstAhead(answer, have);
|
|
9841
|
+
if (grace > 0 && since !== void 0 && now() - since < grace) continue;
|
|
9842
|
+
const line = keyLine(pkg.text, field, name);
|
|
9843
|
+
const at = {
|
|
9844
|
+
file: pkg.file,
|
|
9845
|
+
...line === void 0 ? {} : { line }
|
|
9846
|
+
};
|
|
9847
|
+
const message = have === reach ? `${name}: the range in ${field} cannot reach ${String(answer.latest)}, the newest version on npm. Raise the range.` : `${name}: the lockfile holds ${String(version)}, and npm has ${String(answer.latest)}. Update the lockfile.`;
|
|
9848
|
+
breaks.push({
|
|
9849
|
+
...at,
|
|
9850
|
+
message
|
|
9851
|
+
});
|
|
9852
|
+
}
|
|
9853
|
+
if (breaks.length === 0 && notes.size > 0) return { skipped: [...notes].join("; ") };
|
|
9854
|
+
return breaks;
|
|
9855
|
+
}
|
|
9856
|
+
};
|
|
9857
|
+
}
|
|
9858
|
+
const publishedMinor = publishedMinorRule();
|
|
9859
|
+
// src/rules/release-files.ts
|
|
9860
|
+
/**
|
|
9861
|
+
* The rule `release-files`: a pull request changes a file of the release flow only with a reason
|
|
9862
|
+
* that everyone can see.
|
|
9863
|
+
*/
|
|
9864
|
+
/** This function gives the pull request of the event file of GitHub Actions. With no event file, the body is empty. */
|
|
9865
|
+
function pullRequestOf(context) {
|
|
9866
|
+
const file = context.env["GITHUB_EVENT_PATH"];
|
|
9867
|
+
if (file === void 0 || file === "" || !existsSync(file)) return { body: "" };
|
|
9868
|
+
try {
|
|
9869
|
+
const event = JSON.parse(readFileSync(file, "utf8"));
|
|
9870
|
+
const body = typeof event.pull_request?.body === "string" ? event.pull_request.body : "";
|
|
9871
|
+
const commits = event.pull_request?.commits;
|
|
9872
|
+
return typeof commits === "number" ? {
|
|
9873
|
+
body,
|
|
9874
|
+
commits
|
|
9875
|
+
} : { body };
|
|
9876
|
+
} catch {
|
|
9877
|
+
return { body: "" };
|
|
9878
|
+
}
|
|
9879
|
+
}
|
|
9880
|
+
/** This function escapes the special characters of a regular expression. */
|
|
9881
|
+
const escape = (text) => text.replace(/[\\^$.|?*+()[\]{}]/g, "\\$&");
|
|
9882
|
+
const releaseFiles = {
|
|
9883
|
+
id: "release-files",
|
|
9884
|
+
title: "A pull request changes `.github/workflows/release.yml` or `scripts/release/` only with a `Release-Edit: <reason>` line.",
|
|
9885
|
+
reason: "The release flow publishes to npm with trusted publishing. A change of its files by a session that does not own the release can stop or break each release.",
|
|
9886
|
+
fix: "Revert the change of the release files. When the owner asked for the change, add the line `Release-Edit: <reason>` to the last commit message or to the body of the pull request. A re-run of a job reads the body of the event that started the run, so after a change of the body, push a commit.",
|
|
9887
|
+
sources: [
|
|
9584
9888
|
{
|
|
9585
|
-
repo: "
|
|
9586
|
-
rule: "
|
|
9587
|
-
doc: "CLAUDE.md:
|
|
9889
|
+
repo: "coeval",
|
|
9890
|
+
rule: "no-release-edit",
|
|
9891
|
+
doc: "CLAUDE.md:40"
|
|
9588
9892
|
},
|
|
9589
9893
|
{
|
|
9590
|
-
repo: "
|
|
9591
|
-
rule: "
|
|
9592
|
-
doc: "CLAUDE.md:
|
|
9894
|
+
repo: "coeval",
|
|
9895
|
+
rule: "no-release-edits",
|
|
9896
|
+
doc: "CLAUDE.md:40"
|
|
9593
9897
|
},
|
|
9594
9898
|
{
|
|
9595
|
-
repo: "
|
|
9596
|
-
rule: "
|
|
9597
|
-
doc: "CLAUDE.md:
|
|
9598
|
-
},
|
|
9899
|
+
repo: "crawler",
|
|
9900
|
+
rule: "no-release-edit",
|
|
9901
|
+
doc: "CLAUDE.md:80"
|
|
9902
|
+
},
|
|
9903
|
+
{
|
|
9904
|
+
repo: "crawler",
|
|
9905
|
+
rule: "no-release-edits",
|
|
9906
|
+
doc: "CLAUDE.md:80"
|
|
9907
|
+
},
|
|
9908
|
+
{
|
|
9909
|
+
repo: "headroom",
|
|
9910
|
+
rule: "no-release-edits",
|
|
9911
|
+
doc: "CLAUDE.md:37"
|
|
9912
|
+
},
|
|
9913
|
+
{
|
|
9914
|
+
repo: "headroom",
|
|
9915
|
+
rule: "release-files-frozen",
|
|
9916
|
+
doc: "CLAUDE.md:37"
|
|
9917
|
+
}
|
|
9918
|
+
],
|
|
9919
|
+
options: {
|
|
9920
|
+
paths: {
|
|
9921
|
+
type: "strings",
|
|
9922
|
+
default: [".github/workflows/release.yml", "scripts/release/**"],
|
|
9923
|
+
description: "The globs of the files that the release flow owns."
|
|
9924
|
+
},
|
|
9925
|
+
trailer: {
|
|
9926
|
+
type: "string",
|
|
9927
|
+
default: "Release-Edit",
|
|
9928
|
+
description: "The key of the line that gives the reason of a change."
|
|
9929
|
+
},
|
|
9930
|
+
authors: {
|
|
9931
|
+
type: "strings",
|
|
9932
|
+
default: ["mark1russell7-release-train[bot]"],
|
|
9933
|
+
description: "The authors of the release flow. A change of the release files in commits of only these authors (the sync of the template) needs no reason."
|
|
9934
|
+
}
|
|
9935
|
+
},
|
|
9936
|
+
check(context, options) {
|
|
9937
|
+
const range = rangeOf(context);
|
|
9938
|
+
if ("skipped" in range) return range;
|
|
9939
|
+
const globs = Array.isArray(options["paths"]) ? options["paths"] : [];
|
|
9940
|
+
const changed = (context.git([
|
|
9941
|
+
"diff",
|
|
9942
|
+
"--name-only",
|
|
9943
|
+
...range.diff
|
|
9944
|
+
]) ?? "").split(/\r?\n/).filter((file) => file !== "" && matchesAny(file, globs));
|
|
9945
|
+
if (changed.length === 0) return [];
|
|
9946
|
+
const trailer = typeof options["trailer"] === "string" ? options["trailer"] : "Release-Edit";
|
|
9947
|
+
const line = new RegExp(`^${escape(trailer)}:[ \\t]*\\S`, "im");
|
|
9948
|
+
const pullRequest = pullRequestOf(context);
|
|
9949
|
+
if (line.test(pullRequest.body)) return [];
|
|
9950
|
+
if (!(pullRequest.commits === 1 && context.git([
|
|
9951
|
+
"rev-parse",
|
|
9952
|
+
"--verify",
|
|
9953
|
+
"--quiet",
|
|
9954
|
+
`${range.ends[1]}^2`
|
|
9955
|
+
]) === void 0) && context.git(["merge-base", ...range.ends]) === void 0) throw new Error(`The checkout does not have the merge base of ${range.ends.join(" and ")}, so the rule cannot read each commit of the change. Use fetch-depth 0, or the CI of the template, which deepens the checkout of a pull request to its merge base.`);
|
|
9956
|
+
const messages = context.git([
|
|
9957
|
+
"log",
|
|
9958
|
+
"--no-merges",
|
|
9959
|
+
"--format=%B",
|
|
9960
|
+
...range.log
|
|
9961
|
+
]) ?? "";
|
|
9962
|
+
if (line.test(messages)) return [];
|
|
9963
|
+
const authors = new Set(Array.isArray(options["authors"]) ? options["authors"] : []);
|
|
9964
|
+
const changers = (context.git([
|
|
9965
|
+
"log",
|
|
9966
|
+
"--no-merges",
|
|
9967
|
+
"--format=%an",
|
|
9968
|
+
...range.log,
|
|
9969
|
+
"--",
|
|
9970
|
+
...changed
|
|
9971
|
+
]) ?? "").split(/\r?\n/).filter((name) => name !== "");
|
|
9972
|
+
if (changers.length > 0 && changers.every((name) => authors.has(name))) return [];
|
|
9973
|
+
return changed.map((file) => ({
|
|
9974
|
+
file,
|
|
9975
|
+
message: `The change edits ${file}, a file of the release flow, with no "${trailer}: <reason>" line.`
|
|
9976
|
+
}));
|
|
9977
|
+
}
|
|
9978
|
+
};
|
|
9979
|
+
// src/rules/required-scripts.ts
|
|
9980
|
+
/**
|
|
9981
|
+
* The rule `required-scripts`: the root `package.json` keeps the scripts that the shared CI starts.
|
|
9982
|
+
*/
|
|
9983
|
+
/** The package of the STE linter. */
|
|
9984
|
+
const STE_LINT = "@mark1russell7/ste-lint";
|
|
9985
|
+
/** The configuration file of the STE linter. */
|
|
9986
|
+
const STE_CONFIG = "ste.config.json";
|
|
9987
|
+
/** The examples of the scripts that the fix shows. */
|
|
9988
|
+
const EXAMPLES = {
|
|
9989
|
+
"lint:ste": "ste-lint",
|
|
9990
|
+
typecheck: "pnpm -r run typecheck"
|
|
9991
|
+
};
|
|
9992
|
+
/**
|
|
9993
|
+
* This function tells if the repository uses the STE prose standard: the root `package.json` has a
|
|
9994
|
+
* dependency on `@mark1russell7/ste-lint`, or the root has a `ste.config.json`.
|
|
9995
|
+
*/
|
|
9996
|
+
function usesSteLint(context) {
|
|
9997
|
+
const manifest = context.rootPackage.manifest;
|
|
9998
|
+
if (DEPENDENCY_FIELDS.some((field) => specifiersOf(manifest, field).some(([name]) => name === STE_LINT))) return true;
|
|
9999
|
+
return hasFile(context.root, STE_CONFIG);
|
|
10000
|
+
}
|
|
10001
|
+
const requiredScripts = {
|
|
10002
|
+
id: "required-scripts",
|
|
10003
|
+
title: "The root `package.json` has the script `typecheck`, and also `lint:ste` when the repository uses `ste-lint`.",
|
|
10004
|
+
reason: "The shared CI starts each script of its list that `package.json` has, and it skips the others. Thus a removed script turns its check off, and nothing shows it.",
|
|
10005
|
+
fix: "Add the script, for example `\"lint:ste\": \"ste-lint\"` or `\"typecheck\": \"pnpm -r run typecheck\"`.",
|
|
10006
|
+
sources: [
|
|
10007
|
+
{
|
|
10008
|
+
repo: "client",
|
|
10009
|
+
rule: "ste-prose",
|
|
10010
|
+
doc: "CLAUDE.md:5"
|
|
10011
|
+
},
|
|
10012
|
+
{
|
|
10013
|
+
repo: "coeval",
|
|
10014
|
+
rule: "ste-prose",
|
|
10015
|
+
doc: "CLAUDE.md:5"
|
|
10016
|
+
},
|
|
10017
|
+
{
|
|
10018
|
+
repo: "crawler",
|
|
10019
|
+
rule: "ste-prose",
|
|
10020
|
+
doc: "CLAUDE.md:5"
|
|
10021
|
+
},
|
|
10022
|
+
{
|
|
10023
|
+
repo: "private",
|
|
10024
|
+
rule: "ste-prose",
|
|
10025
|
+
doc: "CLAUDE.md:5"
|
|
10026
|
+
},
|
|
10027
|
+
{
|
|
10028
|
+
repo: "headroom",
|
|
10029
|
+
rule: "ste-prose",
|
|
10030
|
+
doc: "CLAUDE.md:19"
|
|
10031
|
+
},
|
|
10032
|
+
{
|
|
10033
|
+
repo: "systems",
|
|
10034
|
+
rule: "lint-ste-in-ci",
|
|
10035
|
+
doc: "CLAUDE.md:24"
|
|
10036
|
+
},
|
|
10037
|
+
{
|
|
10038
|
+
repo: "Vex",
|
|
10039
|
+
rule: "ste-prose",
|
|
10040
|
+
doc: "CLAUDE.md:5"
|
|
10041
|
+
},
|
|
9599
10042
|
{
|
|
9600
10043
|
repo: "coeval",
|
|
9601
10044
|
rule: "tsconfig-test",
|
|
@@ -9954,30 +10397,28 @@ function startsPerHour(field) {
|
|
|
9954
10397
|
* This function gives the breaks of the schedules: the minute of each `cron` is the minute of the repository and the file. A
|
|
9955
10398
|
* schedule that starts more than once in each hour starts at equal steps from that minute (`18,48` for each 30 minutes).
|
|
9956
10399
|
*/
|
|
9957
|
-
function cronBreaks(file, text,
|
|
10400
|
+
function cronBreaks(file, text, minute) {
|
|
9958
10401
|
const breaks = [];
|
|
9959
10402
|
const originals = text.split(/\r?\n/);
|
|
9960
|
-
|
|
9961
|
-
const value = keyValue(line, "cron");
|
|
9962
|
-
if (value === void 0) return;
|
|
10403
|
+
for (const { line, cron: value } of cronLines(text)) {
|
|
9963
10404
|
const fields = value.split(" ").filter((field) => field !== "");
|
|
9964
10405
|
const wanted = minuteField(minute, startsPerHour(fields[0] ?? ""));
|
|
9965
|
-
if (fields[0] === wanted)
|
|
10406
|
+
if (fields[0] === wanted) continue;
|
|
9966
10407
|
const expected = [wanted, ...fields.slice(1)].join(" ");
|
|
9967
|
-
const original = originals[
|
|
10408
|
+
const original = originals[line - 1] ?? "";
|
|
9968
10409
|
const edits = original.includes(value) ? [{
|
|
9969
10410
|
file,
|
|
9970
10411
|
before: text,
|
|
9971
|
-
after: replaceLine(text,
|
|
10412
|
+
after: replaceLine(text, line, [original.replace(value, () => expected)])
|
|
9972
10413
|
}] : [];
|
|
9973
10414
|
breaks.push({
|
|
9974
10415
|
file,
|
|
9975
|
-
line
|
|
10416
|
+
line,
|
|
9976
10417
|
message: `${file}: the schedule "${value}" starts at minute ${fields[0] ?? "?"}, and the minute of this repository and file is ${String(minute)}.`,
|
|
9977
10418
|
fix: `cron: "${expected}"`,
|
|
9978
10419
|
edits
|
|
9979
10420
|
});
|
|
9980
|
-
}
|
|
10421
|
+
}
|
|
9981
10422
|
return breaks;
|
|
9982
10423
|
}
|
|
9983
10424
|
const runnerBudget = {
|
|
@@ -10031,11 +10472,11 @@ const runnerBudget = {
|
|
|
10031
10472
|
const lines = workflowLines(text);
|
|
10032
10473
|
breaks.push(...matrixBreaks(file, text, lines, limit), ...concurrencyBreaks(file, text, lines, grouped));
|
|
10033
10474
|
if (options["minute"] !== false) {
|
|
10034
|
-
if (
|
|
10475
|
+
if (cronLines(text).length > 0 && repository === void 0) breaks.push({
|
|
10035
10476
|
file,
|
|
10036
10477
|
message: `${file} has a schedule, and the rule cannot find the repository (GITHUB_REPOSITORY, or a GitHub URL of the remote origin).`
|
|
10037
10478
|
});
|
|
10038
|
-
else if (repository !== void 0) breaks.push(...cronBreaks(file, text,
|
|
10479
|
+
else if (repository !== void 0) breaks.push(...cronBreaks(file, text, scheduleMinute(repository, file)));
|
|
10039
10480
|
}
|
|
10040
10481
|
}
|
|
10041
10482
|
return breaks;
|
|
@@ -11269,274 +11710,6 @@ const trustPolicy = {
|
|
|
11269
11710
|
return breaks;
|
|
11270
11711
|
}
|
|
11271
11712
|
};
|
|
11272
|
-
// src/rules/unreleased-change.ts
|
|
11273
|
-
/**
|
|
11274
|
-
* The rule `unreleased-change`: a change does not set a version that npm has. With the option `versionEachChange`, a
|
|
11275
|
-
* change of the files that a published package ships also raises its version. Else the release skips the change.
|
|
11276
|
-
*/
|
|
11277
|
-
/** The registry of npm. */
|
|
11278
|
-
const NPM_REGISTRY = "https://registry.npmjs.org";
|
|
11279
|
-
/** The globs of the files of a package, relative to its folder, that do not ship: tests, fixtures, docs and configs. */
|
|
11280
|
-
const UNSHIPPED_FILES = [
|
|
11281
|
-
"**/*.md",
|
|
11282
|
-
"**/*.{test,spec}.*",
|
|
11283
|
-
"**/{test,tests,__tests__,fixtures,__fixtures__,__snapshots__,bench,benches,benchmarks,e2e}/**",
|
|
11284
|
-
"**/*.{bench,e2e}.*",
|
|
11285
|
-
"**/.*/**",
|
|
11286
|
-
"**/tsconfig*.json",
|
|
11287
|
-
"**/*.config.*",
|
|
11288
|
-
"docs/**",
|
|
11289
|
-
"examples/**",
|
|
11290
|
-
"scripts/**",
|
|
11291
|
-
"site/**",
|
|
11292
|
-
"LICENSE*",
|
|
11293
|
-
"pnpm-lock.yaml",
|
|
11294
|
-
"pnpm-workspace.yaml"
|
|
11295
|
-
];
|
|
11296
|
-
/** The fields of `package.json` that change what the package gives to a user. A change of the dependencies is not here. */
|
|
11297
|
-
const SHIPPED_FIELDS = [
|
|
11298
|
-
"main",
|
|
11299
|
-
"module",
|
|
11300
|
-
"types",
|
|
11301
|
-
"typings",
|
|
11302
|
-
"exports",
|
|
11303
|
-
"imports",
|
|
11304
|
-
"bin",
|
|
11305
|
-
"files",
|
|
11306
|
-
"type",
|
|
11307
|
-
"publishConfig",
|
|
11308
|
-
"sideEffects",
|
|
11309
|
-
"browser"
|
|
11310
|
-
];
|
|
11311
|
-
/** The script that `npmLookup` starts in a child process of Node, so that the rule stays synchronous. */
|
|
11312
|
-
const LOOKUP_SCRIPT = `
|
|
11313
|
-
const [registry, ...names] = process.argv.slice(1);
|
|
11314
|
-
let base = registry;
|
|
11315
|
-
while (base.endsWith("/")) base = base.slice(0, -1);
|
|
11316
|
-
Promise.all(names.map(async (name) => {
|
|
11317
|
-
try {
|
|
11318
|
-
const response = await fetch(base + "/" + name.replace("/", "%2f"), { headers: { accept: "application/json" }, signal: AbortSignal.timeout(20000) });
|
|
11319
|
-
if (response.status === 404) return [name, { versions: [] }];
|
|
11320
|
-
if (!response.ok) return [name, { error: "HTTP " + response.status }];
|
|
11321
|
-
const data = await response.json();
|
|
11322
|
-
const times = Object.fromEntries(Object.entries(data.time ?? {}).filter(([key]) => key !== "created" && key !== "modified"));
|
|
11323
|
-
return [name, { versions: [...new Set([...Object.keys(data.versions ?? {}), ...Object.keys(times)])], times }];
|
|
11324
|
-
} catch (error) {
|
|
11325
|
-
return [name, { error: String(error && error.message ? error.message : error) }];
|
|
11326
|
-
}
|
|
11327
|
-
})).then((entries) => process.stdout.write(JSON.stringify(Object.fromEntries(entries))));
|
|
11328
|
-
`;
|
|
11329
|
-
/**
|
|
11330
|
-
* This function asks the registry for the versions of each package, in one child process of Node. A version that npm
|
|
11331
|
-
* removed stays in the answer, because npm does not accept it again.
|
|
11332
|
-
*/
|
|
11333
|
-
const npmLookup = (names, registry) => {
|
|
11334
|
-
const fail = (error) => new Map(names.map((name) => [name, { error }]));
|
|
11335
|
-
if (names.length === 0) return /* @__PURE__ */ new Map();
|
|
11336
|
-
const result = spawnSync(process.execPath, [
|
|
11337
|
-
"-e",
|
|
11338
|
-
LOOKUP_SCRIPT,
|
|
11339
|
-
registry,
|
|
11340
|
-
...names
|
|
11341
|
-
], {
|
|
11342
|
-
encoding: "utf8",
|
|
11343
|
-
timeout: 6e4,
|
|
11344
|
-
windowsHide: true
|
|
11345
|
-
});
|
|
11346
|
-
if (result.error !== void 0 || result.status !== 0) return fail(result.error?.message ?? `the lookup ended with exit code ${String(result.status)}`);
|
|
11347
|
-
try {
|
|
11348
|
-
const answers = JSON.parse(result.stdout);
|
|
11349
|
-
return new Map(names.map((name) => [name, answers[name] ?? { error: "no answer" }]));
|
|
11350
|
-
} catch {
|
|
11351
|
-
return fail("the lookup gave no JSON");
|
|
11352
|
-
}
|
|
11353
|
-
};
|
|
11354
|
-
/** This function gives the strings of a field of `package.json` that is a list of strings. */
|
|
11355
|
-
const stringsOf = (manifest, field) => {
|
|
11356
|
-
const value = manifest[field];
|
|
11357
|
-
return Array.isArray(value) ? value.filter((item) => typeof item === "string") : [];
|
|
11358
|
-
};
|
|
11359
|
-
/** This function tells if a path relative to the root is in the folder `folder`. The root is `""`. */
|
|
11360
|
-
const inside = (folder, path) => folder === "" || path.startsWith(`${folder}/`);
|
|
11361
|
-
/** This function gives the globs of an entry of the field `files`: the entry, and each path under it. */
|
|
11362
|
-
const entryGlobs = (entry) => {
|
|
11363
|
-
let glob = cleanPath(entry);
|
|
11364
|
-
while (glob.endsWith("/")) glob = glob.slice(0, -1);
|
|
11365
|
-
return [glob, `${glob}/**`];
|
|
11366
|
-
};
|
|
11367
|
-
/** This function reads the manifest of the text of a `package.json` file, or gives undefined. */
|
|
11368
|
-
function parseManifest(text) {
|
|
11369
|
-
if (text === void 0) return void 0;
|
|
11370
|
-
try {
|
|
11371
|
-
const parsed = JSON.parse(text);
|
|
11372
|
-
return typeof parsed === "object" && parsed !== null && !Array.isArray(parsed) ? parsed : void 0;
|
|
11373
|
-
} catch {
|
|
11374
|
-
return;
|
|
11375
|
-
}
|
|
11376
|
-
}
|
|
11377
|
-
/** This function tells if a version is a placeholder before the first release: `0.0.0` or `0.0.0-<stage>`. */
|
|
11378
|
-
const isPlaceholder = (version) => /^0\.0\.0(?:[-+].*)?$/.test(version);
|
|
11379
|
-
/** The published packages of the repository: the root package and the code packages that are not private and have a name and a version. */
|
|
11380
|
-
function publishedOf(context) {
|
|
11381
|
-
const all = [context.rootPackage, ...codePackages(context)];
|
|
11382
|
-
return all.filter((pkg, index) => all.findIndex((other) => other.file === pkg.file) === index).filter((pkg) => pkg.manifest["private"] !== true && typeof pkg.manifest["name"] === "string" && typeof pkg.manifest["version"] === "string");
|
|
11383
|
-
}
|
|
11384
|
-
/** This function gives the time of the push in milliseconds, from the field `repository.pushed_at` of the event file. */
|
|
11385
|
-
function pushedAt(context) {
|
|
11386
|
-
const file = context.env["GITHUB_EVENT_PATH"];
|
|
11387
|
-
if (file === void 0 || file === "" || !existsSync(file)) return void 0;
|
|
11388
|
-
try {
|
|
11389
|
-
const value = JSON.parse(readFileSync(file, "utf8")).repository?.pushed_at;
|
|
11390
|
-
if (typeof value === "number") return value * 1e3;
|
|
11391
|
-
return typeof value === "string" && !Number.isNaN(Date.parse(value)) ? Date.parse(value) : void 0;
|
|
11392
|
-
} catch {
|
|
11393
|
-
return;
|
|
11394
|
-
}
|
|
11395
|
-
}
|
|
11396
|
-
/** This function gives the shipped files of `pkg` in the list `changed`, relative to the folder of the package. */
|
|
11397
|
-
function shippedFiles(pkg, changed, before, context, unshipped, fields) {
|
|
11398
|
-
const folders = context.packages.map((other) => other.folder).filter((folder) => folder !== "");
|
|
11399
|
-
const own = (path) => inside(pkg.folder, path) && (pkg.folder !== "" || !folders.some((folder) => inside(folder, path)));
|
|
11400
|
-
const relative = (path) => pkg.folder === "" ? path : path.slice(pkg.folder.length + 1);
|
|
11401
|
-
const entries = stringsOf(pkg.manifest, "files");
|
|
11402
|
-
const positive = entries.filter((entry) => !entry.startsWith("!"));
|
|
11403
|
-
const negative = entries.filter((entry) => entry.startsWith("!")).flatMap((entry) => entryGlobs(entry.slice(1)));
|
|
11404
|
-
const ownTracked = (context.gitFiles() ?? []).filter(own).map(relative);
|
|
11405
|
-
const whitelist = positive.length > 0 && positive.every((entry) => ownTracked.some((path) => matchesAny(path, entryGlobs(entry))));
|
|
11406
|
-
const ships = (path) => path !== "package.json" && !matchesAny(path, unshipped) && (!whitelist || positive.some((entry) => matchesAny(path, entryGlobs(entry))) && !matchesAny(path, negative));
|
|
11407
|
-
const files = changed.filter(own).map(relative).filter(ships);
|
|
11408
|
-
if (changed.includes(pkg.file) && before !== void 0 && fields.some((field) => JSON.stringify(before[field]) !== JSON.stringify(pkg.manifest[field]))) files.push("package.json");
|
|
11409
|
-
return files;
|
|
11410
|
-
}
|
|
11411
|
-
/** This function makes the rule with the registry lookup `lookup`. The tests give a fake lookup. */
|
|
11412
|
-
function unreleasedChangeRule(lookup = npmLookup) {
|
|
11413
|
-
return {
|
|
11414
|
-
id: "unreleased-change",
|
|
11415
|
-
changeScoped: true,
|
|
11416
|
-
title: "A change does not set a version that npm has. With `versionEachChange`, a change of the shipped files also raises the version.",
|
|
11417
|
-
reason: "The release workflow publishes each version that npm does not have, and it skips the others. When two pull requests set the same version, the second merge changes the code but no version, and nothing fails (rigor #18 and #20, 2026-11-02).",
|
|
11418
|
-
fix: "Raise the version of the package in a pull request to a version that npm does not have, with the SemVer rules (RELEASING.md). Then the release workflow publishes the change.",
|
|
11419
|
-
sources: [{
|
|
11420
|
-
repo: "rigor",
|
|
11421
|
-
rule: "unreleased-change",
|
|
11422
|
-
doc: "pull requests #18 and #20 (2026-11-02): two pull requests set the same version"
|
|
11423
|
-
}, ...[
|
|
11424
|
-
"crawler",
|
|
11425
|
-
"coeval",
|
|
11426
|
-
"template"
|
|
11427
|
-
].map((repo) => ({
|
|
11428
|
-
repo,
|
|
11429
|
-
rule: "unreleased-change",
|
|
11430
|
-
doc: ".github/workflows/release.yml (it starts on a change of a version, and it skips each version that npm has)"
|
|
11431
|
-
}))],
|
|
11432
|
-
options: {
|
|
11433
|
-
versionEachChange: {
|
|
11434
|
-
type: "boolean",
|
|
11435
|
-
default: false,
|
|
11436
|
-
description: "True when each pull request sets its version: a change of the shipped files with a version that npm has breaks, also on a push. False when a separate pull request raises the version."
|
|
11437
|
-
},
|
|
11438
|
-
unshipped: {
|
|
11439
|
-
type: "strings",
|
|
11440
|
-
default: UNSHIPPED_FILES,
|
|
11441
|
-
description: "With `versionEachChange`: the globs of the files of a package, relative to its folder, that do not ship."
|
|
11442
|
-
},
|
|
11443
|
-
fields: {
|
|
11444
|
-
type: "strings",
|
|
11445
|
-
default: SHIPPED_FIELDS,
|
|
11446
|
-
description: "With `versionEachChange`: the fields of `package.json` whose change ships. The dependencies are not in the default list."
|
|
11447
|
-
},
|
|
11448
|
-
registry: {
|
|
11449
|
-
type: "string",
|
|
11450
|
-
default: NPM_REGISTRY,
|
|
11451
|
-
description: "The URL of the registry that has the versions."
|
|
11452
|
-
}
|
|
11453
|
-
},
|
|
11454
|
-
check(context, options) {
|
|
11455
|
-
if (hasFile(context.root, ".changeset/config.json")) return { skipped: "the repository uses Changesets: the changesets raise the versions, and the changeset check examines them" };
|
|
11456
|
-
const published = publishedOf(context).filter((pkg) => !isPlaceholder(String(pkg.manifest["version"])));
|
|
11457
|
-
if (published.length === 0) return { skipped: "the repository has no published package with a release version" };
|
|
11458
|
-
const range = rangeOf(context, { push: true });
|
|
11459
|
-
if ("skipped" in range) return range;
|
|
11460
|
-
const strict = options["versionEachChange"] === true;
|
|
11461
|
-
const push = context.base === void 0 && context.env["GITHUB_EVENT_NAME"] === "push";
|
|
11462
|
-
const out = strict ? context.git([
|
|
11463
|
-
"diff",
|
|
11464
|
-
"--name-only",
|
|
11465
|
-
"--no-renames",
|
|
11466
|
-
...range.diff
|
|
11467
|
-
]) : "";
|
|
11468
|
-
if (out === void 0) return { skipped: "git cannot give the changed files of the change" };
|
|
11469
|
-
const changed = out.split(/\r?\n/).filter((file) => file !== "");
|
|
11470
|
-
const unshipped = Array.isArray(options["unshipped"]) ? options["unshipped"] : UNSHIPPED_FILES;
|
|
11471
|
-
const fields = Array.isArray(options["fields"]) ? options["fields"] : SHIPPED_FIELDS;
|
|
11472
|
-
const registry = typeof options["registry"] === "string" ? options["registry"] : NPM_REGISTRY;
|
|
11473
|
-
const fork = push ? range.ends[0] : context.git(["merge-base", ...range.ends])?.trim();
|
|
11474
|
-
const notes = [];
|
|
11475
|
-
if (fork === void 0) notes.push(`the checkout does not have the merge base of ${range.ends.join(" and ")}, so the rule cannot tell if the change sets a version`);
|
|
11476
|
-
const manifestAt = (ref, pkg) => ref === "HEAD" ? pkg.manifest : parseManifest(context.git(["show", `${ref}:${pkg.file}`]));
|
|
11477
|
-
const versionOf = (manifest) => typeof manifest?.["version"] === "string" ? manifest["version"] : void 0;
|
|
11478
|
-
const candidates = [];
|
|
11479
|
-
for (const pkg of published) {
|
|
11480
|
-
const atStart = manifestAt(range.ends[0], pkg);
|
|
11481
|
-
const set = versionOf(manifestAt(range.ends[1], pkg));
|
|
11482
|
-
const before = fork === void 0 ? void 0 : versionOf(fork === range.ends[0] ? atStart : manifestAt(fork, pkg));
|
|
11483
|
-
const sets = fork !== void 0 && set !== void 0 && !isPlaceholder(set) && set !== before ? set : void 0;
|
|
11484
|
-
const files = strict ? shippedFiles(pkg, changed, atStart, context, unshipped, fields) : [];
|
|
11485
|
-
if (sets === void 0 && files.length === 0) continue;
|
|
11486
|
-
candidates.push({
|
|
11487
|
-
pkg,
|
|
11488
|
-
name: String(pkg.manifest["name"]),
|
|
11489
|
-
version: String(pkg.manifest["version"]),
|
|
11490
|
-
sets,
|
|
11491
|
-
start: versionOf(atStart),
|
|
11492
|
-
files
|
|
11493
|
-
});
|
|
11494
|
-
}
|
|
11495
|
-
if (candidates.length === 0) return notes.length > 0 ? { skipped: notes.join("; ") } : [];
|
|
11496
|
-
const answers = lookup(candidates.map((candidate) => candidate.name), registry);
|
|
11497
|
-
const pushTime = push ? pushedAt(context) : void 0;
|
|
11498
|
-
const breaks = [];
|
|
11499
|
-
for (const candidate of candidates) {
|
|
11500
|
-
const answer = answers.get(candidate.name) ?? { error: "no answer" };
|
|
11501
|
-
if ("error" in answer) {
|
|
11502
|
-
notes.push(`the registry did not answer for ${candidate.name}: ${answer.error}`);
|
|
11503
|
-
continue;
|
|
11504
|
-
}
|
|
11505
|
-
const line = lineOf(candidate.pkg.text, "\"version\"");
|
|
11506
|
-
const at = {
|
|
11507
|
-
file: candidate.pkg.file,
|
|
11508
|
-
...line === void 0 ? {} : { line }
|
|
11509
|
-
};
|
|
11510
|
-
if (candidate.sets !== void 0) {
|
|
11511
|
-
const sets = candidate.sets;
|
|
11512
|
-
if (!answer.versions.includes(sets)) continue;
|
|
11513
|
-
if (push) {
|
|
11514
|
-
const time = Date.parse(answer.times?.[sets] ?? "");
|
|
11515
|
-
if (pushTime === void 0 || Number.isNaN(time)) {
|
|
11516
|
-
notes.push(`the rule cannot tell if npm had ${candidate.name}@${sets} before the push`);
|
|
11517
|
-
continue;
|
|
11518
|
-
}
|
|
11519
|
-
if (time >= pushTime) continue;
|
|
11520
|
-
}
|
|
11521
|
-
breaks.push({
|
|
11522
|
-
...at,
|
|
11523
|
-
message: `${candidate.name}: the change sets the version ${sets}, but ${sets} is on npm already. Raise the version (SemVer) in a pull request.`
|
|
11524
|
-
});
|
|
11525
|
-
} else if (strict && candidate.files.length > 0 && candidate.start === candidate.version && answer.versions.includes(candidate.version)) {
|
|
11526
|
-
const shown = candidate.files.slice(0, 3).map((file) => candidate.pkg.folder === "" ? file : `${candidate.pkg.folder}/${file}`);
|
|
11527
|
-
const more = candidate.files.length > shown.length ? ` and ${String(candidate.files.length - shown.length)} more` : "";
|
|
11528
|
-
breaks.push({
|
|
11529
|
-
...at,
|
|
11530
|
-
message: `${candidate.name}: the change is not released, because ${candidate.version} is on npm already. Raise the version (SemVer) in a pull request. The change ships ${shown.join(", ")}${more}.`
|
|
11531
|
-
});
|
|
11532
|
-
}
|
|
11533
|
-
}
|
|
11534
|
-
if (breaks.length === 0 && notes.length > 0) return { skipped: notes.join("; ") };
|
|
11535
|
-
return breaks;
|
|
11536
|
-
}
|
|
11537
|
-
};
|
|
11538
|
-
}
|
|
11539
|
-
const unreleasedChange = unreleasedChangeRule();
|
|
11540
11713
|
// src/rules/workspace-protocol.ts
|
|
11541
11714
|
/**
|
|
11542
11715
|
* The rule `workspace-protocol`: a package uses another package of the workspace through `workspace:`.
|
|
@@ -11616,6 +11789,7 @@ const RULES = [
|
|
|
11616
11789
|
apiReportScript,
|
|
11617
11790
|
releaseFiles,
|
|
11618
11791
|
unreleasedChange,
|
|
11792
|
+
publishedMinor,
|
|
11619
11793
|
changelogVersion,
|
|
11620
11794
|
typedScripts,
|
|
11621
11795
|
typedFiles,
|
|
@@ -12061,6 +12235,6 @@ function runMap(args, io) {
|
|
|
12061
12235
|
else io.stdout(mapText(found));
|
|
12062
12236
|
return 0;
|
|
12063
12237
|
}
|
|
12064
|
-
export {
|
|
12238
|
+
export { pagesCalls as $, defaultOptions as $t, repositoryOfRemote as A, gateTrigger as At, publishedMinorRule as B, inFolder as Bt, isSourcePath as C, mapMarkdown as Ct, blockHash as D, HOME_EXPORTS as Dt, HOME_TIMEOUT_MS as E, readOverlay as Et, requiredScripts as F, cuePreset as Ft, npmLookup as G, readJsonc as Gt, NPM_REGISTRY as H, lineOf as Ht, releaseFiles as I, DEPENDENCY_FIELDS as It, pushMainOnly as J, specifiersOf as Jt, unreleasedChange as K, replaceLine as Kt, lockedVersions as L, cleanPath as Lt, scheduleMinute as M, summaryName as Mt, roadmapOfLine as N, readWorkflow as Nt, githubFetch as O, ACTIONS_COMMIT as Ot, roadmapParses as P, STRICT_OPTIONS as Pt, PAGES_WORKFLOWS as Q, workspaceGlobs as Qt, minorOf as R, codePackages as Rt, tsconfigTest as S, findHomes as St, sourceMain as T, mergeHomes as Tt, SHIPPED_FIELDS as U, matchesAny as Ut, reachOf as V, keyLine as Vt, UNSHIPPED_FILES as W, parseJsonc as Wt, isPinned as X, globToRegExp as Xt, isGitSpecifier as Y, globFolders as Yt, pinnedGitDeps as Z, packageFolders as Zt, configsOfScript as _, messageOf as _t, listRules as a, noBuildOutput as at, testsRequired as b, HOMES as bt, runCli as c, mainCheck as ct, RULES as d, licenseFile as dt, parseConfig as en, pagesSite as et, workspaceProtocol as f, licenseFileOf as ft, typedScripts as g, homePackage as gt, trustPolicy as h, declaredName as ht, formatResult as i, noLocalPaths as it, runnerBudget as j, prPathFilters as jt, sharedDocsRule as k, convertGate as kt, runFix as l, LICENSE_TEXTS as lt, TRAIN_SCOPES as m, repositoryIsPublic as mt, annotations as n, DEFAULT_ALLOWED as nt, readConfig as o, REAL_COMPARE as ot, IGNORE_AFTER as p, mitText as pt, unreleasedChangeRule as q, runGit as qt, createContext as r, HOME_PATTERNS as rt, runChecks as s, hasImportMetaMain as st, USAGE as t, apiReportScript as tt, summaryMarkdown as u, authorOf as ut, scriptsOf as v, repoOf as vt, pathsOf as w, mapText as wt, hasTests as x, MAP_RULE as xt, typedFiles as y, signaturesOf as yt, publishedMinor as z, hasFile as zt };
|
|
12065
12239
|
|
|
12066
|
-
//# sourceMappingURL=run-
|
|
12240
|
+
//# sourceMappingURL=run-D9GKNsry.js.map
|