@antelopejs/tooling-configs 0.5.2 → 0.5.3
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 +477 -40
- package/dist/checks-BFGuy1KI.mjs +1506 -0
- package/dist/oxc/lint.mjs +1 -1
- package/dist/{package-DxxcxOzp.mjs → package-DiaBP7bI.mjs} +50 -26
- package/dist/{proof-stamp-D9yo2dxU.mjs → proof-stamp-BPIdT5ik.mjs} +2 -2
- package/dist/{ratchet--WWa_w2O.mjs → ratchet-BZvlFCWL.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-C6cfOd2H.mjs} +1 -1
- package/dist/{typescript-D7SaSmsl.mjs → typescript-DJzdex32.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-C6cfOd2H.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,5 +1,5 @@
|
|
|
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
5
|
//#region src/guardrails/package.ts
|
|
@@ -25,6 +25,10 @@ function packageManager(manifest) {
|
|
|
25
25
|
default: throw new Error(`Unsupported package manager ${manager}. Expected pnpm, npm, yarn, or bun.`);
|
|
26
26
|
}
|
|
27
27
|
}
|
|
28
|
+
/** Whether the repository at `root` is a Nuxt app: it depends on `nuxt` or has a `nuxt.config.*`. */
|
|
29
|
+
function usesNuxt(root, manifest) {
|
|
30
|
+
return Boolean(manifest.dependencies?.nuxt || manifest.devDependencies?.nuxt || readdirSync(root).some((name) => name.startsWith("nuxt.config.")));
|
|
31
|
+
}
|
|
28
32
|
function execCommand(manager) {
|
|
29
33
|
if (manager === "npm") return "npm exec --";
|
|
30
34
|
if (manager === "bun") return "bun x --no-install";
|
|
@@ -37,24 +41,23 @@ function toolingVersions() {
|
|
|
37
41
|
if (existsSync(path)) {
|
|
38
42
|
const manifest = parseManifest(readFileSync(path, "utf8"));
|
|
39
43
|
if (manifest.name === "@antelopejs/tooling-configs") {
|
|
40
|
-
const
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
44
|
+
const declared = (field, name) => {
|
|
45
|
+
const range = manifest[field]?.[name];
|
|
46
|
+
if (!range) throw new Error(`tooling-configs must declare ${name} in ${field}.`);
|
|
47
|
+
return range;
|
|
48
|
+
};
|
|
49
|
+
const dev = (name) => declared("devDependencies", name);
|
|
50
|
+
if (!manifest.version || !manifest.packageManager) throw new Error("tooling-configs must declare its version and packageManager.");
|
|
47
51
|
return {
|
|
48
|
-
lefthook,
|
|
49
|
-
knip,
|
|
50
|
-
tsgolint,
|
|
51
|
-
oxlint,
|
|
52
|
-
oxfmt,
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
}),
|
|
52
|
+
lefthook: dev("lefthook"),
|
|
53
|
+
knip: dev("knip"),
|
|
54
|
+
tsgolint: dev("oxlint-tsgolint"),
|
|
55
|
+
oxlint: dev("oxlint"),
|
|
56
|
+
oxfmt: dev("oxfmt"),
|
|
57
|
+
typescript: declared("dependencies", "typescript"),
|
|
58
|
+
nodeTypes: dev("@types/node"),
|
|
59
|
+
capture: CAPTURE_PEERS.map((name) => [name, dev(name)]),
|
|
60
|
+
packageManager: manifest.packageManager,
|
|
58
61
|
pack: manifest.version
|
|
59
62
|
};
|
|
60
63
|
}
|
|
@@ -159,26 +162,46 @@ function addedDevDependencies(manifest, versions, options) {
|
|
|
159
162
|
if (options.typeAware) tools.push(["oxlint-tsgolint", versions.tsgolint]);
|
|
160
163
|
return [...tools.filter(([name]) => !declared[name]), ...options.captures ? versions.capture.filter(([name, tested]) => !withinTested(declared[name], tested)) : []];
|
|
161
164
|
}
|
|
162
|
-
/**
|
|
163
|
-
|
|
165
|
+
/**
|
|
166
|
+
* The pack, oxlint, oxlint-tsgolint, oxfmt and typescript with the ranges `--init` declares for a repository that has
|
|
167
|
+
* none of them, and `@types/node` when `nodeProject` says init writes the tsconfig that loads it. Sync needs the first
|
|
168
|
+
* three installed to load its preset and run the type-aware baseline before it writes any devDependency; the synced
|
|
169
|
+
* `typecheck` script runs typescript's `tsc`.
|
|
170
|
+
*/
|
|
171
|
+
function bootstrapDependencies(manifest, versions, nodeProject) {
|
|
164
172
|
const declared = {
|
|
165
173
|
...manifest.dependencies,
|
|
166
174
|
...manifest.devDependencies
|
|
167
175
|
};
|
|
168
|
-
|
|
176
|
+
const wanted = [
|
|
169
177
|
["@antelopejs/tooling-configs", `^${versions.pack}`],
|
|
170
178
|
["oxlint", versions.oxlint],
|
|
171
179
|
["oxlint-tsgolint", versions.tsgolint],
|
|
172
|
-
["oxfmt", versions.oxfmt]
|
|
173
|
-
|
|
180
|
+
["oxfmt", versions.oxfmt],
|
|
181
|
+
["typescript", versions.typescript]
|
|
182
|
+
];
|
|
183
|
+
if (nodeProject) wanted.push(["@types/node", versions.nodeTypes]);
|
|
184
|
+
return wanted.filter(([name]) => !declared[name]);
|
|
174
185
|
}
|
|
175
|
-
/** `
|
|
176
|
-
|
|
186
|
+
/** The `test` script `npm init` writes, which fails every run. */
|
|
187
|
+
const NPM_INIT_TEST = "echo \"Error: no test specified\" && exit 1";
|
|
188
|
+
/**
|
|
189
|
+
* `current` with `added` in its sorted devDependencies, `packageManager` set to `pin` when it has none, and a `test`
|
|
190
|
+
* script running Node's test runner when it has none or only npm's failing default, which passes with no test file
|
|
191
|
+
* and runs the ones the repository adds. An explicit `"type": "commonjs"`, which `npm init` writes, is dropped: under
|
|
192
|
+
* it Node refuses to load the pack's ESM `*.config.ts` files, while without it `.js` files stay CommonJS unless they
|
|
193
|
+
* use ESM syntax, which `commonjs` rejected anyway. Formatted as the rest of the sync writers do.
|
|
194
|
+
*/
|
|
195
|
+
function bootstrappedManifest(current, added, pin) {
|
|
177
196
|
const manifest = parseManifest(current);
|
|
178
197
|
manifest.devDependencies = sortedEntries({
|
|
179
198
|
...manifest.devDependencies,
|
|
180
199
|
...Object.fromEntries(added)
|
|
181
200
|
});
|
|
201
|
+
manifest.packageManager ??= pin;
|
|
202
|
+
if (manifest.type === "commonjs") delete manifest.type;
|
|
203
|
+
const scripts = manifest.scripts ??= {};
|
|
204
|
+
if (scripts.test === void 0 || scripts.test === NPM_INIT_TEST) scripts.test = "node --test";
|
|
182
205
|
return serializeManifest(manifest, current);
|
|
183
206
|
}
|
|
184
207
|
function managedPackage(current, versions, options = {}) {
|
|
@@ -244,10 +267,11 @@ function templatePackage(current, versions, options) {
|
|
|
244
267
|
});
|
|
245
268
|
return serializeManifest(manifest, current);
|
|
246
269
|
}
|
|
270
|
+
/** `manifest` as JSON in the indentation and line endings of `current`, the text it was read from. */
|
|
247
271
|
function serializeManifest(manifest, current) {
|
|
248
272
|
const indent = /^([\t ]+)"/m.exec(current)?.[1] ?? " ";
|
|
249
273
|
const newline = current.includes("\r\n") ? "\r\n" : "\n";
|
|
250
274
|
return `${JSON.stringify(manifest, null, indent).replaceAll("\n", newline)}${newline}`;
|
|
251
275
|
}
|
|
252
276
|
//#endregion
|
|
253
|
-
export {
|
|
277
|
+
export { managedPackage as a, repositoryTools as c, toolingVersions as d, usesNuxt as f, execCommand as i, serializeManifest as l, bootstrapDependencies as n, packageManager as o, 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-DiaBP7bI.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-DiaBP7bI.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-DiaBP7bI.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.3",
|
|
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",
|