@antelopejs/tooling-configs 0.5.2 → 0.5.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 +6 -4
- package/dist/bin/api-diff.mjs +3 -3
- package/dist/bin/body-check.mjs +1 -1
- package/dist/bin/check-size.mjs +1 -1
- package/dist/bin/checks.mjs +2 -890
- package/dist/bin/comment-proof.mjs +2 -2
- package/dist/bin/garden.mjs +221 -215
- package/dist/bin/lease.mjs +1 -1
- package/dist/bin/ratchet.mjs +3 -3
- package/dist/bin/suppressions.mjs +3 -3
- package/dist/bin/sync.mjs +626 -43
- package/dist/checks-CyMCnYb4.mjs +1506 -0
- package/dist/oxc/lint.mjs +1 -1
- package/dist/{package-DxxcxOzp.mjs → package-CORwvwTw.mjs} +57 -26
- package/dist/{proof-stamp-D9yo2dxU.mjs → proof-stamp-C56iYgHa.mjs} +2 -2
- package/dist/{ratchet--WWa_w2O.mjs → ratchet-Al0XZtOz.mjs} +2 -2
- package/dist/{suppression-base-Drnl6Y7F.mjs → suppression-base-DZgUDXiI.mjs} +2 -2
- package/dist/{suppression-budget-Dvb_IqBo.mjs → suppression-budget-DgYdu6JK.mjs} +1 -1
- package/dist/{suppressions-BroaaGJ_.mjs → suppressions-CQTcKCi1.mjs} +1 -1
- package/dist/{templates-BiXgdsRN.mjs → templates-DaatyItc.mjs} +1 -1
- package/dist/{typescript-D7SaSmsl.mjs → typescript-Cw1JH8mk.mjs} +1 -1
- package/dist/{workflow-B0FmthGv.mjs → workflow-CPcNc8KL.mjs} +5 -2
- package/package.json +1 -1
- package/dist/script-steps-CgH2DSsp.mjs +0 -594
package/dist/oxc/lint.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { i as findGitRoot } from "../ceilings-B7KayYIG.mjs";
|
|
2
2
|
import { t as readCarriedCeilings } from "../renames-L2owF5GD.mjs";
|
|
3
|
-
import { t as PRESET_CONFIGS } from "../templates-
|
|
3
|
+
import { t as PRESET_CONFIGS } from "../templates-DaatyItc.mjs";
|
|
4
4
|
import { t as TYPE_AWARE_RULES } from "../type-aware-rules-DMuN6sHb.mjs";
|
|
5
5
|
import { n as TEST_FILE_GLOBS, t as ASSERTION_FUNCTION_NAMES } from "../shared-WC0z3y9F.mjs";
|
|
6
6
|
import { n as IGNORE_PATTERNS, r as SYNCED_AGENT_PATTERNS } from "../shared-igPpEDpS.mjs";
|
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
import { t as admits } from "./semver-BDxeEcP_.mjs";
|
|
2
|
-
import { existsSync, readFileSync } from "node:fs";
|
|
2
|
+
import { existsSync, readFileSync, readdirSync } from "node:fs";
|
|
3
3
|
import { dirname, join } from "node:path";
|
|
4
4
|
import { fileURLToPath } from "node:url";
|
|
5
|
+
//#region package.json
|
|
6
|
+
var packageManager$1 = "pnpm@10.2.0";
|
|
7
|
+
//#endregion
|
|
5
8
|
//#region src/guardrails/package.ts
|
|
6
9
|
/** The capture tool's optional peers, which a repository with `docs/captures.ts` declares as devDependencies at the ranges the pack tests against. */
|
|
7
10
|
const CAPTURE_PEERS = [
|
|
@@ -25,6 +28,14 @@ function packageManager(manifest) {
|
|
|
25
28
|
default: throw new Error(`Unsupported package manager ${manager}. Expected pnpm, npm, yarn, or bun.`);
|
|
26
29
|
}
|
|
27
30
|
}
|
|
31
|
+
/** Whether the repository at `root` is a Nuxt app: it depends on `nuxt` or has a `nuxt.config.*`. */
|
|
32
|
+
function usesNuxt(root, manifest) {
|
|
33
|
+
return Boolean(manifest.dependencies?.nuxt || manifest.devDependencies?.nuxt || readdirSync(root).some((name) => name.startsWith("nuxt.config.")));
|
|
34
|
+
}
|
|
35
|
+
/** Whether the repository at `root` has `docs/captures.ts`, so it declares the capture tool's peers. */
|
|
36
|
+
function usesCaptures(root) {
|
|
37
|
+
return existsSync(join(root, "docs/captures.ts"));
|
|
38
|
+
}
|
|
28
39
|
function execCommand(manager) {
|
|
29
40
|
if (manager === "npm") return "npm exec --";
|
|
30
41
|
if (manager === "bun") return "bun x --no-install";
|
|
@@ -37,24 +48,23 @@ function toolingVersions() {
|
|
|
37
48
|
if (existsSync(path)) {
|
|
38
49
|
const manifest = parseManifest(readFileSync(path, "utf8"));
|
|
39
50
|
if (manifest.name === "@antelopejs/tooling-configs") {
|
|
40
|
-
const
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
51
|
+
const declared = (field, name) => {
|
|
52
|
+
const range = manifest[field]?.[name];
|
|
53
|
+
if (!range) throw new Error(`tooling-configs must declare ${name} in ${field}.`);
|
|
54
|
+
return range;
|
|
55
|
+
};
|
|
56
|
+
const dev = (name) => declared("devDependencies", name);
|
|
57
|
+
if (!manifest.version) throw new Error("tooling-configs must declare its version.");
|
|
47
58
|
return {
|
|
48
|
-
lefthook,
|
|
49
|
-
knip,
|
|
50
|
-
tsgolint,
|
|
51
|
-
oxlint,
|
|
52
|
-
oxfmt,
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
}),
|
|
59
|
+
lefthook: dev("lefthook"),
|
|
60
|
+
knip: dev("knip"),
|
|
61
|
+
tsgolint: dev("oxlint-tsgolint"),
|
|
62
|
+
oxlint: dev("oxlint"),
|
|
63
|
+
oxfmt: dev("oxfmt"),
|
|
64
|
+
typescript: declared("dependencies", "typescript"),
|
|
65
|
+
nodeTypes: dev("@types/node"),
|
|
66
|
+
capture: CAPTURE_PEERS.map((name) => [name, dev(name)]),
|
|
67
|
+
packageManager: packageManager$1,
|
|
58
68
|
pack: manifest.version
|
|
59
69
|
};
|
|
60
70
|
}
|
|
@@ -159,26 +169,46 @@ function addedDevDependencies(manifest, versions, options) {
|
|
|
159
169
|
if (options.typeAware) tools.push(["oxlint-tsgolint", versions.tsgolint]);
|
|
160
170
|
return [...tools.filter(([name]) => !declared[name]), ...options.captures ? versions.capture.filter(([name, tested]) => !withinTested(declared[name], tested)) : []];
|
|
161
171
|
}
|
|
162
|
-
/**
|
|
163
|
-
|
|
172
|
+
/**
|
|
173
|
+
* The pack, oxlint, oxlint-tsgolint, oxfmt and typescript with the ranges `--init` declares for a repository that has
|
|
174
|
+
* none of them, and `@types/node` when `nodeProject` says init writes the tsconfig that loads it. Sync needs the first
|
|
175
|
+
* three installed to load its preset and run the type-aware baseline before it writes any devDependency; the synced
|
|
176
|
+
* `typecheck` script runs typescript's `tsc`.
|
|
177
|
+
*/
|
|
178
|
+
function bootstrapDependencies(manifest, versions, nodeProject) {
|
|
164
179
|
const declared = {
|
|
165
180
|
...manifest.dependencies,
|
|
166
181
|
...manifest.devDependencies
|
|
167
182
|
};
|
|
168
|
-
|
|
183
|
+
const wanted = [
|
|
169
184
|
["@antelopejs/tooling-configs", `^${versions.pack}`],
|
|
170
185
|
["oxlint", versions.oxlint],
|
|
171
186
|
["oxlint-tsgolint", versions.tsgolint],
|
|
172
|
-
["oxfmt", versions.oxfmt]
|
|
173
|
-
|
|
187
|
+
["oxfmt", versions.oxfmt],
|
|
188
|
+
["typescript", versions.typescript]
|
|
189
|
+
];
|
|
190
|
+
if (nodeProject) wanted.push(["@types/node", versions.nodeTypes]);
|
|
191
|
+
return wanted.filter(([name]) => !declared[name]);
|
|
174
192
|
}
|
|
175
|
-
/** `
|
|
176
|
-
|
|
193
|
+
/** The `test` script `npm init` writes, which fails every run. */
|
|
194
|
+
const NPM_INIT_TEST = "echo \"Error: no test specified\" && exit 1";
|
|
195
|
+
/**
|
|
196
|
+
* `current` with `added` in its sorted devDependencies, `packageManager` set to `pin` unless it names pnpm, the only
|
|
197
|
+
* manager the pack's CI installs with, and a `test` script running Node's test runner when it has none or only npm's
|
|
198
|
+
* failing default, which passes with no test file and runs the ones the repository adds. An explicit `"type": "commonjs"`, which `npm init` writes, is dropped: under
|
|
199
|
+
* it Node refuses to load the pack's ESM `*.config.ts` files, while without it `.js` files stay CommonJS unless they
|
|
200
|
+
* use ESM syntax, which `commonjs` rejected anyway. Formatted as the rest of the sync writers do.
|
|
201
|
+
*/
|
|
202
|
+
function bootstrappedManifest(current, added, pin) {
|
|
177
203
|
const manifest = parseManifest(current);
|
|
178
204
|
manifest.devDependencies = sortedEntries({
|
|
179
205
|
...manifest.devDependencies,
|
|
180
206
|
...Object.fromEntries(added)
|
|
181
207
|
});
|
|
208
|
+
if (manifest.packageManager === void 0 || packageManager(manifest) !== "pnpm") manifest.packageManager = pin;
|
|
209
|
+
if (manifest.type === "commonjs") delete manifest.type;
|
|
210
|
+
const scripts = manifest.scripts ??= {};
|
|
211
|
+
if (scripts.test === void 0 || scripts.test === NPM_INIT_TEST) scripts.test = "node --test";
|
|
182
212
|
return serializeManifest(manifest, current);
|
|
183
213
|
}
|
|
184
214
|
function managedPackage(current, versions, options = {}) {
|
|
@@ -244,10 +274,11 @@ function templatePackage(current, versions, options) {
|
|
|
244
274
|
});
|
|
245
275
|
return serializeManifest(manifest, current);
|
|
246
276
|
}
|
|
277
|
+
/** `manifest` as JSON in the indentation and line endings of `current`, the text it was read from. */
|
|
247
278
|
function serializeManifest(manifest, current) {
|
|
248
279
|
const indent = /^([\t ]+)"/m.exec(current)?.[1] ?? " ";
|
|
249
280
|
const newline = current.includes("\r\n") ? "\r\n" : "\n";
|
|
250
281
|
return `${JSON.stringify(manifest, null, indent).replaceAll("\n", newline)}${newline}`;
|
|
251
282
|
}
|
|
252
283
|
//#endregion
|
|
253
|
-
export {
|
|
284
|
+
export { managedPackage as a, repositoryTools as c, toolingVersions as d, usesCaptures as f, execCommand as i, serializeManifest as l, bootstrapDependencies as n, packageManager as o, usesNuxt as p, bootstrappedManifest as r, parseManifest as s, addedDevDependencies as t, templatePackage as u };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { s as parseManifest } from "./package-CORwvwTw.mjs";
|
|
2
2
|
import { l as resolveRevision, u as trackedManifests } from "./files-DJ0TeaTU.mjs";
|
|
3
|
-
import { o as revisionSuppressions, r as countSuppressions } from "./suppressions-
|
|
3
|
+
import { o as revisionSuppressions, r as countSuppressions } from "./suppressions-CQTcKCi1.mjs";
|
|
4
4
|
import { copyFileSync, existsSync, lstatSync, mkdirSync, mkdtempSync, readFileSync, readdirSync, realpathSync, rmSync, statSync, symlinkSync } from "node:fs";
|
|
5
5
|
import { dirname, isAbsolute, join, matchesGlob, relative, sep } from "node:path";
|
|
6
6
|
import { execFileSync, spawnSync } from "node:child_process";
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { a as formatCeilings, c as parseCeilings, n as MAX_FILE_BYTES, o as isPackRelease, s as isRetired, t as CEILINGS_FILE } from "./ceilings-B7KayYIG.mjs";
|
|
2
2
|
import { n as renamedPaths, t as readCarriedCeilings } from "./renames-L2owF5GD.mjs";
|
|
3
|
-
import {
|
|
3
|
+
import { d as toolingVersions } from "./package-CORwvwTw.mjs";
|
|
4
4
|
import { n as authoredSizes, o as isAgentFile, r as changedFiles, t as LINT_CONFIG } from "./files-DJ0TeaTU.mjs";
|
|
5
5
|
import { t as lintDiagnostics } from "./oxlint-BbpTFFmf.mjs";
|
|
6
|
-
import "./suppression-budget-
|
|
6
|
+
import "./suppression-budget-DgYdu6JK.mjs";
|
|
7
7
|
import { n as sizeFailure } from "./size-DBatLT-F.mjs";
|
|
8
8
|
import { copyFileSync, existsSync, mkdirSync, mkdtempSync, rmSync, symlinkSync, unlinkSync, writeFileSync } from "node:fs";
|
|
9
9
|
import { dirname, join } from "node:path";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { l as resolveRevision, o as isAgentFile } from "./files-DJ0TeaTU.mjs";
|
|
2
|
-
import { a as parseBudget, n as SUPPRESSIONS_FILE, o as safetyCeiling, p as coveredLimits } from "./suppression-budget-
|
|
3
|
-
import { o as revisionSuppressions, r as countSuppressions } from "./suppressions-
|
|
2
|
+
import { a as parseBudget, n as SUPPRESSIONS_FILE, o as safetyCeiling, p as coveredLimits } from "./suppression-budget-DgYdu6JK.mjs";
|
|
3
|
+
import { o as revisionSuppressions, r as countSuppressions } from "./suppressions-CQTcKCi1.mjs";
|
|
4
4
|
import { readFileSync } from "node:fs";
|
|
5
5
|
import { join } from "node:path";
|
|
6
6
|
import { spawnSync } from "node:child_process";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { n as renamedPaths } from "./renames-L2owF5GD.mjs";
|
|
2
2
|
import { o as isAgentFile, r as changedFiles } from "./files-DJ0TeaTU.mjs";
|
|
3
|
-
import { a as openDisablesIn, i as inWorktree, l as worktreeSuppressions, n as configKey, o as revisionSuppressions, r as countSuppressions, s as sortedKeys, t as atRevision } from "./suppressions-
|
|
3
|
+
import { a as openDisablesIn, i as inWorktree, l as worktreeSuppressions, n as configKey, o as revisionSuppressions, r as countSuppressions, s as sortedKeys, t as atRevision } from "./suppressions-CQTcKCi1.mjs";
|
|
4
4
|
import { existsSync, readFileSync, writeFileSync } from "node:fs";
|
|
5
5
|
import { join, matchesGlob } from "node:path";
|
|
6
6
|
import { execFileSync, spawnSync } from "node:child_process";
|
|
@@ -429,4 +429,4 @@ function countSuppressions(suppressions) {
|
|
|
429
429
|
};
|
|
430
430
|
}
|
|
431
431
|
//#endregion
|
|
432
|
-
export { openDisablesIn as a, suppressionsIn as c, inWorktree as i, worktreeSuppressions as l, configKey as n, revisionSuppressions as o, countSuppressions as r, sortedKeys as s, atRevision as t };
|
|
432
|
+
export { openDisablesIn as a, suppressionsIn as c, inWorktree as i, worktreeSuppressions as l, configKey as n, revisionSuppressions as o, countSuppressions as r, sortedKeys as s, atRevision as t, typescript as u };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { s as parseManifest } from "./package-CORwvwTw.mjs";
|
|
2
2
|
import { u as trackedManifests } from "./files-DJ0TeaTU.mjs";
|
|
3
3
|
import { createRequire } from "node:module";
|
|
4
4
|
import { existsSync, mkdirSync, readFileSync, writeFileSync } from "node:fs";
|
|
@@ -434,7 +434,7 @@ function canonicalSyncJob() {
|
|
|
434
434
|
}
|
|
435
435
|
function ensureSyncJob(document, jobs, syncCallers) {
|
|
436
436
|
if (!syncCallers.length) {
|
|
437
|
-
jobs.
|
|
437
|
+
jobs.add(document.createPair(RENOVATE_SYNC_JOB_ID, canonicalSyncJob()));
|
|
438
438
|
return true;
|
|
439
439
|
}
|
|
440
440
|
let changed = false;
|
|
@@ -473,7 +473,10 @@ function dropRedundantAggregator(jobs, syncCallers) {
|
|
|
473
473
|
* that still exist, so sync never drops coverage.
|
|
474
474
|
*/
|
|
475
475
|
function ciWorkflow(current, callers, syncCallers, docsFiles, placeholderTests = false) {
|
|
476
|
-
if (current === void 0) return newCaller(placeholderTests)
|
|
476
|
+
if (current === void 0) return ciWorkflow(newCaller(placeholderTests), [{
|
|
477
|
+
id: "ci",
|
|
478
|
+
named: false
|
|
479
|
+
}], [{ id: RENOVATE_SYNC_JOB_ID }], docsFiles, placeholderTests);
|
|
477
480
|
if (!callers.length) return current;
|
|
478
481
|
const document = parseDocument(current);
|
|
479
482
|
if (document.errors.length) throw new Error(`${CI_PATH}: ${document.errors.map(({ message }) => message).join("; ")}`);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@antelopejs/tooling-configs",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.4",
|
|
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",
|