@antelopejs/tooling-configs 0.5.7 → 0.5.8
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/bin/api-diff.mjs +9 -7
- package/dist/bin/body-check.mjs +3 -3
- package/dist/bin/capture.mjs +12 -4
- package/dist/bin/check-size.mjs +6 -4
- package/dist/bin/checks.mjs +2 -2
- package/dist/bin/comment-proof.mjs +3 -3
- package/dist/bin/garden.mjs +151 -15
- package/dist/bin/lease.mjs +142 -20
- package/dist/bin/ratchet.mjs +5 -5
- package/dist/bin/readme-strip.mjs +1 -1
- package/dist/bin/suppressions.mjs +9 -10
- package/dist/bin/sync.mjs +66 -22
- package/dist/bin/verify.mjs +61 -36
- package/dist/{checks-CD2oFGrt.mjs → checks-BC-F8bsv.mjs} +2 -66
- package/dist/{files-DJ0TeaTU.mjs → files-C-JJhExM.mjs} +1 -1
- package/dist/launch-D5cylwvb.mjs +76 -0
- package/dist/{map-DRyYz_Fw.mjs → map-BYkmnvNw.mjs} +42 -10
- package/dist/oxc/fmt.mjs +1 -1
- package/dist/oxc/guardrails/index.mjs +1 -1
- package/dist/oxc/lint.mjs +1 -1
- package/dist/{oxlint-BbpTFFmf.mjs → oxlint-CCOJqj3d.mjs} +6 -2
- package/dist/{proof-stamp-Kg-tkM6G.mjs → proof-stamp-lyD84zmj.mjs} +4 -4
- package/dist/{ratchet-1O8k4Dxu.mjs → ratchet-SQ7vTR0i.mjs} +4 -4
- package/dist/run-command-BlFRPORx.mjs +95 -0
- package/dist/{shared-igPpEDpS.mjs → shared-BCFFyp3l.mjs} +9 -2
- package/dist/{size-DBatLT-F.mjs → size-CCGLY4Ke.mjs} +1 -1
- package/dist/slash-BEgSnfYw.mjs +12 -0
- package/dist/{suppression-base-DZgUDXiI.mjs → suppression-base-whhvw-IJ.mjs} +3 -3
- package/dist/{suppression-budget-DgYdu6JK.mjs → suppression-budget-CtIYSoDO.mjs} +2 -2
- package/dist/{suppressions-CQTcKCi1.mjs → suppressions-C79kRvYI.mjs} +1 -1
- package/dist/{typescript-CqcOaci8.mjs → typescript--_8og8AM.mjs} +1 -1
- package/package.json +1 -1
package/dist/bin/api-diff.mjs
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { o as packageManager, s as parseManifest } from "../package-DnxZ2CXZ.mjs";
|
|
3
3
|
import { t as runCli } from "../cli-4Tv71vYk.mjs";
|
|
4
|
-
import { c as repositoryRoot, l as resolveRevision } from "../files-
|
|
5
|
-
import {
|
|
6
|
-
import { c as
|
|
4
|
+
import { c as repositoryRoot, l as resolveRevision } from "../files-C-JJhExM.mjs";
|
|
5
|
+
import { n as shimInvocation } from "../run-command-BlFRPORx.mjs";
|
|
6
|
+
import { a as DIRECTORY_LINK, c as revisionCounts, d as createAddedPolicy, f as describeAllowance, i as stampProof, l as workspaceManifests, m as recordVerdict, o as compareRevisions, p as fillStars, u as allowedByGlob } from "../proof-stamp-lyD84zmj.mjs";
|
|
7
|
+
import { c as packagesAt, i as isTestSource, l as unpublishedAt, o as loadTypeScript, r as isExportPath, s as outputRoot, t as emitPackage } from "../typescript--_8og8AM.mjs";
|
|
7
8
|
import { createRequire } from "node:module";
|
|
8
9
|
import { copyFileSync, cpSync, existsSync, globSync, mkdirSync, readFileSync, readdirSync, realpathSync, rmSync, statSync, symlinkSync, writeFileSync } from "node:fs";
|
|
9
10
|
import { basename, dirname, isAbsolute, join, parse, posix, relative, resolve, sep } from "node:path";
|
|
@@ -644,7 +645,7 @@ function builtEntries(directory, manifest) {
|
|
|
644
645
|
const matches = modules.filter((file) => !isTestSource(output, file));
|
|
645
646
|
if (matches.length < modules.length) skipped.push(target);
|
|
646
647
|
return matches.sort().map((file) => {
|
|
647
|
-
const capture = pattern.exec(file)?.[1] ?? relative(directory, file);
|
|
648
|
+
const capture = (pattern.exec(file)?.[1] ?? relative(directory, file)).split(sep).join("/");
|
|
648
649
|
return {
|
|
649
650
|
entry: entry.replaceAll("*", capture),
|
|
650
651
|
file,
|
|
@@ -706,10 +707,11 @@ function declaredPackageManager(worktree, directory) {
|
|
|
706
707
|
}
|
|
707
708
|
function runBuild(directory, manager) {
|
|
708
709
|
const manifest = parseManifest(readFileSync(join(directory, "package.json"), "utf8"));
|
|
709
|
-
|
|
710
|
+
const build = shimInvocation(manager, ["run", "build"]);
|
|
711
|
+
if (manifest.scripts?.build) execFileSync(build.command, build.args, {
|
|
710
712
|
cwd: directory,
|
|
711
713
|
encoding: "utf8",
|
|
712
|
-
shell:
|
|
714
|
+
shell: build.shell,
|
|
713
715
|
env: {
|
|
714
716
|
...process.env,
|
|
715
717
|
pnpm_config_verify_deps_before_run: "false"
|
|
@@ -737,7 +739,7 @@ function installedPackage(worktree, directory, name, manifests) {
|
|
|
737
739
|
for (let at = directory;; at = dirname(at)) {
|
|
738
740
|
const link = join(worktree, at, "node_modules", name);
|
|
739
741
|
if (existsSync(link)) {
|
|
740
|
-
const real = relative(realpathSync(worktree), realpathSync(link)).split(sep).join("/") || ".";
|
|
742
|
+
const real = relative(realpathSync.native(worktree), realpathSync.native(link)).split(sep).join("/") || ".";
|
|
741
743
|
return manifests.has(real) ? real : void 0;
|
|
742
744
|
}
|
|
743
745
|
if (at === ".") return void 0;
|
package/dist/bin/body-check.mjs
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { t as runCli } from "../cli-4Tv71vYk.mjs";
|
|
3
|
-
import { c as repositoryRoot, l as resolveRevision } from "../files-
|
|
4
|
-
import { t as lintDiagnostics } from "../oxlint-
|
|
5
|
-
import { n as proofDigest, r as proofLines, s as revisionCountRows, t as parseProofStamp } from "../proof-stamp-
|
|
3
|
+
import { c as repositoryRoot, l as resolveRevision } from "../files-C-JJhExM.mjs";
|
|
4
|
+
import { t as lintDiagnostics } from "../oxlint-CCOJqj3d.mjs";
|
|
5
|
+
import { n as proofDigest, r as proofLines, s as revisionCountRows, t as parseProofStamp } from "../proof-stamp-lyD84zmj.mjs";
|
|
6
6
|
import { readFileSync } from "node:fs";
|
|
7
7
|
import { spawnSync } from "node:child_process";
|
|
8
8
|
import { parseArgs } from "node:util";
|
package/dist/bin/capture.mjs
CHANGED
|
@@ -2,9 +2,11 @@
|
|
|
2
2
|
import { a as isString, c as object, f as parseJson, i as isObject, m as strings, r as flag, t as child, u as optStr } from "../json-CG2L7YFl.mjs";
|
|
3
3
|
import { n as parseScenes, r as selectScenes } from "../scenes-d-VQ0LOm.mjs";
|
|
4
4
|
import { n as runCliAsync } from "../cli-4Tv71vYk.mjs";
|
|
5
|
-
import { c as repositoryRoot } from "../files-
|
|
5
|
+
import { c as repositoryRoot } from "../files-C-JJhExM.mjs";
|
|
6
|
+
import { t as relativeSlashed } from "../slash-BEgSnfYw.mjs";
|
|
7
|
+
import { t as killTree } from "../launch-D5cylwvb.mjs";
|
|
6
8
|
import { cpSync, existsSync, mkdirSync, mkdtempSync, readFileSync, readdirSync, rmSync, writeFileSync } from "node:fs";
|
|
7
|
-
import { dirname, join
|
|
9
|
+
import { dirname, join } from "node:path";
|
|
8
10
|
import { execFileSync, spawn, spawnSync } from "node:child_process";
|
|
9
11
|
import { parse as parse$1, stringify } from "yaml";
|
|
10
12
|
import { pathToFileURL } from "node:url";
|
|
@@ -358,7 +360,7 @@ function targets(value) {
|
|
|
358
360
|
function missingBuildOutput(root) {
|
|
359
361
|
return publishedPackages(root).flatMap(({ name, folder, manifest }) => {
|
|
360
362
|
const declared = ENTRY_FIELDS.flatMap((field) => Object.hasOwn(manifest, field) ? targets(manifest[field]) : []);
|
|
361
|
-
return [...new Set(declared.map((target) => join(folder, target)))].filter((path) => !existsSync(path)).map((path) => `${name}: ${
|
|
363
|
+
return [...new Set(declared.map((target) => join(folder, target)))].filter((path) => !existsSync(path)).map((path) => `${name}: ${relativeSlashed(root, path)} is missing`);
|
|
362
364
|
});
|
|
363
365
|
}
|
|
364
366
|
/** Throws, naming each missing entry file, when the module the demo would run is not built. */
|
|
@@ -474,9 +476,10 @@ async function settle(sharp, root, check, captured) {
|
|
|
474
476
|
//#endregion
|
|
475
477
|
//#region src/capture/stop.ts
|
|
476
478
|
const POLL_MS = 50;
|
|
479
|
+
/** Whether the group `pid` leads has a process left; Windows has no groups, so it asks about the leader alone, whose end `taskkill /t` brings with its whole tree. */
|
|
477
480
|
function groupAlive(pid) {
|
|
478
481
|
try {
|
|
479
|
-
process.kill(-pid, 0);
|
|
482
|
+
process.kill(process.platform === "win32" ? pid : -pid, 0);
|
|
480
483
|
return true;
|
|
481
484
|
} catch {
|
|
482
485
|
return false;
|
|
@@ -502,6 +505,11 @@ async function goneWithin(pid, ms) {
|
|
|
502
505
|
async function stopProcessGroup(started, options) {
|
|
503
506
|
const { pid } = started;
|
|
504
507
|
if (pid === void 0) return;
|
|
508
|
+
if (process.platform === "win32") {
|
|
509
|
+
killTree(pid);
|
|
510
|
+
if (await goneWithin(pid, options.killWaitMs)) return;
|
|
511
|
+
throw new Error(`process ${pid} was still running ${options.killWaitMs / 1e3}s after taskkill`);
|
|
512
|
+
}
|
|
505
513
|
signalGroup(started, pid, "SIGINT");
|
|
506
514
|
if (await goneWithin(pid, options.graceMs)) return;
|
|
507
515
|
signalGroup(started, pid, "SIGKILL");
|
package/dist/bin/check-size.mjs
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { t as runCli } from "../cli-4Tv71vYk.mjs";
|
|
3
|
-
import { c as repositoryRoot, n as authoredSizes, s as repositoryPath } from "../files-
|
|
4
|
-
import { l as worktreeSuppressions, o as revisionSuppressions } from "../suppressions-
|
|
5
|
-
import { t as checkSize } from "../size-
|
|
3
|
+
import { c as repositoryRoot, n as authoredSizes, s as repositoryPath } from "../files-C-JJhExM.mjs";
|
|
4
|
+
import { l as worktreeSuppressions, o as revisionSuppressions } from "../suppressions-C79kRvYI.mjs";
|
|
5
|
+
import { t as checkSize } from "../size-CCGLY4Ke.mjs";
|
|
6
|
+
import { realpathSync } from "node:fs";
|
|
6
7
|
import { resolve } from "node:path";
|
|
7
8
|
import { parseArgs } from "node:util";
|
|
8
9
|
//#region src/guardrails/directives.ts
|
|
@@ -19,7 +20,8 @@ runCli(() => {
|
|
|
19
20
|
options: { staged: { type: "boolean" } },
|
|
20
21
|
allowPositionals: true
|
|
21
22
|
});
|
|
22
|
-
const
|
|
23
|
+
const cwd = realpathSync.native(process.cwd());
|
|
24
|
+
const files = positionals.length ? positionals.map((file) => repositoryPath(root, resolve(cwd, file))) : void 0;
|
|
23
25
|
const failures = [...checkSize(root, files, values.staged), ...checkBlanketDisables(root, files, values.staged)];
|
|
24
26
|
for (const failure of failures) process.stderr.write(`${failure}\n`);
|
|
25
27
|
return failures.length ? 1 : 0;
|
package/dist/bin/checks.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { n as runCliAsync } from "../cli-4Tv71vYk.mjs";
|
|
3
|
-
import { c as repositoryRoot } from "../files-
|
|
4
|
-
import { r as runChecks, t as CHECKS_SKIP_ENV } from "../checks-
|
|
3
|
+
import { c as repositoryRoot } from "../files-C-JJhExM.mjs";
|
|
4
|
+
import { r as runChecks, t as CHECKS_SKIP_ENV } from "../checks-BC-F8bsv.mjs";
|
|
5
5
|
import { parseArgs } from "node:util";
|
|
6
6
|
//#region src/bin/checks.ts
|
|
7
7
|
const SIGNAL_EXIT = /* @__PURE__ */ new Map([
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { t as runCli } from "../cli-4Tv71vYk.mjs";
|
|
3
|
-
import { c as repositoryRoot } from "../files-
|
|
4
|
-
import { c as revisionCounts, i as stampProof, o as compareRevisions } from "../proof-stamp-
|
|
5
|
-
import { a as listsNoFiles, c as packagesAt, n as extendedConfigs, t as emitPackage } from "../typescript
|
|
3
|
+
import { c as repositoryRoot } from "../files-C-JJhExM.mjs";
|
|
4
|
+
import { c as revisionCounts, i as stampProof, o as compareRevisions } from "../proof-stamp-lyD84zmj.mjs";
|
|
5
|
+
import { a as listsNoFiles, c as packagesAt, n as extendedConfigs, t as emitPackage } from "../typescript--_8og8AM.mjs";
|
|
6
6
|
import { copyFileSync, existsSync, mkdirSync } from "node:fs";
|
|
7
7
|
import { dirname, isAbsolute, join, relative, resolve, sep } from "node:path";
|
|
8
8
|
//#region src/guardrails/comment-proof.ts
|
package/dist/bin/garden.mjs
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { t as admits } from "../semver-BDxeEcP_.mjs";
|
|
3
|
-
import { c as object, d as optTime, f as parseJson, h as time, i as isObject, l as optNum, m as strings, n as children, o as list, p as str, r as flag, s as num, t as child, u as optStr } from "../json-CG2L7YFl.mjs";
|
|
3
|
+
import { a as isString, c as object, d as optTime, f as parseJson, h as time, i as isObject, l as optNum, m as strings, n as children, o as list, p as str, r as flag, s as num, t as child, u as optStr } from "../json-CG2L7YFl.mjs";
|
|
4
4
|
import { n as runCliAsync } from "../cli-4Tv71vYk.mjs";
|
|
5
5
|
import { a as RENOVATE_CONFIGS, c as CI_CONTEXT, d as CI_RENOVATE_SYNC_REF, l as CI_NODE_REF, n as ciNodeCallers, o as RENOVATE_PRESET, r as ciRenovateSyncCallers, u as CI_PATH } from "../workflow-CPcNc8KL.mjs";
|
|
6
6
|
import { i as ghToken, n as createApi, t as ApiError } from "../api-CCOiLN3w.mjs";
|
|
7
|
+
import { parseDocument } from "yaml";
|
|
7
8
|
import { parseArgs } from "node:util";
|
|
8
9
|
import { inflateRawSync } from "node:zlib";
|
|
9
10
|
//#region src/garden/decode.ts
|
|
@@ -544,8 +545,8 @@ async function perRepo(repos, scan) {
|
|
|
544
545
|
//#endregion
|
|
545
546
|
//#region src/garden/checks/ci-health.ts
|
|
546
547
|
const DAY$4 = 864e5;
|
|
547
|
-
const WORKFLOW = "ci.yml";
|
|
548
|
-
const CALLER = `.github/workflows/${WORKFLOW}`;
|
|
548
|
+
const WORKFLOW$1 = "ci.yml";
|
|
549
|
+
const CALLER = `.github/workflows/${WORKFLOW$1}`;
|
|
549
550
|
const RECENT_RUNS = 10;
|
|
550
551
|
const MIN_BASELINE = 5;
|
|
551
552
|
const RELATIVE_LIMIT = 1.2;
|
|
@@ -575,14 +576,14 @@ function redSince(runs) {
|
|
|
575
576
|
}
|
|
576
577
|
async function red(context, repo) {
|
|
577
578
|
const branch = await context.targetBranch(repo);
|
|
578
|
-
const runs = await context.workflowRuns(repo, WORKFLOW, branch);
|
|
579
|
+
const runs = await context.workflowRuns(repo, WORKFLOW$1, branch);
|
|
579
580
|
const since = runs === void 0 ? void 0 : redSince(runs);
|
|
580
581
|
if (since === void 0 || context.api.now().getTime() - since.createdAt <= DAY$4) return [];
|
|
581
582
|
return [finding({
|
|
582
583
|
repo: repo.name,
|
|
583
584
|
check: "red-branch",
|
|
584
585
|
subject: branch
|
|
585
|
-
}, `${WORKFLOW} has been red on ${branch} since ${new Date(since.createdAt).toISOString()}: ${since.url}`, `${WORKFLOW} is green on ${branch}.`)];
|
|
586
|
+
}, `${WORKFLOW$1} has been red on ${branch} since ${new Date(since.createdAt).toISOString()}: ${since.url}`, `${WORKFLOW$1} is green on ${branch}.`)];
|
|
586
587
|
}
|
|
587
588
|
/** A reusable workflow path without its `@ref`, e.g. `AntelopeJS/.github/.github/workflows/ci-node.yml`. */
|
|
588
589
|
function workflowPath(path) {
|
|
@@ -622,7 +623,7 @@ async function callerChange(context, repo, branch, newest) {
|
|
|
622
623
|
}
|
|
623
624
|
async function slow(context, repo) {
|
|
624
625
|
const branch = await context.targetBranch(repo);
|
|
625
|
-
const runs = await context.workflowRuns(repo, WORKFLOW, branch);
|
|
626
|
+
const runs = await context.workflowRuns(repo, WORKFLOW$1, branch);
|
|
626
627
|
if (runs === void 0) return [];
|
|
627
628
|
const passed = runs.filter((run) => run.conclusion === "success");
|
|
628
629
|
const cutoff = Math.max(context.api.now().getTime() - 30 * DAY$4, await callerChange(context, repo, branch, passed[0]));
|
|
@@ -638,7 +639,7 @@ async function slow(context, repo) {
|
|
|
638
639
|
repo: repo.name,
|
|
639
640
|
check: "ci-duration",
|
|
640
641
|
subject: branch
|
|
641
|
-
}, `The median of the last ${RECENT_RUNS} ${WORKFLOW} runs on ${branch} is ${Math.round(recent)} s against ${Math.round(usual)} s over the earlier runs since ${since}, the latest of 30 days ago, the last change to ${CALLER} or a workflow file of this repository it calls, and the last change to the shared workflows it calls.`, `The median is within 20% and 60 s of the baseline since the last change to what ${WORKFLOW} runs.`)];
|
|
642
|
+
}, `The median of the last ${RECENT_RUNS} ${WORKFLOW$1} runs on ${branch} is ${Math.round(recent)} s against ${Math.round(usual)} s over the earlier runs since ${since}, the latest of 30 days ago, the last change to ${CALLER} or a workflow file of this repository it calls, and the last change to the shared workflows it calls.`, `The median is within 20% and 60 s of the baseline since the last change to what ${WORKFLOW$1} runs.`)];
|
|
642
643
|
}
|
|
643
644
|
const redBranch = {
|
|
644
645
|
id: "red-branch",
|
|
@@ -660,7 +661,7 @@ const ciDuration = {
|
|
|
660
661
|
};
|
|
661
662
|
//#endregion
|
|
662
663
|
//#region src/garden/checks/branches.ts
|
|
663
|
-
const CHECK$
|
|
664
|
+
const CHECK$2 = "stale-branches";
|
|
664
665
|
const SUBJECT = "branches";
|
|
665
666
|
const DAY$3 = 864e5;
|
|
666
667
|
const INACTIVE_DAYS = 30;
|
|
@@ -713,13 +714,13 @@ function report(repo, prunes) {
|
|
|
713
714
|
if (!prunes.length) return [];
|
|
714
715
|
return [finding({
|
|
715
716
|
repo: repo.name,
|
|
716
|
-
check: CHECK$
|
|
717
|
+
check: CHECK$2,
|
|
717
718
|
subject: SUBJECT
|
|
718
719
|
}, prunes.map(({ branch, reason }) => `${branch} (${reason})`).join(", "), `No branch other than the default, next and protected ones is the head of a merged or closed PR, or has no open PR and no commit for ${INACTIVE_DAYS} days.`)];
|
|
719
720
|
}
|
|
720
721
|
/** Lists, per repository, the branches `--apply-prunes` would delete. */
|
|
721
722
|
const staleBranches = {
|
|
722
|
-
id: CHECK$
|
|
723
|
+
id: CHECK$2,
|
|
723
724
|
async run(context) {
|
|
724
725
|
return perRepo(await context.scope(), async (repo) => report(repo, await prunable(context, repo)));
|
|
725
726
|
}
|
|
@@ -727,7 +728,7 @@ const staleBranches = {
|
|
|
727
728
|
/** The deletions behind each stale-branches finding, re-read from the API given so a branch that gained an open PR or a commit since the scan is kept; a repository whose read failed is never pruned. */
|
|
728
729
|
async function plannedPrunes(api, findings) {
|
|
729
730
|
const fresh = new GardenContext(api);
|
|
730
|
-
const flagged = new Set(findings.filter((entry) => entry.check === CHECK$
|
|
731
|
+
const flagged = new Set(findings.filter((entry) => entry.check === CHECK$2).map((entry) => entry.repo));
|
|
731
732
|
const prunes = [];
|
|
732
733
|
const failed = [];
|
|
733
734
|
const scope = await fresh.scope().catch((error) => {
|
|
@@ -769,7 +770,7 @@ async function tooling(context) {
|
|
|
769
770
|
}
|
|
770
771
|
//#endregion
|
|
771
772
|
//#region src/garden/checks/conformance.ts
|
|
772
|
-
const CHECK = "conformance";
|
|
773
|
+
const CHECK$1 = "conformance";
|
|
773
774
|
const DAY$2 = 864e5;
|
|
774
775
|
const MEND_EXEMPT = /* @__PURE__ */ new Set(["k8s-gitops-infra"]);
|
|
775
776
|
/** Repositories whose ci.yml runs its own jobs: tooling-configs shards its tests and checks its docs action at HEAD, which ci-node.yml cannot do. */
|
|
@@ -777,7 +778,7 @@ const CI_CALLER_EXEMPT = /* @__PURE__ */ new Set(["tooling-configs"]);
|
|
|
777
778
|
function problem(repo, subject, evidence, doneMeans) {
|
|
778
779
|
return finding({
|
|
779
780
|
repo: repo.name,
|
|
780
|
-
check: CHECK,
|
|
781
|
+
check: CHECK$1,
|
|
781
782
|
subject
|
|
782
783
|
}, evidence, doneMeans);
|
|
783
784
|
}
|
|
@@ -845,7 +846,7 @@ const deleteBranchOnMerge = {
|
|
|
845
846
|
/** Turns `delete_branch_on_merge` on for each repository a finding reports it off on, and writes nothing else; returns the writes that failed. */
|
|
846
847
|
async function applySettings(api, findings) {
|
|
847
848
|
const failed = [];
|
|
848
|
-
for (const entry of findings) if (entry.check === CHECK && entry.subject === BRANCH_CLEANUP) await api.send("PATCH", `/repos/${ORG}/${entry.repo}`, { delete_branch_on_merge: true }).catch((error) => {
|
|
849
|
+
for (const entry of findings) if (entry.check === CHECK$1 && entry.subject === BRANCH_CLEANUP) await api.send("PATCH", `/repos/${ORG}/${entry.repo}`, { delete_branch_on_merge: true }).catch((error) => {
|
|
849
850
|
failed.push(`${entry.repo}: ${error instanceof Error ? error.message : String(error)}`);
|
|
850
851
|
});
|
|
851
852
|
return failed;
|
|
@@ -867,7 +868,7 @@ async function mendSelection(context) {
|
|
|
867
868
|
return (await context.repos()).filter((repo) => repo.tier !== "N4" && !MEND_EXEMPT.has(repo.name) && !active.has(repo.name)).map((repo) => problem(repo, "renovate-app", "No issue or pull request from the Renovate app: the repository is not in the app's selection.", "Antony adds the repository to the Mend Renovate app's selected repositories."));
|
|
868
869
|
}
|
|
869
870
|
const conformance = {
|
|
870
|
-
id: CHECK,
|
|
871
|
+
id: CHECK$1,
|
|
871
872
|
async run(context) {
|
|
872
873
|
const scanned = await perRepo(await context.scope(), (repo) => scan(context, repo));
|
|
873
874
|
const extra = [...await newRepos(context), ...await mendSelection(context)];
|
|
@@ -1215,6 +1216,140 @@ const packageSize = {
|
|
|
1215
1216
|
}
|
|
1216
1217
|
};
|
|
1217
1218
|
//#endregion
|
|
1219
|
+
//#region src/garden/workflow-windows.ts
|
|
1220
|
+
const CI_NODE = /^AntelopeJS\/\.github\/\.github\/workflows\/ci-node\.yml@\S+$/;
|
|
1221
|
+
const CI_EVENTS = /* @__PURE__ */ new Set([
|
|
1222
|
+
"pull_request",
|
|
1223
|
+
"pull_request_target",
|
|
1224
|
+
"push",
|
|
1225
|
+
"merge_group"
|
|
1226
|
+
]);
|
|
1227
|
+
const WINDOWS = /windows/i;
|
|
1228
|
+
const EXPRESSION = /\$\{\{/;
|
|
1229
|
+
const MATRIX_KEY = /\bmatrix\.([\w-]+)/g;
|
|
1230
|
+
const ALWAYS = /^\s*\$\{\{\s*true\s*\}\}\s*$/;
|
|
1231
|
+
const NEVER = /^\s*\$\{\{\s*false\s*\}\}\s*$/;
|
|
1232
|
+
/** The workflow as JSON, its anchors, aliases and merge keys resolved; undefined when the YAML does not parse. */
|
|
1233
|
+
function workflow(text) {
|
|
1234
|
+
const document = parseDocument(text, { merge: true });
|
|
1235
|
+
if (document.errors.length) return void 0;
|
|
1236
|
+
const value = parseJson(JSON.stringify(document.toJS({ maxAliasCount: 1e3 }) ?? null));
|
|
1237
|
+
return isObject(value) ? value : void 0;
|
|
1238
|
+
}
|
|
1239
|
+
/** Every string in `value`, nested lists and object values included. */
|
|
1240
|
+
function texts(value) {
|
|
1241
|
+
if (value === null) return [];
|
|
1242
|
+
if (isString(value)) return [value];
|
|
1243
|
+
if (Array.isArray(value)) return value.flatMap(texts);
|
|
1244
|
+
if (isObject(value)) return Object.values(value).flatMap(texts);
|
|
1245
|
+
return [];
|
|
1246
|
+
}
|
|
1247
|
+
function own(source, key) {
|
|
1248
|
+
return Object.hasOwn(source, key) ? source[key] : null;
|
|
1249
|
+
}
|
|
1250
|
+
function triggers(on) {
|
|
1251
|
+
if (on !== null && isObject(on)) return Object.keys(on);
|
|
1252
|
+
return texts(on);
|
|
1253
|
+
}
|
|
1254
|
+
function entries(value) {
|
|
1255
|
+
return Array.isArray(value) ? value.filter(isObject) : [];
|
|
1256
|
+
}
|
|
1257
|
+
/** The values the matrix gives `key`: its own list and `include` entries, less the values a single-key `exclude` entry drops. */
|
|
1258
|
+
function legs(matrix, key) {
|
|
1259
|
+
const dropped = new Set(entries(own(matrix, "exclude")).filter((entry) => Object.keys(entry).length === 1).flatMap((entry) => texts(own(entry, key))));
|
|
1260
|
+
return [...texts(own(matrix, key)), ...entries(own(matrix, "include")).flatMap((entry) => texts(own(entry, key)))].filter((value) => !dropped.has(value));
|
|
1261
|
+
}
|
|
1262
|
+
function runnerIsWindows(job) {
|
|
1263
|
+
const labels = texts(own(job, "runs-on"));
|
|
1264
|
+
if (labels.some((label) => WINDOWS.test(label))) return true;
|
|
1265
|
+
const strategy = own(job, "strategy");
|
|
1266
|
+
const matrix = strategy !== null && isObject(strategy) ? own(strategy, "matrix") : null;
|
|
1267
|
+
if (matrix === null) return false;
|
|
1268
|
+
if (!isObject(matrix)) return texts(matrix).some((value) => WINDOWS.test(value));
|
|
1269
|
+
return labels.filter((label) => EXPRESSION.test(label)).flatMap((label) => [...label.matchAll(MATRIX_KEY)].map((match) => match[1])).some((key) => legs(matrix, key).some((value) => WINDOWS.test(value)));
|
|
1270
|
+
}
|
|
1271
|
+
function jobRunsOnWindows(job) {
|
|
1272
|
+
const condition = own(job, "if");
|
|
1273
|
+
if (condition === false || isString(condition) && NEVER.test(condition)) return false;
|
|
1274
|
+
const uses = own(job, "uses");
|
|
1275
|
+
if (isString(uses) && CI_NODE.test(uses)) {
|
|
1276
|
+
const inputs = own(job, "with");
|
|
1277
|
+
const windows = inputs !== null && isObject(inputs) ? own(inputs, "windows") : null;
|
|
1278
|
+
return windows === true || isString(windows) && ALWAYS.test(windows);
|
|
1279
|
+
}
|
|
1280
|
+
return runnerIsWindows(job);
|
|
1281
|
+
}
|
|
1282
|
+
/**
|
|
1283
|
+
* Whether a workflow file runs a job on Windows for pull requests or pushes: a ci-node.yml caller with
|
|
1284
|
+
* `windows: true`, or a job whose `runs-on`, or the matrix value it reads, names a Windows runner. A workflow
|
|
1285
|
+
* on other events only, a job whose `if` is false, and matrix values `exclude` drops do not count. False when
|
|
1286
|
+
* the YAML does not parse.
|
|
1287
|
+
*/
|
|
1288
|
+
function runsOnWindows(text) {
|
|
1289
|
+
const parsed = workflow(text);
|
|
1290
|
+
if (parsed === void 0) return false;
|
|
1291
|
+
if (!triggers(own(parsed, "on")).some((event) => CI_EVENTS.has(event))) return false;
|
|
1292
|
+
const jobs = own(parsed, "jobs");
|
|
1293
|
+
if (jobs === null || !isObject(jobs)) return false;
|
|
1294
|
+
return Object.values(jobs).some((job) => job !== null && isObject(job) && jobRunsOnWindows(job));
|
|
1295
|
+
}
|
|
1296
|
+
//#endregion
|
|
1297
|
+
//#region src/garden/stack.ts
|
|
1298
|
+
const FRAMEWORK = /* @__PURE__ */ new Set([
|
|
1299
|
+
"antelopejs",
|
|
1300
|
+
"tooling-configs",
|
|
1301
|
+
"dms"
|
|
1302
|
+
]);
|
|
1303
|
+
const MODULES = /* @__PURE__ */ new Set([
|
|
1304
|
+
"api",
|
|
1305
|
+
"auth-jwt",
|
|
1306
|
+
"brevo",
|
|
1307
|
+
"brevo-private",
|
|
1308
|
+
"cdn",
|
|
1309
|
+
"checkout-com",
|
|
1310
|
+
"mailchimp",
|
|
1311
|
+
"mollie",
|
|
1312
|
+
"mongodb",
|
|
1313
|
+
"mqtt",
|
|
1314
|
+
"nodemailer",
|
|
1315
|
+
"payment-subscriptions",
|
|
1316
|
+
"postgres",
|
|
1317
|
+
"redis",
|
|
1318
|
+
"rethinkdb",
|
|
1319
|
+
"stripe"
|
|
1320
|
+
]);
|
|
1321
|
+
const FAMILIES = [
|
|
1322
|
+
"interface-",
|
|
1323
|
+
"file-storage-",
|
|
1324
|
+
"template-",
|
|
1325
|
+
"dms-"
|
|
1326
|
+
];
|
|
1327
|
+
const RETIRED = /* @__PURE__ */ new Set(["dms-builder"]);
|
|
1328
|
+
/** Whether a repository belongs to the framework and DMS stack, whose CI must run on Windows: the framework, its interfaces, modules and templates, and the DMS repositories. */
|
|
1329
|
+
function isStackRepo(name) {
|
|
1330
|
+
if (RETIRED.has(name)) return false;
|
|
1331
|
+
return FRAMEWORK.has(name) || MODULES.has(name) || FAMILIES.some((prefix) => name.startsWith(prefix));
|
|
1332
|
+
}
|
|
1333
|
+
//#endregion
|
|
1334
|
+
//#region src/garden/checks/windows.ts
|
|
1335
|
+
const CHECK = "windows-ci";
|
|
1336
|
+
const WORKFLOW = /^\.github\/workflows\/[^/]+\.ya?ml$/;
|
|
1337
|
+
/** Reports every framework and DMS stack repository whose workflows run no job on Windows. */
|
|
1338
|
+
const windowsCi = {
|
|
1339
|
+
id: CHECK,
|
|
1340
|
+
async run(context) {
|
|
1341
|
+
return perRepo((await context.repos()).filter(({ name }) => isStackRepo(name)), async (repo) => {
|
|
1342
|
+
const workflows = (await context.tree(repo)).filter((path) => WORKFLOW.test(path));
|
|
1343
|
+
for (const path of workflows) if (runsOnWindows(await context.file(repo, path) ?? "")) return [];
|
|
1344
|
+
return [finding({
|
|
1345
|
+
repo: repo.name,
|
|
1346
|
+
check: CHECK,
|
|
1347
|
+
subject: "windows"
|
|
1348
|
+
}, workflows.length ? `No job in ${workflows.join(", ")} runs on Windows.` : "The repository has no workflow.", "The ci-node.yml caller passes windows: true, or a workflow job runs on windows-latest.")];
|
|
1349
|
+
});
|
|
1350
|
+
}
|
|
1351
|
+
};
|
|
1352
|
+
//#endregion
|
|
1218
1353
|
//#region src/garden/checks/templates.ts
|
|
1219
1354
|
const DAY = 864e5;
|
|
1220
1355
|
const INTERFACES = "interfaces";
|
|
@@ -1363,6 +1498,7 @@ const CHECKS = [
|
|
|
1363
1498
|
webBuild,
|
|
1364
1499
|
linkRot,
|
|
1365
1500
|
captureScenes,
|
|
1501
|
+
windowsCi,
|
|
1366
1502
|
staleBranches
|
|
1367
1503
|
];
|
|
1368
1504
|
function compare(a, b) {
|