@antelopejs/tooling-configs 0.5.1 → 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 +16 -6
- package/dist/bin/api-diff.mjs +3 -3
- package/dist/bin/body-check.mjs +2 -2
- package/dist/bin/checks.mjs +121 -5
- package/dist/bin/comment-proof.mjs +2 -2
- package/dist/bin/garden.mjs +1 -1
- package/dist/bin/ratchet.mjs +2 -2
- package/dist/bin/suppressions.mjs +1 -1
- package/dist/bin/sync.mjs +180 -550
- package/dist/oxc/lint.mjs +1 -1
- 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-ClfblHNJ.mjs → ratchet--WWa_w2O.mjs} +2 -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/README.md
CHANGED
|
@@ -26,7 +26,7 @@ The AntelopeJS guardrail pack: shared lint, format and dead-code presets, the co
|
|
|
26
26
|
| `./oxc/anti-slop` | Loaded by the oxlint preset as a JS plugin | The vendored [anti-slop](https://github.com/dmmulroy/anti-slop) rules |
|
|
27
27
|
| `./oxc/guardrails` | Loaded by the oxlint preset as a JS plugin | The `antelopejs` comment and test-quality rules |
|
|
28
28
|
| `./verify` | `import type { VerifyConfig } from "@antelopejs/tooling-configs/verify"` | Types and check helpers for a shared verification skill's `verify.config.ts` |
|
|
29
|
-
| bin | `antelopejs-sync`
|
|
29
|
+
| bin | `antelopejs-sync [--init]` | Writes the guardrail pack into a repository; `--check` reports drift; `--init` onboards a bare repository |
|
|
30
30
|
| bin | `antelopejs-checks [--no-services]` | Runs every check and prints only the failures; starts `.github/compose.yml` services around them |
|
|
31
31
|
| bin | `antelopejs-ratchet` | Fails when recorded debt grows; `--update` lowers the record and adopts rules a pack release newly enabled |
|
|
32
32
|
| bin | `antelopejs-suppressions` | Fails when suppressions exceed their budget or an added one breaks policy; `--update` lowers the budget |
|
|
@@ -126,9 +126,9 @@ export default defineConfig({
|
|
|
126
126
|
| Guardrails | `antelopejs/no-comments`, `antelopejs/no-inherited-key-lookup`, `antelopejs/no-presence-only-type-guard`, `antelopejs/no-read-then-insert`, and with type-aware lint `antelopejs/no-unsafe-object-assign` and `antelopejs/require-tsconfig-include`; in test files `antelopejs/no-fs-read-in-tests`, `antelopejs/no-self-import-in-tests`, `antelopejs/no-constant-value-assertion`, `antelopejs/no-typeof-function-only-test` and `antelopejs/require-assertion` | error |
|
|
127
127
|
| Import sorting | `perfectionist/sort-imports`, autofixed by `oxlint --fix` | off |
|
|
128
128
|
|
|
129
|
-
Three anti-slop rules skip a value at its boundary. `no-runtime-typeof` also counts a `.js`/`.mjs` function documented `@returns {x is T}` as a type guard. `no-unsafe-dictionary-type` allows `Record<string, unknown>` as a `value is T` target or inside a type-guard body. `no-unknown-parameters` skips a `this` parameter, a parameter decorated `@JSONBody`, `@JsonBody` or `@Parameter`, the reason of a callback passed directly to `.catch(...)` or as `.then(_, onRejected)`, the parameter of a `(reason: unknown) => void` type declared as `reject` or on a `new Promise` executor, the `unknown` parameters of a function type that annotates a plain callback parameter which the function only calls (and tests for existence), at least once, passing a never-reassigned catch variable in each `unknown` position (a callback that is stored, passed on, never called or called with any other value stays reported), a parameter typed exactly `unknown` of a function whose declared return type is primitive and whose only use of it is to read a symbol-keyed member (`value[BRAND]`, `BRAND in value`) of a `const` bound to `Symbol(...)` or `Symbol.for(...)` in the file, directly, through a `const` alias, or through a function declared in the file that does the same, behind type guards declared in the file, where the member is only read and what is read reaches nothing but the result (it may be tested, compared, negated, read further, passed to `Boolean(...)` or held in a `const` that obeys the same rule; a write, `delete`, update, call of the member, or an argument to any other call refuses), the brand probe, and a parameter typed exactly `unknown` at a parse boundary:
|
|
129
|
+
Three anti-slop rules skip a value at its boundary. `no-runtime-typeof` also counts a `.js`/`.mjs` function documented `@returns {x is T}` as a type guard. `no-unsafe-dictionary-type` allows `Record<string, unknown>` as a `value is T` target or inside a type-guard body. `no-unknown-parameters` skips a `this` parameter, a parameter decorated `@JSONBody`, `@JsonBody` or `@Parameter`, the reason of a callback passed directly to `.catch(...)` or as `.then(_, onRejected)`, the parameter of a `(reason: unknown) => void` type declared as `reject` or on a `new Promise` executor, the `unknown` parameters of a function type that annotates a plain callback parameter which the function only calls (and tests for existence), at least once, passing a never-reassigned catch variable in each `unknown` position (a callback that is stored, passed on, never called or called with any other value stays reported), a parameter typed exactly `unknown` of a function whose declared return type is primitive and whose only use of it is to read a symbol-keyed member (`value[BRAND]`, `BRAND in value`) of a `const` bound to `Symbol(...)` or `Symbol.for(...)` in the file, directly, through a `const` alias, or through a function declared in the file that does the same, behind type guards declared in the file, where the member is only read and what is read reaches nothing but the result (it may be tested, compared, negated, read further, passed to `Boolean(...)` or held in a `const` that obeys the same rule; a write, `delete`, update, call of the member, or an argument to any other call refuses), the brand probe, and a parameter typed exactly `unknown` at a parse boundary: every read of it is the direct argument of a decoder (`parse`, `safeParse`, `parseAsync`, `safeParseAsync`, `decode`, or a `parseX` or `decodeX` helper) read from an import of a schema library (`zod`, `valibot`, `yup`, `joi`, `superstruct`, `io-ts`, `@sinclair/typebox`, `arktype`, `effect`, `@effect/schema`, subpaths included) through members, calls, type wrappers and `const` aliases, the file reassigns no name on that path and writes none of its properties (an assignment, update, `delete`, `Object.assign`, `Object.defineProperty`, `Reflect.set` and the like), the function never mentions `arguments` or `eval`, and it returns that call's result, awaited or read through `.data`, under a declared return type other than `unknown` or `any`. A decoder of any other origin is reported: one written in the file, imported from another file of the repository, handed in as a parameter, or reached through a helper such as `assertValidation` that runs whatever validator it is handed.
|
|
130
130
|
|
|
131
|
-
`no-runtime-typeof`
|
|
131
|
+
`no-runtime-typeof` also reports a `typeof` that only fills in the text of a message, such as ``throw new Error(`received ${typeof value}`)`` or ``assert(ok, `received ${typeof value}`)``: one file cannot see what catches, compares or records the message.
|
|
132
132
|
|
|
133
133
|
No rule warns. oxlint reports `correctness` as warnings by default, and warnings never fail the command, so the preset raises it to error. A repository with existing findings records them in `guardrails.ratchet.json` instead of lowering a severity (see [Guardrail pack](#guardrail-pack)).
|
|
134
134
|
|
|
@@ -189,10 +189,20 @@ export default defineConfig({
|
|
|
189
189
|
|
|
190
190
|
## Guardrail pack
|
|
191
191
|
|
|
192
|
-
|
|
192
|
+
Onboard a repository with one command at its root. The repository needs a `package.json` and a git remote on GitHub.
|
|
193
|
+
|
|
194
|
+
```bash
|
|
195
|
+
pnpm dlx --package=@antelopejs/tooling-configs antelopejs-sync --init
|
|
196
|
+
npx --package=@antelopejs/tooling-configs antelopejs-sync --init
|
|
197
|
+
```
|
|
198
|
+
|
|
199
|
+
`--init` adds `node_modules` to `.gitignore` and declares each of `@antelopejs/tooling-configs`, `oxlint`, `oxlint-tsgolint` and `oxfmt` the repository does not declare yet. It installs with the repository's package manager, runs `antelopejs-sync`, installs again when sync added devDependencies, and formats `package.json` with the installed oxfmt. It takes the full profile only and rejects `--check` and `--profile template`. Install output shows only when the install fails.
|
|
200
|
+
|
|
201
|
+
It then sets `delete_branch_on_merge` through `gh` when it can, even when an earlier step failed. When `gh` is missing, unauthenticated or refused, `--init` prints the `gh api -X PATCH repos/{owner}/{repo} -F delete_branch_on_merge=true` command to run and exits 1. After any failure, fix what it printed and rerun `antelopejs-sync --init`. Commit and push to the default branch afterwards, so the first run reports `ci / checks`.
|
|
202
|
+
|
|
203
|
+
Every step is idempotent: a second run changes nothing. Plain `antelopejs-sync` also runs from a repository that already has the devDependencies installed:
|
|
193
204
|
|
|
194
205
|
```bash
|
|
195
|
-
pnpm add -D @antelopejs/tooling-configs oxlint@1.81.0 oxlint-tsgolint oxfmt
|
|
196
206
|
pnpm exec antelopejs-sync
|
|
197
207
|
pnpm install
|
|
198
208
|
```
|
|
@@ -221,7 +231,7 @@ pnpm install
|
|
|
221
231
|
|
|
222
232
|
`ANTELOPEJS_CHECKS_SKIP` accepts both names.
|
|
223
233
|
|
|
224
|
-
The steps run at the same time, `test` last and alone. When
|
|
234
|
+
The steps run at the same time, `test` last and alone. When `typecheck` writes files, it runs first and the other steps start after it, so `lint` never resolves a workspace package's `dist` that `typecheck` is rebuilding. `typecheck` writes files when the scripts it runs reach a `build` script or a `tsc` that leaves `noEmit` unset on its command line and in its tsconfig chain, following `--filter`, `--dir` and `-r` into workspace packages. A package-manager target it cannot resolve, such as a `--dir` read from a variable or a dependency `--filter` like `pkg...`, counts as writing. A build that a wrapper script runs, such as `node scripts/run.mjs pnpm build`, is not seen. When a wrapper hides the build, or two other steps share what one of them builds, add a `checks:prepare` package script that builds it. `pnpm run checks` runs it once before any step and after it checks that Docker Compose can run, whenever at least one step runs. Its output is printed only when it fails, and then no step runs. It counts as a step only when it fails, and a repository without it runs as before.
|
|
225
235
|
|
|
226
236
|
When the repository has `.github/compose.yml`, the file the shared CI starts through its `services-compose-file` input, and the `test` step runs, `pnpm run checks` runs `docker compose -f .github/compose.yml up -d --wait` before the steps and `docker compose -f .github/compose.yml down -v` after them, also when a step fails or the run is interrupted (SIGINT, SIGTERM or SIGHUP stops the running step or `up`, removes the services and exits 130, 143 or 129; a repeated signal does not cut the teardown short). The compose project is `COMPOSE_PROJECT_NAME` when set, else the file's own `name:`, else one named after the repository root, so checkouts never share the `github` project compose would derive from the file's directory. Services are left alone when every port the file publishes already accepts connections, so a stack you started yourself is reused and kept. A run's project that already had containers before the run is started but not removed. When Docker Compose cannot run, the run fails before any step, naming the compose file, because the tests that need those services would wait for them forever. On GitHub Actions (`GITHUB_ACTIONS=true`) the workflow owns the services, and `--no-services` skips all of this anywhere.
|
|
227
237
|
|
package/dist/bin/api-diff.mjs
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { a as
|
|
2
|
+
import { a as packageManager, o as parseManifest } from "../package-DxxcxOzp.mjs";
|
|
3
3
|
import { t as runCli } from "../cli-4Tv71vYk.mjs";
|
|
4
4
|
import { c as repositoryRoot, l as resolveRevision } from "../files-DJ0TeaTU.mjs";
|
|
5
|
-
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-
|
|
6
|
-
import { c as packagesAt, i as isTestSource, l as unpublishedAt, o as loadTypeScript, r as isExportPath, s as outputRoot, t as emitPackage } from "../typescript-
|
|
5
|
+
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-D9yo2dxU.mjs";
|
|
6
|
+
import { c as packagesAt, i as isTestSource, l as unpublishedAt, o as loadTypeScript, r as isExportPath, s as outputRoot, t as emitPackage } from "../typescript-D7SaSmsl.mjs";
|
|
7
7
|
import { createRequire } from "node:module";
|
|
8
8
|
import { copyFileSync, cpSync, existsSync, globSync, mkdirSync, readFileSync, readdirSync, realpathSync, rmSync, statSync, symlinkSync, writeFileSync } from "node:fs";
|
|
9
9
|
import { basename, dirname, isAbsolute, join, parse, posix, relative, resolve, sep } from "node:path";
|
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
3
|
import { c as repositoryRoot, l as resolveRevision } from "../files-DJ0TeaTU.mjs";
|
|
4
|
-
import { t as lintDiagnostics } from "../oxlint-
|
|
5
|
-
import { n as proofDigest, r as proofLines, s as revisionCountRows, t as parseProofStamp } from "../proof-stamp-
|
|
4
|
+
import { t as lintDiagnostics } from "../oxlint-BbpTFFmf.mjs";
|
|
5
|
+
import { n as proofDigest, r as proofLines, s as revisionCountRows, t as parseProofStamp } from "../proof-stamp-D9yo2dxU.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/checks.mjs
CHANGED
|
@@ -1,17 +1,20 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { t as CEILINGS_FILE } from "../ceilings-B7KayYIG.mjs";
|
|
3
|
-
import { a as
|
|
3
|
+
import { a as packageManager, o as parseManifest } from "../package-DxxcxOzp.mjs";
|
|
4
4
|
import { n as runCliAsync } from "../cli-4Tv71vYk.mjs";
|
|
5
5
|
import { a as gitFiles, c as repositoryRoot } from "../files-DJ0TeaTU.mjs";
|
|
6
|
+
import { i as workspaceDirectories, n as stepsOf, t as matchingScripts } from "../script-steps-CgH2DSsp.mjs";
|
|
6
7
|
import { t as accepting } from "../ports-DGP6bPJy.mjs";
|
|
7
8
|
import { createRequire } from "node:module";
|
|
8
|
-
import { existsSync, mkdtempSync, readFileSync, readdirSync, rmSync, writeFileSync } from "node:fs";
|
|
9
|
+
import { existsSync, mkdtempSync, readFileSync, readdirSync, rmSync, statSync, writeFileSync } from "node:fs";
|
|
9
10
|
import { basename, dirname, join, posix, relative, resolve, sep } from "node:path";
|
|
10
11
|
import { spawn } from "node:child_process";
|
|
11
12
|
import { isMap, isScalar, isSeq, parseAllDocuments, parseDocument } from "yaml";
|
|
13
|
+
import ts from "typescript";
|
|
12
14
|
import { createHash } from "node:crypto";
|
|
13
15
|
import { tmpdir } from "node:os";
|
|
14
16
|
import { parseArgs } from "node:util";
|
|
17
|
+
import { minimatch } from "minimatch";
|
|
15
18
|
//#region src/guardrails/run-command.ts
|
|
16
19
|
const KILL_GRACE_MS = 5e3;
|
|
17
20
|
function stopGroup(child, signal) {
|
|
@@ -633,6 +636,107 @@ function checkSingletonPackages(root) {
|
|
|
633
636
|
}).join("");
|
|
634
637
|
}
|
|
635
638
|
//#endregion
|
|
639
|
+
//#region src/guardrails/typecheck-writes.ts
|
|
640
|
+
const MAX_DEPTH = 5;
|
|
641
|
+
const BUILD = "build";
|
|
642
|
+
const UNRESOLVED_SELECTOR = /^!|\.\.\.|\^|\[|\$/u;
|
|
643
|
+
function scriptsIn(directory) {
|
|
644
|
+
const file = join(directory, "package.json");
|
|
645
|
+
if (!existsSync(file)) return /* @__PURE__ */ new Map();
|
|
646
|
+
const { scripts = {} } = parseManifest(readFileSync(file, "utf8"));
|
|
647
|
+
return new Map(Object.entries(scripts));
|
|
648
|
+
}
|
|
649
|
+
function workspacePackages(walk) {
|
|
650
|
+
walk.packages ??= workspaceDirectories(walk.root).map((path) => {
|
|
651
|
+
const directory = join(walk.root, path);
|
|
652
|
+
const { name } = parseManifest(readFileSync(join(directory, "package.json"), "utf8"));
|
|
653
|
+
return {
|
|
654
|
+
directory,
|
|
655
|
+
path,
|
|
656
|
+
name
|
|
657
|
+
};
|
|
658
|
+
});
|
|
659
|
+
return walk.packages;
|
|
660
|
+
}
|
|
661
|
+
/** The workspace packages a `--filter` or `--workspace` selector matches by name or by path, `undefined` for one this does not model. */
|
|
662
|
+
function selected(walk, from, selector) {
|
|
663
|
+
if (UNRESOLVED_SELECTOR.test(selector)) return void 0;
|
|
664
|
+
const path = relative(walk.root, resolve(from, selector.replace(/^\{|\}$/gu, "")));
|
|
665
|
+
const matches = workspacePackages(walk).filter((item) => item.name !== void 0 && minimatch(item.name, selector) || minimatch(item.path, path)).map((item) => item.directory);
|
|
666
|
+
return matches.length ? matches : void 0;
|
|
667
|
+
}
|
|
668
|
+
function targetDirectories(walk, from, target) {
|
|
669
|
+
if (target.kind === "all") return workspacePackages(walk).map((item) => item.directory);
|
|
670
|
+
if (target.kind === "select") return selected(walk, from, target.selector);
|
|
671
|
+
const directory = resolve(from, target.path);
|
|
672
|
+
return target.path.includes("$") || !existsSync(join(directory, "package.json")) ? void 0 : [directory];
|
|
673
|
+
}
|
|
674
|
+
/** The package directories a script step runs in, `undefined` when a target cannot be resolved. */
|
|
675
|
+
function stepDirectories(walk, from, targets) {
|
|
676
|
+
if (targets.length === 0) return [from];
|
|
677
|
+
const directories = /* @__PURE__ */ new Set();
|
|
678
|
+
for (const target of targets) {
|
|
679
|
+
const found = targetDirectories(walk, from, target);
|
|
680
|
+
if (found === void 0) return void 0;
|
|
681
|
+
for (const directory of found) directories.add(directory);
|
|
682
|
+
}
|
|
683
|
+
return [...directories];
|
|
684
|
+
}
|
|
685
|
+
function configFile(directory, project) {
|
|
686
|
+
const path = resolve(directory, project);
|
|
687
|
+
return existsSync(path) && statSync(path).isDirectory() ? join(path, "tsconfig.json") : path;
|
|
688
|
+
}
|
|
689
|
+
/** Whether a `tsc` command line writes output: `-b`, or a run whose command line or tsconfig chain leaves `noEmit` unset. */
|
|
690
|
+
function tscWrites(directory, args) {
|
|
691
|
+
if (/^--?b(?:uild)?$/iu.test(args[0] ?? "")) return true;
|
|
692
|
+
const { options } = ts.parseCommandLine([...args]);
|
|
693
|
+
if (options.noEmit !== void 0) return !options.noEmit;
|
|
694
|
+
const file = configFile(directory, options.project ?? ".");
|
|
695
|
+
if (!existsSync(file)) return true;
|
|
696
|
+
return ts.getParsedCommandLineOfConfigFile(file, {}, {
|
|
697
|
+
...ts.sys,
|
|
698
|
+
onUnRecoverableConfigFileDiagnostic: () => void 0
|
|
699
|
+
})?.options.noEmit !== true;
|
|
700
|
+
}
|
|
701
|
+
/** Whether one step, run from `directory`, writes: a `tsc` that emits, or a script that reaches one or a `build`. */
|
|
702
|
+
function stepWrites(walk, directory, step, depth) {
|
|
703
|
+
const directories = stepDirectories(walk, directory, step.targets);
|
|
704
|
+
if (directories === void 0) return true;
|
|
705
|
+
if (step.kind === "tsc") return directories.some((target) => tscWrites(target, step.args));
|
|
706
|
+
return directories.some((target) => matchingScripts(step.names, scriptsIn(target).keys()).some((script) => scriptWrites(walk, target, script, depth + 1)));
|
|
707
|
+
}
|
|
708
|
+
/** Whether a script or the `pre` and `post` hooks the package manager runs around it write, its lines run from where each `cd` left them. */
|
|
709
|
+
function scriptWrites(walk, directory, name, depth) {
|
|
710
|
+
const key = `${directory}\0${name}`;
|
|
711
|
+
const text = scriptsIn(directory).get(name);
|
|
712
|
+
if (text === void 0 || walk.seen.has(key)) return false;
|
|
713
|
+
walk.seen.add(key);
|
|
714
|
+
if (name === BUILD || depth > MAX_DEPTH) return true;
|
|
715
|
+
if (scriptWrites(walk, directory, `pre${name}`, depth) || scriptWrites(walk, directory, `post${name}`, depth)) return true;
|
|
716
|
+
let current = directory;
|
|
717
|
+
for (const step of stepsOf(text)) if (step.kind === "cd") {
|
|
718
|
+
if (step.path.includes("$") || step.path.startsWith("~")) return true;
|
|
719
|
+
current = resolve(current, step.path);
|
|
720
|
+
} else if (stepWrites(walk, current, step, depth)) return true;
|
|
721
|
+
return false;
|
|
722
|
+
}
|
|
723
|
+
/**
|
|
724
|
+
* Whether the `typecheck` script of the package at `root` can write files other steps read: it reaches a `build`
|
|
725
|
+
* script or a `tsc` run that emits, in this package or a workspace package it points the package manager at. A
|
|
726
|
+
* target it cannot resolve, such as a `--dir` read from a variable or a dependency `--filter`, counts as writing, and
|
|
727
|
+
* so does a workspace whose manifests cannot be read.
|
|
728
|
+
*/
|
|
729
|
+
function typecheckWrites(root) {
|
|
730
|
+
try {
|
|
731
|
+
return scriptWrites({
|
|
732
|
+
root,
|
|
733
|
+
seen: /* @__PURE__ */ new Set()
|
|
734
|
+
}, root, "typecheck", 0);
|
|
735
|
+
} catch {
|
|
736
|
+
return true;
|
|
737
|
+
}
|
|
738
|
+
}
|
|
739
|
+
//#endregion
|
|
636
740
|
//#region src/guardrails/checks.ts
|
|
637
741
|
const CHECK_STEPS = [
|
|
638
742
|
"typecheck",
|
|
@@ -666,6 +770,18 @@ function hasWork(root, step) {
|
|
|
666
770
|
}
|
|
667
771
|
/** The step that runs after the others, never beside them: tests often hold time limits that CPU contention would break. */
|
|
668
772
|
const RUNS_ALONE = "test";
|
|
773
|
+
/** The step that runs before the others when it writes files, such as a workspace package's `dist`, that they read. */
|
|
774
|
+
const RUNS_FIRST = "typecheck";
|
|
775
|
+
/** The groups of steps that run one after another, the steps of a group at the same time. */
|
|
776
|
+
function phases(root, steps) {
|
|
777
|
+
const first = steps.includes(RUNS_FIRST) && typecheckWrites(root) ? [RUNS_FIRST] : [];
|
|
778
|
+
const last = steps.includes(RUNS_ALONE) ? [RUNS_ALONE] : [];
|
|
779
|
+
return [
|
|
780
|
+
first,
|
|
781
|
+
steps.filter((step) => !first.includes(step) && !last.includes(step)),
|
|
782
|
+
last
|
|
783
|
+
].filter((phase) => phase.length > 0);
|
|
784
|
+
}
|
|
669
785
|
/** The environment variable naming, comma-separated, the steps `runChecks` leaves to another CI job. */
|
|
670
786
|
const CHECKS_SKIP_ENV = "ANTELOPEJS_CHECKS_SKIP";
|
|
671
787
|
function skippedNames(setting) {
|
|
@@ -692,8 +808,7 @@ async function runSteps(root, manifest, steps, signal) {
|
|
|
692
808
|
return result.status === 0 ? [] : [`[${step}]\n${result.output}`];
|
|
693
809
|
};
|
|
694
810
|
const failures = /* @__PURE__ */ new Map();
|
|
695
|
-
|
|
696
|
-
if (steps.includes(RUNS_ALONE)) failures.set(RUNS_ALONE, await runStep(RUNS_ALONE));
|
|
811
|
+
for (const phase of phases(root, steps)) await Promise.all(phase.map(async (step) => failures.set(step, await runStep(step))));
|
|
697
812
|
return steps.flatMap((step) => failures.get(step) ?? []);
|
|
698
813
|
}
|
|
699
814
|
/** The optional package script run once before the steps, to build what several steps read, such as a workspace package's `dist`. */
|
|
@@ -726,7 +841,8 @@ function summary(failures, passed, skipped) {
|
|
|
726
841
|
}
|
|
727
842
|
/**
|
|
728
843
|
* Runs the `checks:prepare` package script first when it exists and a step will run, and stops there if it fails.
|
|
729
|
-
* Then runs
|
|
844
|
+
* Then runs `typecheck` first when it writes files the other steps read (see `typecheckWrites`), every other check step
|
|
845
|
+
* except `test` at the same time, then `test` alone, and reports only what failed, each step's
|
|
730
846
|
* output buffered and listed in step order whichever step finishes first. `skipSetting` is the comma-separated value of
|
|
731
847
|
* `ANTELOPEJS_CHECKS_SKIP`: the steps it names are not run and are counted as skipped, never as passed, and a name that
|
|
732
848
|
* is not a step fails the run before any step starts so a typo cannot skip nothing. Unless `services` is false, the
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { t as runCli } from "../cli-4Tv71vYk.mjs";
|
|
3
3
|
import { c as repositoryRoot } from "../files-DJ0TeaTU.mjs";
|
|
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-
|
|
4
|
+
import { c as revisionCounts, i as stampProof, o as compareRevisions } from "../proof-stamp-D9yo2dxU.mjs";
|
|
5
|
+
import { a as listsNoFiles, c as packagesAt, n as extendedConfigs, t as emitPackage } from "../typescript-D7SaSmsl.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
|
@@ -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";
|
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";
|