@antelopejs/tooling-configs 0.3.5 → 0.3.6
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 +20 -2
- package/dist/bin/checks.mjs +348 -8
- package/dist/bin/garden.mjs +1 -1
- package/dist/bin/sync.mjs +486 -14
- package/dist/bin/verify.mjs +552 -275
- package/dist/{ci-workflow-C4mQ8QSp.mjs → ci-workflow-37qJa9LX.mjs} +33 -10
- package/dist/{map-s_jKqBQv.mjs → map-CiFEGFRz.mjs} +22 -4
- package/dist/verify/index.d.mts +1 -0
- package/package.json +3 -2
|
@@ -352,14 +352,36 @@ function skipRenovateSync(document, job) {
|
|
|
352
352
|
else job.set("with", document.createNode({ "renovate-sync": false }));
|
|
353
353
|
return true;
|
|
354
354
|
}
|
|
355
|
-
function
|
|
355
|
+
function setTestJob(document, job, placeholderTests) {
|
|
356
356
|
const inputs = job.get("with", true);
|
|
357
357
|
if (isMap(inputs)) {
|
|
358
|
-
if (inputs.has("test-job"))
|
|
359
|
-
|
|
360
|
-
|
|
358
|
+
if (!inputs.has("test-job")) {
|
|
359
|
+
inputs.set("test-job", !placeholderTests);
|
|
360
|
+
return true;
|
|
361
|
+
}
|
|
362
|
+
if (!placeholderTests || inputs.get("test-job") === false) return false;
|
|
363
|
+
inputs.set("test-job", false);
|
|
364
|
+
return true;
|
|
365
|
+
}
|
|
366
|
+
job.set("with", document.createNode({ "test-job": !placeholderTests }));
|
|
361
367
|
return true;
|
|
362
368
|
}
|
|
369
|
+
/** The caller sync writes into a repository without one, its test job off when the `test` script is a placeholder. */
|
|
370
|
+
function newCaller(placeholderTests) {
|
|
371
|
+
return placeholderTests ? CI_CALLER.replace("test-job: true", "test-job: false") : CI_CALLER;
|
|
372
|
+
}
|
|
373
|
+
/**
|
|
374
|
+
* Whether a `test` script only stands in for tests: made only of `echo` and
|
|
375
|
+
* `exit 0` commands, such as `echo 'No tests defined'`. A missing script is
|
|
376
|
+
* not a placeholder, since the shared test job may run tests another way. Such a
|
|
377
|
+
* repository gets `test-job: false`, since a test job would only spend runner
|
|
378
|
+
* time printing it.
|
|
379
|
+
*/
|
|
380
|
+
function placeholderTestScript(script) {
|
|
381
|
+
if (script === void 0) return false;
|
|
382
|
+
const commands = script.split(/&&|\|\||;/).map((command) => command.trim()).filter(Boolean);
|
|
383
|
+
return commands.length > 0 && commands.every((command) => /^echo(\s|$)/.test(command) || /^exit\s+0$/.test(command));
|
|
384
|
+
}
|
|
363
385
|
function lines(text) {
|
|
364
386
|
return text.split("\n").map((line) => line.trim()).filter(Boolean);
|
|
365
387
|
}
|
|
@@ -426,8 +448,9 @@ function dropRedundantAggregator(jobs, syncCallers) {
|
|
|
426
448
|
* Keeps the shared CI caller on the job id `ci` with no `name`, so the shared workflow reports `ci / checks`,
|
|
427
449
|
* dispatchable and read-only, with the Renovate sync it would otherwise run turned off. The write permissions the sync
|
|
428
450
|
* needs to push and dispatch the caller live on a separate job calling ci-renovate-sync.yml, which is added when missing.
|
|
429
|
-
* A caller without a `test-job` input gets `test-job: true`, which runs the tests in their own job
|
|
430
|
-
*
|
|
451
|
+
* A caller without a `test-job` input gets `test-job: true`, which runs the tests in their own job, or `false` when
|
|
452
|
+
* `placeholderTests` says the `test` script only stands in for tests; that case also turns an existing `true` off. Any
|
|
453
|
+
* other explicit value is left as the repository set it.
|
|
431
454
|
* A `checks` job that only re-aggregates the caller (`needs: [ci]`, steps that `exit` on `needs` results) is removed
|
|
432
455
|
* when the workflow has no other job besides the caller and the Renovate sync, since the shared workflow already
|
|
433
456
|
* reports `ci / checks` and each `needs` hop adds to the critical path. A gate that also covers repository-specific
|
|
@@ -436,8 +459,8 @@ function dropRedundantAggregator(jobs, syncCallers) {
|
|
|
436
459
|
* When `docsFiles` computes paths, every caller's `docs-files` input lists them first, then keeps its hand-listed paths
|
|
437
460
|
* that still exist, so sync never drops coverage.
|
|
438
461
|
*/
|
|
439
|
-
function ciWorkflow(current, callers, syncCallers, docsFiles) {
|
|
440
|
-
if (current === void 0) return
|
|
462
|
+
function ciWorkflow(current, callers, syncCallers, docsFiles, placeholderTests = false) {
|
|
463
|
+
if (current === void 0) return newCaller(placeholderTests);
|
|
441
464
|
if (!callers.length) return current;
|
|
442
465
|
const document = parseDocument(current);
|
|
443
466
|
if (document.errors.length) throw new Error(`${CI_PATH}: ${document.errors.map(({ message }) => message).join("; ")}`);
|
|
@@ -460,7 +483,7 @@ function ciWorkflow(current, callers, syncCallers, docsFiles) {
|
|
|
460
483
|
}
|
|
461
484
|
changed = grant(document, pair.value, { contents: "read" }) || changed;
|
|
462
485
|
changed = skipRenovateSync(document, pair.value) || changed;
|
|
463
|
-
changed =
|
|
486
|
+
changed = setTestJob(document, pair.value, placeholderTests) || changed;
|
|
464
487
|
changed = ensureSyncJob(document, jobs, syncCallers) || changed;
|
|
465
488
|
const removed = dropRedundantAggregator(jobs, syncCallers);
|
|
466
489
|
changed = removed.length > 0 || changed;
|
|
@@ -478,4 +501,4 @@ function ciWorkflow(current, callers, syncCallers, docsFiles) {
|
|
|
478
501
|
});
|
|
479
502
|
}
|
|
480
503
|
//#endregion
|
|
481
|
-
export { ciWorkflow as a,
|
|
504
|
+
export { ciWorkflow as a, ciNodeCallers as c, RENOVATE_CONFIGS as d, RENOVATE_PRESET as f, CI_RENOVATE_SYNC_REF as i, ciRenovateSyncCallers as l, CI_NODE_REF as n, placeholderTestScript as o, renovateArtifacts as p, CI_PATH as r, MISSING_CHECKS_WORKFLOW as s, CI_CONTEXT as t, hasChecksWorkflow as u };
|
|
@@ -2,7 +2,7 @@ import { l as skillFolder } from "./shared-igPpEDpS.mjs";
|
|
|
2
2
|
import { f as parseJson, i as isObject } from "./json-CG2L7YFl.mjs";
|
|
3
3
|
import { c as leaseTmpDir, i as PARENT_TMPDIR, n as LEASE_DIR, r as LEASE_MARKER, t as DEV_STACK_VARIABLES } from "./env-DT0UJNeL.mjs";
|
|
4
4
|
import { chmodSync, existsSync, lstatSync, mkdirSync, readFileSync, readdirSync, realpathSync, rmSync, utimesSync, writeFileSync } from "node:fs";
|
|
5
|
-
import { basename, dirname, join, matchesGlob, relative, resolve } from "node:path";
|
|
5
|
+
import { basename, delimiter, dirname, join, matchesGlob, relative, resolve } from "node:path";
|
|
6
6
|
import { execFileSync } from "node:child_process";
|
|
7
7
|
import { pathToFileURL } from "node:url";
|
|
8
8
|
import { randomBytes } from "node:crypto";
|
|
@@ -198,6 +198,20 @@ function isolatedEnv(workspace, home, extra = {}) {
|
|
|
198
198
|
...extra
|
|
199
199
|
};
|
|
200
200
|
}
|
|
201
|
+
/**
|
|
202
|
+
* `path` with the repository's `node_modules/.bin` first, as `pnpm exec`
|
|
203
|
+
* puts it, so setup commands, journeys and formal checks find the
|
|
204
|
+
* repository's own bins whether the CLI was started through `pnpm exec` or
|
|
205
|
+
* through `node_modules/.bin/antelopejs-verify`. A `path` that already lists
|
|
206
|
+
* that folder, as `pnpm exec` from a package of a workspace does after the
|
|
207
|
+
* package's own, is kept as it is, and so is an unset or empty one, which
|
|
208
|
+
* leaves children the system's default search path.
|
|
209
|
+
*/
|
|
210
|
+
function withLocalBins(root, path) {
|
|
211
|
+
if (!path) return path;
|
|
212
|
+
const bins = resolve(root, "node_modules", ".bin");
|
|
213
|
+
return path.split(delimiter).some((entry) => entry !== "" && resolve(root, entry) === bins) ? path : `${bins}${delimiter}${path}`;
|
|
214
|
+
}
|
|
201
215
|
//#endregion
|
|
202
216
|
//#region src/verify/map.ts
|
|
203
217
|
/** The feature that always runs, whatever the diff touches. */
|
|
@@ -236,10 +250,14 @@ const SHARED_BY_ALL = [
|
|
|
236
250
|
"tsconfig.*.json",
|
|
237
251
|
"antelope-lock/**"
|
|
238
252
|
];
|
|
239
|
-
/** The files whose change can break any feature, so a diff touching one runs them all. */
|
|
253
|
+
/** The files whose change can break any feature, so a diff touching one runs them all. A module declares its interfaces under `src/interfaces/` or, with a single one, `src/interface/`. */
|
|
240
254
|
const DEFAULT_SHARED = {
|
|
241
255
|
interface: SHARED_BY_ALL,
|
|
242
|
-
module: [
|
|
256
|
+
module: [
|
|
257
|
+
...SHARED_BY_ALL,
|
|
258
|
+
"src/interfaces/**",
|
|
259
|
+
"src/interface/**"
|
|
260
|
+
],
|
|
243
261
|
template: [
|
|
244
262
|
...SHARED_BY_ALL,
|
|
245
263
|
"antelope.config.*",
|
|
@@ -394,4 +412,4 @@ function planFor(workspace, baseRef, all = false) {
|
|
|
394
412
|
};
|
|
395
413
|
}
|
|
396
414
|
//#endregion
|
|
397
|
-
export { readFeatures as a, allocateRun as c, loadRun as d, openWorkspace as f, saveRun as g, removeTree as h, planFor as i, git as l, operatorTmpdir as m, SMOKE_FEATURE as n, CACHE_DIR as o, operatorEnv as p, checkMap as r, RUNS_DIR as s, DEFAULT_SHARED as t, isolatedEnv as u };
|
|
415
|
+
export { withLocalBins as _, readFeatures as a, allocateRun as c, loadRun as d, openWorkspace as f, saveRun as g, removeTree as h, planFor as i, git as l, operatorTmpdir as m, SMOKE_FEATURE as n, CACHE_DIR as o, operatorEnv as p, checkMap as r, RUNS_DIR as s, DEFAULT_SHARED as t, isolatedEnv as u };
|
package/dist/verify/index.d.mts
CHANGED
|
@@ -39,6 +39,7 @@ interface FormalCheck {
|
|
|
39
39
|
files?: string[];
|
|
40
40
|
/** Runs from the repository root; exits 0 while every finding breaks as recorded. */
|
|
41
41
|
command: string[];
|
|
42
|
+
/** The first capture group names a rule the output reports as broken, and an optional group named `states`, after it, gives its counterexample length in decimal digits; a `states` group that is the first group, that captures anything but digits, or whose number is above `Number.MAX_SAFE_INTEGER` gives no length; a covered behaviour change keeps the base's findings as known only when every one has the same length at HEAD as on the base. Without `violation`, a non-zero exit is the one rule `property` broken. */
|
|
42
43
|
violation: RegExp | null;
|
|
43
44
|
/** The first capture group names a rule the output reports as holding; a base finding counts as fixed only when HEAD reports it so. Without `passing` and `violation`, a zero exit is the one rule `property` holding. */
|
|
44
45
|
passing?: RegExp | null;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@antelopejs/tooling-configs",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.6",
|
|
4
4
|
"description": "Shared tooling presets for AntelopeJS repositories: oxlint (with the vendored anti-slop rules), oxfmt, ESLint for Nuxt layers, Knip, and an interface range check",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"antelopejs",
|
|
@@ -61,7 +61,7 @@
|
|
|
61
61
|
"lint:fix": "oxlint --fix",
|
|
62
62
|
"format": "oxfmt .",
|
|
63
63
|
"prepack": "pnpm run build",
|
|
64
|
-
"release": "pnpm run lint && pnpm run prepack && release-it",
|
|
64
|
+
"release": "pnpm run lint && pnpm run typecheck && pnpm run prepack && release-it",
|
|
65
65
|
"typecheck": "tsc --noEmit",
|
|
66
66
|
"test": "node --test \"src/**/*.test.ts\"",
|
|
67
67
|
"checks": "node src/bin/checks.ts",
|
|
@@ -86,6 +86,7 @@
|
|
|
86
86
|
"devDependencies": {
|
|
87
87
|
"@nuxt/eslint-config": "^1.17.0",
|
|
88
88
|
"@types/node": "^24.13.3",
|
|
89
|
+
"@types/semver": "^7.8.0",
|
|
89
90
|
"eslint-plugin-perfectionist": "^5.11.0",
|
|
90
91
|
"knip": "^6.34.0",
|
|
91
92
|
"lefthook": "^2.2.2",
|