@antelopejs/tooling-configs 0.5.0 → 0.5.2
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 +68 -31
- package/dist/bin/api-diff.mjs +3 -3
- package/dist/bin/body-check.mjs +2 -2
- package/dist/bin/checks.mjs +157 -7
- package/dist/bin/comment-proof.mjs +2 -2
- package/dist/bin/garden.mjs +7 -2
- package/dist/bin/lease.mjs +48 -11
- package/dist/bin/ratchet.mjs +2 -2
- package/dist/bin/suppressions.mjs +1 -1
- package/dist/bin/sync.mjs +200 -484
- package/dist/bin/verify.mjs +211 -54
- package/dist/oxc/anti-slop/index.mjs +106 -366
- package/dist/oxc/guardrails/index.d.mts +1 -1
- package/dist/oxc/guardrails/index.mjs +279 -10
- package/dist/oxc/lint.d.mts +6 -0
- package/dist/oxc/lint.mjs +4 -2
- package/dist/{oxlint-DIV-lLSS.mjs → oxlint-BbpTFFmf.mjs} +7 -2
- package/dist/{package-Dn7VTFUW.mjs → package-DxxcxOzp.mjs} +28 -2
- package/dist/{proof-stamp-DLWpPwQE.mjs → proof-stamp-D9yo2dxU.mjs} +1 -1
- package/dist/{ratchet-BTiPMqam.mjs → ratchet--WWa_w2O.mjs} +3 -2
- package/dist/script-steps-CgH2DSsp.mjs +594 -0
- package/dist/{templates-lJBZFskp.mjs → templates-BiXgdsRN.mjs} +1 -1
- package/dist/{typescript-BBbry7uU.mjs → typescript-D7SaSmsl.mjs} +1 -1
- package/dist/{ci-workflow-COJUT12b.mjs → workflow-B0FmthGv.mjs} +107 -107
- package/package.json +3 -2
package/dist/bin/garden.mjs
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import { t as admits } from "../semver-BDxeEcP_.mjs";
|
|
3
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";
|
|
4
4
|
import { n as runCliAsync } from "../cli-4Tv71vYk.mjs";
|
|
5
|
-
import {
|
|
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-B0FmthGv.mjs";
|
|
6
6
|
import { i as ghToken, n as createApi, t as ApiError } from "../api-CCOiLN3w.mjs";
|
|
7
7
|
import { parseArgs } from "node:util";
|
|
8
8
|
import { inflateRawSync } from "node:zlib";
|
|
@@ -770,6 +770,8 @@ async function tooling(context) {
|
|
|
770
770
|
const CHECK$1 = "conformance";
|
|
771
771
|
const DAY$2 = 864e5;
|
|
772
772
|
const MEND_EXEMPT = /* @__PURE__ */ new Set(["k8s-gitops-infra"]);
|
|
773
|
+
/** 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. */
|
|
774
|
+
const CI_CALLER_EXEMPT = /* @__PURE__ */ new Set(["tooling-configs"]);
|
|
773
775
|
function problem(repo, subject, evidence, doneMeans) {
|
|
774
776
|
return finding({
|
|
775
777
|
repo: repo.name,
|
|
@@ -778,6 +780,7 @@ function problem(repo, subject, evidence, doneMeans) {
|
|
|
778
780
|
}, evidence, doneMeans);
|
|
779
781
|
}
|
|
780
782
|
async function ciCaller(context, repo) {
|
|
783
|
+
if (CI_CALLER_EXEMPT.has(repo.name)) return [];
|
|
781
784
|
const text = await context.file(repo, CI_PATH);
|
|
782
785
|
if (text === void 0) return [problem(repo, "ci-caller", `${CI_PATH} does not exist.`, `${CI_PATH} has a job calling ${CI_NODE_REF}.`)];
|
|
783
786
|
const callers = ciNodeCallers(text);
|
|
@@ -803,7 +806,9 @@ async function installed(context, repo, range) {
|
|
|
803
806
|
return (await context.file(repo, "pnpm-lock.yaml"))?.match(LOCK_ENTRY)?.[1] ?? range.replace(/^[^\d]*/, "");
|
|
804
807
|
}
|
|
805
808
|
async function toolingVersion(context, repo) {
|
|
806
|
-
const
|
|
809
|
+
const manifests = await context.packages(repo);
|
|
810
|
+
if (manifests.some(({ name }) => name === "@antelopejs/tooling-configs")) return [];
|
|
811
|
+
const range = manifests.map(({ tooling: declared }) => declared).find((declared) => declared !== void 0);
|
|
807
812
|
const latest = await tooling(context);
|
|
808
813
|
const done = `@antelopejs/tooling-configs is ${latest} or a Renovate PR bumping it is under 7 days old.`;
|
|
809
814
|
if (range === void 0) return [problem(repo, "tooling-configs", "@antelopejs/tooling-configs is not a dependency.", done)];
|
package/dist/bin/lease.mjs
CHANGED
|
@@ -122,15 +122,15 @@ function launch(command, env) {
|
|
|
122
122
|
const STAT_AFTER_COMM = 2;
|
|
123
123
|
const STAT_PPID = 1;
|
|
124
124
|
const STAT_PGID = 2;
|
|
125
|
-
const STAT_START = 19;
|
|
126
|
-
const DEAD_STATES = /* @__PURE__ */ new Set(["Z", "X"]);
|
|
125
|
+
const STAT_START$1 = 19;
|
|
126
|
+
const DEAD_STATES$1 = /* @__PURE__ */ new Set(["Z", "X"]);
|
|
127
127
|
function fromProc(pid) {
|
|
128
128
|
const stat = readFileSync(`/proc/${pid}/stat`, "utf8");
|
|
129
129
|
const fields = stat.slice(stat.lastIndexOf(")") + STAT_AFTER_COMM).split(" ");
|
|
130
|
-
if (DEAD_STATES.has(fields[0] ?? "")) return void 0;
|
|
130
|
+
if (DEAD_STATES$1.has(fields[0] ?? "")) return void 0;
|
|
131
131
|
return {
|
|
132
132
|
pid,
|
|
133
|
-
start: `${readFileSync("/proc/sys/kernel/random/boot_id", "utf8").trim()}:${fields[STAT_START]}`,
|
|
133
|
+
start: `${readFileSync("/proc/sys/kernel/random/boot_id", "utf8").trim()}:${fields[STAT_START$1]}`,
|
|
134
134
|
uid: statSync(`/proc/${pid}`).uid,
|
|
135
135
|
pgid: Number(fields[STAT_PGID]),
|
|
136
136
|
ppid: Number(fields[STAT_PPID])
|
|
@@ -150,7 +150,7 @@ function fromPs(pid) {
|
|
|
150
150
|
"ignore"
|
|
151
151
|
]
|
|
152
152
|
}).trim().split(/\s+/u);
|
|
153
|
-
if (state === void 0 || DEAD_STATES.has(state.slice(0, 1))) return void 0;
|
|
153
|
+
if (state === void 0 || DEAD_STATES$1.has(state.slice(0, 1))) return void 0;
|
|
154
154
|
return {
|
|
155
155
|
pid,
|
|
156
156
|
start: started.join(" "),
|
|
@@ -184,6 +184,8 @@ function assertSignallable(pid) {
|
|
|
184
184
|
const READY_TIMEOUT_MS = 3e4;
|
|
185
185
|
const KILL_WAIT_MS$1 = 2e3;
|
|
186
186
|
const POLL_MS$1 = 50;
|
|
187
|
+
const STAT_START = 19;
|
|
188
|
+
const DEAD_STATES = /* @__PURE__ */ new Set(["Z", "X"]);
|
|
187
189
|
const CACHED_BINARY = /^mongod-.+-(\d+)\.(\d+)\.(\d+)$/u;
|
|
188
190
|
function executable(path) {
|
|
189
191
|
try {
|
|
@@ -259,11 +261,44 @@ function mongodPid(dbpath) {
|
|
|
259
261
|
function serves(pid, dbpath) {
|
|
260
262
|
return commandLine(pid).includes(dbpath);
|
|
261
263
|
}
|
|
262
|
-
/**
|
|
263
|
-
|
|
264
|
+
/** The fields of `/proc/<path>/stat` after the command name, the state first; `undefined` when it cannot be read. */
|
|
265
|
+
function statFields(path) {
|
|
266
|
+
try {
|
|
267
|
+
const stat = readFileSync(`/proc/${path}/stat`, "utf8");
|
|
268
|
+
return stat.slice(stat.lastIndexOf(")") + 2).split(" ");
|
|
269
|
+
} catch {
|
|
270
|
+
return;
|
|
271
|
+
}
|
|
272
|
+
}
|
|
273
|
+
/** True while some thread of `pid` has not exited, a main thread that exited before the others included. */
|
|
274
|
+
function anyThreadRuns(pid) {
|
|
275
|
+
let tids;
|
|
276
|
+
try {
|
|
277
|
+
tids = readdirSync(`/proc/${pid}/task`);
|
|
278
|
+
} catch {
|
|
279
|
+
return false;
|
|
280
|
+
}
|
|
281
|
+
return tids.some((tid) => {
|
|
282
|
+
const state = statFields(`${pid}/task/${tid}`)?.[0];
|
|
283
|
+
return state !== void 0 && !DEAD_STATES.has(state);
|
|
284
|
+
});
|
|
285
|
+
}
|
|
286
|
+
/**
|
|
287
|
+
* A check that answers whether the mongod `pid` serving `dbpath` still runs. On Linux it holds
|
|
288
|
+
* until no thread of the process started at the same time as `pid` now runs: the command line
|
|
289
|
+
* reads empty from the moment mongod drops its memory, while its threads still hold its port. A
|
|
290
|
+
* reused pid has another start time. Elsewhere it holds while the command line names `dbpath`.
|
|
291
|
+
*/
|
|
292
|
+
function runningCheck(pid, dbpath) {
|
|
293
|
+
if (process.platform !== "linux") return () => serves(pid, dbpath);
|
|
294
|
+
const start = statFields(String(pid))?.[STAT_START];
|
|
295
|
+
return () => start !== void 0 && statFields(String(pid))?.[STAT_START] === start && anyThreadRuns(pid);
|
|
296
|
+
}
|
|
297
|
+
/** Waits up to `ms` for `runs` to answer false; answers whether it did. */
|
|
298
|
+
async function untilGone$1(runs, ms) {
|
|
264
299
|
const deadline = Date.now() + ms;
|
|
265
|
-
while (
|
|
266
|
-
return !
|
|
300
|
+
while (runs() && Date.now() < deadline) await setTimeout(POLL_MS$1);
|
|
301
|
+
return !runs();
|
|
267
302
|
}
|
|
268
303
|
function signal$1(pid, name) {
|
|
269
304
|
assertSignallable(pid);
|
|
@@ -280,12 +315,14 @@ function signal$1(pid, name) {
|
|
|
280
315
|
async function stopMongod(dbpath, graceMs) {
|
|
281
316
|
const pid = mongodPid(dbpath);
|
|
282
317
|
if (pid === void 0) return;
|
|
318
|
+
const runs = runningCheck(pid, dbpath);
|
|
319
|
+
if (!runs()) return;
|
|
283
320
|
if (graceMs > 0) {
|
|
284
321
|
signal$1(pid, "SIGTERM");
|
|
285
|
-
if (await untilGone$1(
|
|
322
|
+
if (await untilGone$1(runs, graceMs)) return;
|
|
286
323
|
}
|
|
287
324
|
signal$1(pid, "SIGKILL");
|
|
288
|
-
if (await untilGone$1(
|
|
325
|
+
if (await untilGone$1(runs, KILL_WAIT_MS$1)) return;
|
|
289
326
|
throw new Error(`antelopejs-lease: mongod ${pid} was still running ${KILL_WAIT_MS$1 / 1e3} s after SIGKILL`);
|
|
290
327
|
}
|
|
291
328
|
async function holder(port) {
|
package/dist/bin/ratchet.mjs
CHANGED
|
@@ -3,8 +3,8 @@ import { c as parseCeilings, l as readCeilings, t as CEILINGS_FILE } from "../ce
|
|
|
3
3
|
import { n as renamedPaths } from "../renames-L2owF5GD.mjs";
|
|
4
4
|
import { t as runCli } from "../cli-4Tv71vYk.mjs";
|
|
5
5
|
import { c as repositoryRoot, l as resolveRevision, t as LINT_CONFIG } from "../files-DJ0TeaTU.mjs";
|
|
6
|
-
import { n as ratchet, r as withPreviousTree } from "../ratchet
|
|
7
|
-
import { t as lintDiagnostics } from "../oxlint-
|
|
6
|
+
import { n as ratchet, r as withPreviousTree } from "../ratchet--WWa_w2O.mjs";
|
|
7
|
+
import { t as lintDiagnostics } from "../oxlint-BbpTFFmf.mjs";
|
|
8
8
|
import { d as stagedAdditions, f as stagedChanges, u as previousLine } from "../suppression-budget-Dvb_IqBo.mjs";
|
|
9
9
|
import { n as suppressionBase } from "../suppression-base-Drnl6Y7F.mjs";
|
|
10
10
|
import { existsSync } from "node:fs";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { t as runCli } from "../cli-4Tv71vYk.mjs";
|
|
3
3
|
import { c as repositoryRoot, r as changedFiles } from "../files-DJ0TeaTU.mjs";
|
|
4
|
-
import { n as unusedDirectives } from "../oxlint-
|
|
4
|
+
import { n as unusedDirectives } from "../oxlint-BbpTFFmf.mjs";
|
|
5
5
|
import { c as stagedSuppressions, i as checkSuppressions, l as checkPolicy, s as stagedNames } from "../suppression-budget-Dvb_IqBo.mjs";
|
|
6
6
|
import { c as suppressionsIn, i as inWorktree } from "../suppressions-BroaaGJ_.mjs";
|
|
7
7
|
import { n as suppressionBase, t as raisedCeilings } from "../suppression-base-Drnl6Y7F.mjs";
|