@antelopejs/tooling-configs 0.5.4 → 0.5.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 +39 -26
- package/assets/readme/OFL.txt +93 -0
- package/assets/readme/geist-extrabold.woff2 +0 -0
- package/assets/readme/geist-mono.woff2 +0 -0
- package/dist/bin/api-diff.mjs +3 -3
- package/dist/bin/body-check.mjs +1 -1
- package/dist/bin/check-interface-ranges.mjs +3 -112
- package/dist/bin/checks.mjs +1 -1
- package/dist/bin/comment-proof.mjs +2 -2
- package/dist/bin/ratchet.mjs +1 -1
- package/dist/bin/readme-strip.d.mts +1 -0
- package/dist/bin/readme-strip.mjs +134 -0
- package/dist/bin/sync.mjs +113 -22
- package/dist/{checks-CyMCnYb4.mjs → checks-DqTjyKCC.mjs} +128 -14
- package/dist/interface-ranges-CcVSr59f.mjs +116 -0
- package/dist/oxc/lint.mjs +1 -1
- package/dist/{package-CORwvwTw.mjs → package-DnxZ2CXZ.mjs} +26 -26
- package/dist/{proof-stamp-C56iYgHa.mjs → proof-stamp-Kg-tkM6G.mjs} +1 -1
- package/dist/{ratchet-Al0XZtOz.mjs → ratchet-1O8k4Dxu.mjs} +1 -1
- package/dist/{templates-DaatyItc.mjs → templates-Dg188oRC.mjs} +1 -1
- package/dist/{typescript-Cw1JH8mk.mjs → typescript-DhavwHb7.mjs} +1 -1
- package/package.json +3 -1
package/README.md
CHANGED
|
@@ -1,9 +1,15 @@
|
|
|
1
|
-
|
|
1
|
+
<a href="https://github.com/AntelopeJS/antelopejs"><img data-illustration src="./.github/readme/strip.svg" width="100%" alt="TOOLING · TOOLING CONFIGS: part of AntelopeJS, hexagonal architecture beyond your own code. A glowing button reads Star AntelopeJS."></a>
|
|
2
2
|
|
|
3
3
|
<div align="center">
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
4
|
+
|
|
5
|
+
# @antelopejs/tooling-configs
|
|
6
|
+
|
|
7
|
+
<a href="https://www.npmjs.com/package/@antelopejs/tooling-configs"><img data-illustration alt="npm" src="https://img.shields.io/npm/v/@antelopejs/tooling-configs?style=for-the-badge&labelColor=000000&color=000000"></a> <a href="./LICENSE"><img data-illustration alt="License" src="https://img.shields.io/npm/l/@antelopejs/tooling-configs?style=for-the-badge&labelColor=000000&color=000000"></a> <a href="https://discord.gg/g4pFt6eXqu"><img data-illustration alt="Discord" src="https://img.shields.io/badge/Discord-18181B?logo=discord&style=for-the-badge&color=000000"></a> <a href="./docs"><img data-illustration alt="Documentation" src="https://img.shields.io/badge/Docs-18181B?style=for-the-badge&color=000000"></a> <a href="https://github.com/AntelopeJS/antelopejs"><img data-illustration alt="Star AntelopeJS" src="https://img.shields.io/github/stars/AntelopeJS/antelopejs?label=Star%20AntelopeJS&style=for-the-badge&labelColor=000000&color=000000&logo=github"></a>
|
|
8
|
+
|
|
9
|
+
**Shared oxlint, oxfmt and Knip presets for AntelopeJS projects, with a command that installs them and fails CI when they drift.**
|
|
10
|
+
|
|
11
|
+
[Documentation](./docs) · [All interfaces and providers](https://github.com/AntelopeJS/antelopejs#ecosystem)
|
|
12
|
+
|
|
7
13
|
</div>
|
|
8
14
|
|
|
9
15
|
The AntelopeJS guardrail pack: shared lint, format and dead-code presets, the commands that install and enforce them in a repository, and a check for the version ranges of interface dependencies.
|
|
@@ -17,28 +23,29 @@ The AntelopeJS guardrail pack: shared lint, format and dead-code presets, the co
|
|
|
17
23
|
|
|
18
24
|
## What's in the box
|
|
19
25
|
|
|
20
|
-
| Export | Import | What it gives
|
|
21
|
-
| ------------------ | ------------------------------------------------------------------------- |
|
|
22
|
-
| `./oxc/lint` | `import { antelopePreset } from "@antelopejs/tooling-configs/oxc/lint"` | The oxlint preset
|
|
23
|
-
| `./oxc/fmt` | `import { antelopeFmtPreset } from "@antelopejs/tooling-configs/oxc/fmt"` | The oxfmt preset (house style)
|
|
24
|
-
| `./eslint` | `import { antelopeNuxtConfig } from "@antelopejs/tooling-configs/eslint"` | ESLint for Nuxt layers
|
|
25
|
-
| `./knip` | `import { antelopeKnipConfig } from "@antelopejs/tooling-configs/knip"` | Knip for AntelopeJS modules
|
|
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
|
-
| `./oxc/guardrails` | Loaded by the oxlint preset as a JS plugin | The `antelopejs` comment and test-quality rules
|
|
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 [--init]` | Writes the guardrail pack into a repository; `--check` reports drift; `--init` onboards a bare repository
|
|
30
|
-
| bin | `antelopejs-checks [--no-services]` | Runs every check and prints only the failures; starts `.github/compose.yml` services around them
|
|
31
|
-
| bin | `antelopejs-ratchet` | Fails when recorded debt grows; `--update` lowers the record and adopts rules a pack release newly enabled
|
|
32
|
-
| bin | `antelopejs-suppressions` | Fails when suppressions exceed their budget or an added one breaks policy; `--update` lowers the budget
|
|
33
|
-
| bin | `antelopejs-check-size` | Fails on authored files over 20,000 bytes and on blanket disable directives
|
|
34
|
-
| bin | `antelopejs-api-diff <base-ref>` | Compares published declaration bundles against committed HEAD
|
|
35
|
-
| bin | `antelopejs-comment-proof <base-ref>` | Compares comment-free JavaScript emit against committed HEAD
|
|
36
|
-
| bin | `antelopejs-body-check <body.md \| -> [--head <sha>] [--base <sha>]` | Checks a PR body's proof and findings blocks against HEAD; `--findings` prints the findings block
|
|
37
|
-
| bin | `antelopejs-check-interface-ranges` | Fails on interface ranges that break module startup
|
|
38
|
-
| bin | `antelopejs-
|
|
39
|
-
| bin | `antelopejs-
|
|
40
|
-
| bin | `antelopejs-
|
|
41
|
-
| bin | `antelopejs-
|
|
26
|
+
| Export | Import | What it gives |
|
|
27
|
+
| ------------------ | ------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
28
|
+
| `./oxc/lint` | `import { antelopePreset } from "@antelopejs/tooling-configs/oxc/lint"` | The oxlint preset |
|
|
29
|
+
| `./oxc/fmt` | `import { antelopeFmtPreset } from "@antelopejs/tooling-configs/oxc/fmt"` | The oxfmt preset (house style) |
|
|
30
|
+
| `./eslint` | `import { antelopeNuxtConfig } from "@antelopejs/tooling-configs/eslint"` | ESLint for Nuxt layers |
|
|
31
|
+
| `./knip` | `import { antelopeKnipConfig } from "@antelopejs/tooling-configs/knip"` | Knip for AntelopeJS modules |
|
|
32
|
+
| `./oxc/anti-slop` | Loaded by the oxlint preset as a JS plugin | The vendored [anti-slop](https://github.com/dmmulroy/anti-slop) rules |
|
|
33
|
+
| `./oxc/guardrails` | Loaded by the oxlint preset as a JS plugin | The `antelopejs` comment and test-quality rules |
|
|
34
|
+
| `./verify` | `import type { VerifyConfig } from "@antelopejs/tooling-configs/verify"` | Types and check helpers for a shared verification skill's `verify.config.ts` |
|
|
35
|
+
| bin | `antelopejs-sync [--init]` | Writes the guardrail pack into a repository; `--check` reports drift; `--init` onboards a bare repository |
|
|
36
|
+
| bin | `antelopejs-checks [--no-services]` | Runs every check and prints only the failures; starts `.github/compose.yml` services around them |
|
|
37
|
+
| bin | `antelopejs-ratchet` | Fails when recorded debt grows; `--update` lowers the record and adopts rules a pack release newly enabled |
|
|
38
|
+
| bin | `antelopejs-suppressions` | Fails when suppressions exceed their budget or an added one breaks policy; `--update` lowers the budget |
|
|
39
|
+
| bin | `antelopejs-check-size` | Fails on authored files over 20,000 bytes and on blanket disable directives |
|
|
40
|
+
| bin | `antelopejs-api-diff <base-ref>` | Compares published declaration bundles against committed HEAD |
|
|
41
|
+
| bin | `antelopejs-comment-proof <base-ref>` | Compares comment-free JavaScript emit against committed HEAD |
|
|
42
|
+
| bin | `antelopejs-body-check <body.md \| -> [--head <sha>] [--base <sha>]` | Checks a PR body's proof and findings blocks against HEAD; `--findings` prints the findings block |
|
|
43
|
+
| bin | `antelopejs-check-interface-ranges` | Fails on interface ranges that break module startup |
|
|
44
|
+
| bin | `antelopejs-readme-strip --kind <kind> --name <label-name>` | Writes a framework repository's README strip banner to `.github/readme/strip.svg` ([docs](docs/documentation-checks.md#framework-strip-banner)) |
|
|
45
|
+
| bin | `antelopejs-garden [--json] [--apply] [--apply-prunes]` | The Gardener's scans of the organization through the GitHub API and npm |
|
|
46
|
+
| bin | `antelopejs-triage [--json]` | Community Triage's ranked shortlist of untriaged issues |
|
|
47
|
+
| bin | `antelopejs-verify <command>` | The harness of the shared `verify-interface`, `verify-module` and `verify-template` skills |
|
|
48
|
+
| bin | `antelopejs-lease run \| status \| down \| gc` | Ports, a mongod, logs and tmp per worktree; see [Run a DMS from a git worktree](./docs/agent-worktrees.md) |
|
|
42
49
|
|
|
43
50
|
## antelopejs-garden
|
|
44
51
|
|
|
@@ -462,6 +469,8 @@ The defaults declare what Knip cannot infer for an AntelopeJS module:
|
|
|
462
469
|
|
|
463
470
|
An implementer must never be handed a breaking minor it does not implement. `workspace:`, `file:` and `link:` specs are skipped. Pass paths to check only those manifests.
|
|
464
471
|
|
|
472
|
+
When the interface sits in the same repository, as in a DMS monorepo, `antelopejs-sync` moves the implementer's range for you: a minor interface release from `0.6.1` to `0.7.0` moves `>=0.6.0 <0.7.0` to `>=0.7.0 <0.8.0`, then sync runs `pnpm install --lockfile-only` so the lockfile follows. The interface is not on npm yet when the release hook runs, so the workspace must link it: set `link-workspace-packages=true` in `.npmrc` or `linkWorkspacePackages: true` in `pnpm-workspace.yaml`. When the relock fails, sync leaves the ranges unmoved and exits 1. An interface `.release-it.json` whose `after:bump` hook runs `pnpm --dir ../.. run sync` and `git add -u ../..` commits both with the release. `antelopejs-sync --check` reports the stale range as drift.
|
|
473
|
+
|
|
465
474
|
```jsonc
|
|
466
475
|
// package.json
|
|
467
476
|
{
|
|
@@ -492,6 +501,10 @@ checks that remain the author's responsibility.
|
|
|
492
501
|
|
|
493
502
|
See [CONTRIBUTING.md](./CONTRIBUTING.md). `pnpm install`, then `pnpm checks` runs the typecheck, lint, format check, Knip, tests, size and sync checks. Repositories with recorded debt also run the ratchet.
|
|
494
503
|
|
|
504
|
+
## Part of AntelopeJS
|
|
505
|
+
|
|
506
|
+
This package belongs to [AntelopeJS](https://github.com/AntelopeJS/antelopejs), the TypeScript framework where modules depend on contracts and the application chooses the provider. The open-source back office [AntelopeJS DMS](https://github.com/AntelopeJS/dms) is built on it.
|
|
507
|
+
|
|
495
508
|
## License
|
|
496
509
|
|
|
497
510
|
[Apache-2.0](./LICENSE), except the vendored anti-slop rules (MIT).
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
Copyright 2026 The Geist Project Authors (https://github.com/vercel/geist-font)
|
|
2
|
+
|
|
3
|
+
This Font Software is licensed under the SIL Open Font License, Version 1.1.
|
|
4
|
+
This license is copied below, and is also available with a FAQ at:
|
|
5
|
+
https://openfontlicense.org
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
-----------------------------------------------------------
|
|
9
|
+
SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
|
|
10
|
+
-----------------------------------------------------------
|
|
11
|
+
|
|
12
|
+
PREAMBLE
|
|
13
|
+
The goals of the Open Font License (OFL) are to stimulate worldwide
|
|
14
|
+
development of collaborative font projects, to support the font creation
|
|
15
|
+
efforts of academic and linguistic communities, and to provide a free and
|
|
16
|
+
open framework in which fonts may be shared and improved in partnership
|
|
17
|
+
with others.
|
|
18
|
+
|
|
19
|
+
The OFL allows the licensed fonts to be used, studied, modified and
|
|
20
|
+
redistributed freely as long as they are not sold by themselves. The
|
|
21
|
+
fonts, including any derivative works, can be bundled, embedded,
|
|
22
|
+
redistributed and/or sold with any software provided that any reserved
|
|
23
|
+
names are not used by derivative works. The fonts and derivatives,
|
|
24
|
+
however, cannot be released under any other type of license. The
|
|
25
|
+
requirement for fonts to remain under this license does not apply
|
|
26
|
+
to any document created using the fonts or their derivatives.
|
|
27
|
+
|
|
28
|
+
DEFINITIONS
|
|
29
|
+
"Font Software" refers to the set of files released by the Copyright
|
|
30
|
+
Holder(s) under this license and clearly marked as such. This may
|
|
31
|
+
include source files, build scripts and documentation.
|
|
32
|
+
|
|
33
|
+
"Reserved Font Name" refers to any names specified as such after the
|
|
34
|
+
copyright statement(s).
|
|
35
|
+
|
|
36
|
+
"Original Version" refers to the collection of Font Software components as
|
|
37
|
+
distributed by the Copyright Holder(s).
|
|
38
|
+
|
|
39
|
+
"Modified Version" refers to any derivative made by adding to, deleting,
|
|
40
|
+
or substituting -- in part or in whole -- any of the components of the
|
|
41
|
+
Original Version, by changing formats or by porting the Font Software to a
|
|
42
|
+
new environment.
|
|
43
|
+
|
|
44
|
+
"Author" refers to any designer, engineer, programmer, technical
|
|
45
|
+
writer or other person who contributed to the Font Software.
|
|
46
|
+
|
|
47
|
+
PERMISSION & CONDITIONS
|
|
48
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
|
49
|
+
a copy of the Font Software, to use, study, copy, merge, embed, modify,
|
|
50
|
+
redistribute, and sell modified and unmodified copies of the Font
|
|
51
|
+
Software, subject to the following conditions:
|
|
52
|
+
|
|
53
|
+
1) Neither the Font Software nor any of its individual components,
|
|
54
|
+
in Original or Modified Versions, may be sold by itself.
|
|
55
|
+
|
|
56
|
+
2) Original or Modified Versions of the Font Software may be bundled,
|
|
57
|
+
redistributed and/or sold with any software, provided that each copy
|
|
58
|
+
contains the above copyright notice and this license. These can be
|
|
59
|
+
included either as stand-alone text files, human-readable headers or
|
|
60
|
+
in the appropriate machine-readable metadata fields within text or
|
|
61
|
+
binary files as long as those fields can be easily viewed by the user.
|
|
62
|
+
|
|
63
|
+
3) No Modified Version of the Font Software may use the Reserved Font
|
|
64
|
+
Name(s) unless explicit written permission is granted by the corresponding
|
|
65
|
+
Copyright Holder. This restriction only applies to the primary font name as
|
|
66
|
+
presented to the users.
|
|
67
|
+
|
|
68
|
+
4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
|
|
69
|
+
Software shall not be used to promote, endorse or advertise any
|
|
70
|
+
Modified Version, except to acknowledge the contribution(s) of the
|
|
71
|
+
Copyright Holder(s) and the Author(s) or with their explicit written
|
|
72
|
+
permission.
|
|
73
|
+
|
|
74
|
+
5) The Font Software, modified or unmodified, in part or in whole,
|
|
75
|
+
must be distributed entirely under this license, and must not be
|
|
76
|
+
distributed under any other license. The requirement for fonts to
|
|
77
|
+
remain under this license does not apply to any document created
|
|
78
|
+
using the Font Software.
|
|
79
|
+
|
|
80
|
+
TERMINATION
|
|
81
|
+
This license becomes null and void if any of the above conditions are
|
|
82
|
+
not met.
|
|
83
|
+
|
|
84
|
+
DISCLAIMER
|
|
85
|
+
THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
86
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
|
|
87
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
|
|
88
|
+
OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
|
|
89
|
+
COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
|
90
|
+
INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
|
|
91
|
+
DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
|
92
|
+
FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
|
|
93
|
+
OTHER DEALINGS IN THE FONT SOFTWARE.
|
|
Binary file
|
|
Binary file
|
package/dist/bin/api-diff.mjs
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { o as packageManager, s as parseManifest } from "../package-
|
|
2
|
+
import { o as packageManager, s as parseManifest } from "../package-DnxZ2CXZ.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-Kg-tkM6G.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-DhavwHb7.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
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import { t as runCli } from "../cli-4Tv71vYk.mjs";
|
|
3
3
|
import { c as repositoryRoot, l as resolveRevision } from "../files-DJ0TeaTU.mjs";
|
|
4
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-
|
|
5
|
+
import { n as proofDigest, r as proofLines, s as revisionCountRows, t as parseProofStamp } from "../proof-stamp-Kg-tkM6G.mjs";
|
|
6
6
|
import { readFileSync } from "node:fs";
|
|
7
7
|
import { spawnSync } from "node:child_process";
|
|
8
8
|
import { parseArgs } from "node:util";
|
|
@@ -1,116 +1,8 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
+
import { n as describeViolation, r as localVersions, t as checkInterfaceRanges } from "../interface-ranges-CcVSr59f.mjs";
|
|
2
3
|
import { readFileSync } from "node:fs";
|
|
3
4
|
import { join, relative } from "node:path";
|
|
4
5
|
import { execFileSync } from "node:child_process";
|
|
5
|
-
//#region src/interface-ranges.ts
|
|
6
|
-
/**
|
|
7
|
-
* At startup `@antelopejs/core` keeps one copy of each interface package, the
|
|
8
|
-
* one its implementing module installed, and refuses to start when any loaded
|
|
9
|
-
* module declares a range that copy falls outside. An exact pin (`0.1.7`) or a
|
|
10
|
-
* 0.x caret (`^0.1.2` means `<0.2.0`) therefore stops a module from starting
|
|
11
|
-
* as soon as the implementer resolves the next interface release, with no
|
|
12
|
-
* change to the module itself.
|
|
13
|
-
*
|
|
14
|
-
* A consumer accepts every release from its floor up to the next breaking one
|
|
15
|
-
* (`>=0.1.7 <1.0.0`). The module that implements an interface is the opposite
|
|
16
|
-
* case: it must never be handed a breaking minor it does not implement, so it
|
|
17
|
-
* caps the range below the next minor (`>=0.3.0 <0.4.0`) while the interface
|
|
18
|
-
* is 0.x.
|
|
19
|
-
*/
|
|
20
|
-
const INTERFACE_PACKAGE_PREFIX = "@antelopejs/interface-";
|
|
21
|
-
/** A module's own interface linked from the workspace is the copy it builds against, not a release it resolves. */
|
|
22
|
-
const LOCAL_SPEC_PREFIXES = [
|
|
23
|
-
"workspace:",
|
|
24
|
-
"file:",
|
|
25
|
-
"link:"
|
|
26
|
-
];
|
|
27
|
-
/** The fields `@antelopejs/core` checks at startup. */
|
|
28
|
-
const CHECKED_FIELDS = ["dependencies", "optionalDependencies"];
|
|
29
|
-
const BOUNDED_RANGE = /^>=(\d+)\.(\d+)\.(\d+) <(\d+)\.(\d+)\.(\d+)$/;
|
|
30
|
-
const SINGLE_VERSION = /^[\^~=]?v?(\d+)\.(\d+)\.(\d+)$/;
|
|
31
|
-
const formatVersion = ([major, minor, patch]) => `${major}.${minor}.${patch}`;
|
|
32
|
-
const sameVersion = (a, b) => a[0] === b[0] && a[1] === b[1] && a[2] === b[2];
|
|
33
|
-
/** The first release a module declaring `floor` must not be handed. */
|
|
34
|
-
function rangeCeiling(floor, role) {
|
|
35
|
-
const [major, minor] = floor;
|
|
36
|
-
if (major > 0) return [
|
|
37
|
-
major + 1,
|
|
38
|
-
0,
|
|
39
|
-
0
|
|
40
|
-
];
|
|
41
|
-
return role === "implementer" ? [
|
|
42
|
-
0,
|
|
43
|
-
minor + 1,
|
|
44
|
-
0
|
|
45
|
-
] : [
|
|
46
|
-
1,
|
|
47
|
-
0,
|
|
48
|
-
0
|
|
49
|
-
];
|
|
50
|
-
}
|
|
51
|
-
function expectedRange(floor, role) {
|
|
52
|
-
return `>=${formatVersion(floor)} <${formatVersion(rangeCeiling(floor, role))}`;
|
|
53
|
-
}
|
|
54
|
-
function toVersion(match, offset) {
|
|
55
|
-
return [
|
|
56
|
-
Number(match[offset]),
|
|
57
|
-
Number(match[offset + 1]),
|
|
58
|
-
Number(match[offset + 2])
|
|
59
|
-
];
|
|
60
|
-
}
|
|
61
|
-
/** The lowest release `spec` accepts, when it is a shape this check reads. */
|
|
62
|
-
function readFloor(spec) {
|
|
63
|
-
const bounded = BOUNDED_RANGE.exec(spec);
|
|
64
|
-
if (bounded) return toVersion(bounded, 1);
|
|
65
|
-
const single = SINGLE_VERSION.exec(spec);
|
|
66
|
-
return single ? toVersion(single, 1) : void 0;
|
|
67
|
-
}
|
|
68
|
-
function compareVersions(a, b) {
|
|
69
|
-
return a[0] - b[0] || a[1] - b[1] || a[2] - b[2];
|
|
70
|
-
}
|
|
71
|
-
/** A range is accepted when it is bounded for its role and admits the interface this package builds against. */
|
|
72
|
-
function isAcceptedRange(spec, role, local) {
|
|
73
|
-
const bounded = BOUNDED_RANGE.exec(spec);
|
|
74
|
-
if (!bounded) return false;
|
|
75
|
-
const floor = toVersion(bounded, 1);
|
|
76
|
-
const ceiling = toVersion(bounded, 4);
|
|
77
|
-
if (!sameVersion(ceiling, rangeCeiling(floor, role))) return false;
|
|
78
|
-
return local === void 0 || compareVersions(local, floor) >= 0 && compareVersions(local, ceiling) < 0;
|
|
79
|
-
}
|
|
80
|
-
function isLocalSpec(spec) {
|
|
81
|
-
return LOCAL_SPEC_PREFIXES.some((prefix) => spec.startsWith(prefix));
|
|
82
|
-
}
|
|
83
|
-
/**
|
|
84
|
-
* `localVersions` holds the versions of the packages that sit in the same
|
|
85
|
-
* repository. An implemented interface is usually one of them, and its
|
|
86
|
-
* version, rather than the declared floor, decides the minor to stop below.
|
|
87
|
-
*/
|
|
88
|
-
function checkInterfaceRanges(manifest, localVersions = /* @__PURE__ */ new Map()) {
|
|
89
|
-
const implemented = new Set(manifest.antelopeJs?.implements ?? []);
|
|
90
|
-
const violations = [];
|
|
91
|
-
for (const field of CHECKED_FIELDS) for (const [name, spec] of Object.entries(manifest[field] ?? {})) {
|
|
92
|
-
if (!name.startsWith(INTERFACE_PACKAGE_PREFIX) || isLocalSpec(spec)) continue;
|
|
93
|
-
const role = implemented.has(name) ? "implementer" : "consumer";
|
|
94
|
-
const localVersion = localVersions.get(name);
|
|
95
|
-
const local = role === "implementer" && localVersion !== void 0 ? readFloor(localVersion) : void 0;
|
|
96
|
-
if (isAcceptedRange(spec, role, local)) continue;
|
|
97
|
-
const floor = local ?? readFloor(spec);
|
|
98
|
-
violations.push({
|
|
99
|
-
field,
|
|
100
|
-
name,
|
|
101
|
-
spec,
|
|
102
|
-
role,
|
|
103
|
-
expected: floor ? expectedRange(floor, role) : void 0
|
|
104
|
-
});
|
|
105
|
-
}
|
|
106
|
-
return violations;
|
|
107
|
-
}
|
|
108
|
-
function describeViolation(violation) {
|
|
109
|
-
const { field, name, spec, role, expected } = violation;
|
|
110
|
-
const fix = expected ? `use "${expected}"` : role === "implementer" ? "declare it as >=<floor> <next minor>" : "declare it as >=<floor> <1.0.0";
|
|
111
|
-
return `${field}["${name}"] is "${spec}": ${role === "implementer" ? "this package implements it, so it must stop below the next minor" : "it must accept every release up to the next breaking one"}; ${fix}`;
|
|
112
|
-
}
|
|
113
|
-
//#endregion
|
|
114
6
|
//#region src/bin/check-interface-ranges.ts
|
|
115
7
|
/**
|
|
116
8
|
* Every manifest in the repository by default, whatever directory the lint
|
|
@@ -135,10 +27,9 @@ function main() {
|
|
|
135
27
|
path,
|
|
136
28
|
manifest: JSON.parse(readFileSync(path, "utf8"))
|
|
137
29
|
}));
|
|
138
|
-
const
|
|
139
|
-
for (const { manifest } of manifests) if (manifest.name && manifest.version) localVersions.set(manifest.name, manifest.version);
|
|
30
|
+
const versions = localVersions(manifests.map(({ manifest }) => manifest));
|
|
140
31
|
let failures = 0;
|
|
141
|
-
for (const { path, manifest } of manifests) for (const violation of checkInterfaceRanges(manifest,
|
|
32
|
+
for (const { path, manifest } of manifests) for (const violation of checkInterfaceRanges(manifest, versions)) {
|
|
142
33
|
console.error(`${path}: ${describeViolation(violation)}`);
|
|
143
34
|
failures += 1;
|
|
144
35
|
}
|
package/dist/bin/checks.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { n as runCliAsync } from "../cli-4Tv71vYk.mjs";
|
|
3
3
|
import { c as repositoryRoot } from "../files-DJ0TeaTU.mjs";
|
|
4
|
-
import { r as runChecks, t as CHECKS_SKIP_ENV } from "../checks-
|
|
4
|
+
import { r as runChecks, t as CHECKS_SKIP_ENV } from "../checks-DqTjyKCC.mjs";
|
|
5
5
|
import { parseArgs } from "node:util";
|
|
6
6
|
//#region src/bin/checks.ts
|
|
7
7
|
const SIGNAL_EXIT = /* @__PURE__ */ new Map([
|
|
@@ -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-Kg-tkM6G.mjs";
|
|
5
|
+
import { a as listsNoFiles, c as packagesAt, n as extendedConfigs, t as emitPackage } from "../typescript-DhavwHb7.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/ratchet.mjs
CHANGED
|
@@ -3,7 +3,7 @@ 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-
|
|
6
|
+
import { n as ratchet, r as withPreviousTree } from "../ratchet-1O8k4Dxu.mjs";
|
|
7
7
|
import { t as lintDiagnostics } from "../oxlint-BbpTFFmf.mjs";
|
|
8
8
|
import { d as stagedAdditions, f as stagedChanges, u as previousLine } from "../suppression-budget-DgYdu6JK.mjs";
|
|
9
9
|
import { n as suppressionBase } from "../suppression-base-DZgUDXiI.mjs";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {}
|
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { d as toolingRoot } from "../package-DnxZ2CXZ.mjs";
|
|
3
|
+
import { t as runCli } from "../cli-4Tv71vYk.mjs";
|
|
4
|
+
import { c as repositoryRoot } from "../files-DJ0TeaTU.mjs";
|
|
5
|
+
import { mkdirSync, readFileSync, writeFileSync } from "node:fs";
|
|
6
|
+
import { join } from "node:path";
|
|
7
|
+
import { parseArgs } from "node:util";
|
|
8
|
+
//#region src/guardrails/readme-strip.ts
|
|
9
|
+
/** Where a framework repository keeps its strip banner, relative to its root. */
|
|
10
|
+
const STRIP_PATH = ".github/readme/strip.svg";
|
|
11
|
+
/** The kinds of framework repository, in the order the strip label names them. */
|
|
12
|
+
const STRIP_KINDS = [
|
|
13
|
+
"interface",
|
|
14
|
+
"provider",
|
|
15
|
+
"template",
|
|
16
|
+
"tooling"
|
|
17
|
+
];
|
|
18
|
+
const ACCENT = "#4f8cff";
|
|
19
|
+
const BORDER = "rgba(140,160,220,0.18)";
|
|
20
|
+
const NAME = /^[a-z0-9]+(?:-[a-z0-9]+)*$/;
|
|
21
|
+
/** Kinds whose repository names start with the kind, such as `interface-email`; the label names the kind once. */
|
|
22
|
+
const REPEATED_KINDS = /* @__PURE__ */ new Set(["interface", "template"]);
|
|
23
|
+
const TAGLINE = "Hexagonal architecture, beyond your own code.";
|
|
24
|
+
const FONTS = [["GeistX", "geist-extrabold.woff2"], ["GeistM", "geist-mono.woff2"]];
|
|
25
|
+
const HEXAGON = {
|
|
26
|
+
x: 750,
|
|
27
|
+
y: 75,
|
|
28
|
+
radius: 40
|
|
29
|
+
};
|
|
30
|
+
const SPOKES = [
|
|
31
|
+
[
|
|
32
|
+
0,
|
|
33
|
+
-44,
|
|
34
|
+
0,
|
|
35
|
+
-60
|
|
36
|
+
],
|
|
37
|
+
[
|
|
38
|
+
0,
|
|
39
|
+
44,
|
|
40
|
+
0,
|
|
41
|
+
60
|
|
42
|
+
],
|
|
43
|
+
[
|
|
44
|
+
38,
|
|
45
|
+
-22,
|
|
46
|
+
78,
|
|
47
|
+
-40
|
|
48
|
+
],
|
|
49
|
+
[
|
|
50
|
+
38,
|
|
51
|
+
22,
|
|
52
|
+
78,
|
|
53
|
+
40
|
|
54
|
+
],
|
|
55
|
+
[
|
|
56
|
+
-38,
|
|
57
|
+
-22,
|
|
58
|
+
-78,
|
|
59
|
+
-40
|
|
60
|
+
],
|
|
61
|
+
[
|
|
62
|
+
-38,
|
|
63
|
+
22,
|
|
64
|
+
-78,
|
|
65
|
+
40
|
|
66
|
+
]
|
|
67
|
+
];
|
|
68
|
+
function isKind(kind) {
|
|
69
|
+
return STRIP_KINDS.some((known) => known === kind);
|
|
70
|
+
}
|
|
71
|
+
/** The label the strip shows for a repository, such as `PROVIDER · FILE STORAGE S3`. */
|
|
72
|
+
function stripLabel(kind, name) {
|
|
73
|
+
if (!isKind(kind)) throw new Error(`unknown strip kind "${kind}": use one of ${STRIP_KINDS.join(", ")}.`);
|
|
74
|
+
if (!NAME.test(name)) throw new Error(`invalid strip name "${name}": use lowercase words joined by hyphens, such as file-storage-s3.`);
|
|
75
|
+
if (REPEATED_KINDS.has(kind) && name.startsWith(`${kind}-`)) throw new Error(`strip name "${name}" repeats the kind: pass --name ${name.slice(kind.length + 1)}, the label reads ${kind.toUpperCase()} · ${name.slice(kind.length + 1).replaceAll("-", " ").toUpperCase()}.`);
|
|
76
|
+
return `${kind} · ${name.replaceAll("-", " ")}`.toUpperCase();
|
|
77
|
+
}
|
|
78
|
+
function fontFaces() {
|
|
79
|
+
const directory = join(toolingRoot(), "assets/readme");
|
|
80
|
+
return FONTS.map(([family, file]) => `@font-face{font-family:'${family}';src:url(data:font/woff2;base64,${readFileSync(join(directory, file)).toString("base64")}) format('woff2')}`).join("");
|
|
81
|
+
}
|
|
82
|
+
function hexagon() {
|
|
83
|
+
const { x, y, radius } = HEXAGON;
|
|
84
|
+
const points = [
|
|
85
|
+
-90,
|
|
86
|
+
-30,
|
|
87
|
+
30,
|
|
88
|
+
90,
|
|
89
|
+
150,
|
|
90
|
+
210
|
|
91
|
+
].map((degrees) => {
|
|
92
|
+
const angle = degrees * Math.PI / 180;
|
|
93
|
+
return `${(x + radius * Math.cos(angle)).toFixed(1)},${(y + radius * Math.sin(angle)).toFixed(1)}`;
|
|
94
|
+
}).join(" ");
|
|
95
|
+
return `${SPOKES.map(([x1, y1, x2, y2]) => `<line x1="${x + x1}" y1="${y + y1}" x2="${x + x2}" y2="${y + y2}" stroke="${BORDER}" stroke-width="2"/><circle cx="${x + x2}" cy="${y + y2}" r="5" fill="#15151b" stroke="${BORDER}"/>`).join("")}<polygon points="${points}" fill="${ACCENT}" fill-opacity=".14" stroke="${ACCENT}" stroke-width="2"/>`;
|
|
96
|
+
}
|
|
97
|
+
/** The 1200x150 strip banner of a framework repository, in the layout and fonts of the DMS strips and the framework blue. */
|
|
98
|
+
function stripSvg(kind, name) {
|
|
99
|
+
const label = stripLabel(kind, name);
|
|
100
|
+
const description = `${label}: part of AntelopeJS, hexagonal architecture beyond your own code. A glowing button reads Star AntelopeJS.`;
|
|
101
|
+
return [
|
|
102
|
+
`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1200 150" width="1200" height="150" role="img" aria-label="${description}"><title>${description}</title>`,
|
|
103
|
+
`<style>${fontFaces()}.x{font-family:'GeistX',sans-serif;font-weight:800}.m{font-family:'GeistM',monospace}@keyframes a1{0%,8.89%{opacity:0;transform:scale(.7)}11.89%,88.00%{opacity:1;transform:none}92.00%,100%{opacity:0;transform:scale(.7)}}.a1{opacity:0;transform:scale(.7);transform-box:fill-box;transform-origin:center;animation:a1 9.0s cubic-bezier(.2,.8,.2,1) infinite}@keyframes pulse{0%,100%{opacity:.35}50%{opacity:.9}}.pulse{animation:pulse 2s ease-in-out infinite}@media (prefers-reduced-motion:reduce){*{animation:none!important;opacity:1!important}.cover{display:none}}</style>`,
|
|
104
|
+
`<defs><radialGradient id="g" cx="75%" cy="50%" r="60%"><stop offset="0" stop-color="${ACCENT}" stop-opacity=".10"/><stop offset="1" stop-color="#06070d" stop-opacity="0"/></radialGradient></defs>`,
|
|
105
|
+
`<rect width="1200" height="150" rx="16" fill="#06070d"/><rect width="1200" height="150" rx="16" fill="url(#g)"/><rect x=".5" y=".5" width="1199" height="149" rx="16" fill="none" stroke="${BORDER}"/>`,
|
|
106
|
+
`<text x="48" y="50" class="m" fill="${ACCENT}" font-size="15" letter-spacing="3">${label}</text>`,
|
|
107
|
+
`<text x="46" y="98" class="x" fill="#f8f8f9" font-size="32">Part of <tspan fill="${ACCENT}">AntelopeJS</tspan></text>`,
|
|
108
|
+
`<text x="48" y="128" class="m" fill="#9b9ba4" font-size="16">${TAGLINE}</text>`,
|
|
109
|
+
hexagon(),
|
|
110
|
+
`<g class="a1"><rect class="pulse" x="870" y="44" width="290" height="62" rx="31" fill="none" stroke="${ACCENT}" stroke-width="2"/><rect x="876" y="50" width="278" height="50" rx="25" fill="${ACCENT}" fill-opacity=".14"/><text x="1015" y="82" text-anchor="middle" class="x" fill="${ACCENT}" font-size="20">★ Star AntelopeJS</text></g>`,
|
|
111
|
+
"</svg>",
|
|
112
|
+
""
|
|
113
|
+
].join("");
|
|
114
|
+
}
|
|
115
|
+
/** Writes the strip banner of the repository at `root` to `.github/readme/strip.svg`. */
|
|
116
|
+
function writeStrip(root, kind, name) {
|
|
117
|
+
const svg = stripSvg(kind, name);
|
|
118
|
+
mkdirSync(join(root, ".github/readme"), { recursive: true });
|
|
119
|
+
writeFileSync(join(root, STRIP_PATH), svg);
|
|
120
|
+
}
|
|
121
|
+
//#endregion
|
|
122
|
+
//#region src/bin/readme-strip.ts
|
|
123
|
+
const USAGE = `usage: antelopejs-readme-strip --kind <${STRIP_KINDS.join("|")}> --name <label-name>`;
|
|
124
|
+
runCli(() => {
|
|
125
|
+
const { values } = parseArgs({ options: {
|
|
126
|
+
kind: { type: "string" },
|
|
127
|
+
name: { type: "string" }
|
|
128
|
+
} });
|
|
129
|
+
if (values.kind === void 0 || values.name === void 0) throw new Error(USAGE);
|
|
130
|
+
writeStrip(repositoryRoot(), values.kind, values.name);
|
|
131
|
+
return 0;
|
|
132
|
+
});
|
|
133
|
+
//#endregion
|
|
134
|
+
export {};
|
package/dist/bin/sync.mjs
CHANGED
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { a as formatCeilings, l as readCeilings, s as isRetired, t as CEILINGS_FILE } from "../ceilings-B7KayYIG.mjs";
|
|
3
|
-
import { a as managedPackage, c as repositoryTools,
|
|
3
|
+
import { a as managedPackage, c as repositoryTools, f as toolingVersions, l as serializeManifest, m as usesNuxt, n as bootstrapDependencies, o as packageManager, p as usesCaptures, r as bootstrappedManifest, s as parseManifest, t as addedDevDependencies, u as templatePackage } from "../package-DnxZ2CXZ.mjs";
|
|
4
4
|
import { t as admits } from "../semver-BDxeEcP_.mjs";
|
|
5
|
-
import { i as presetConfig, n as SETUP_SCRIPT, r as lefthook, t as PRESET_CONFIGS } from "../templates-
|
|
5
|
+
import { i as presetConfig, n as SETUP_SCRIPT, r as lefthook, t as PRESET_CONFIGS } from "../templates-Dg188oRC.mjs";
|
|
6
6
|
import { a as VERIFY_KINDS, c as isVerifyKind, i as SYNCED_SKILL_FILES, l as skillFolder, o as claudeLink, s as claudeLinkTarget, u as planDocsSkills } from "../shared-igPpEDpS.mjs";
|
|
7
|
+
import { r as localVersions, t as checkInterfaceRanges } from "../interface-ranges-CcVSr59f.mjs";
|
|
7
8
|
import { t as runCli } from "../cli-4Tv71vYk.mjs";
|
|
8
9
|
import { c as CI_CONTEXT, f as ciWorkflow, i as hasChecksWorkflow, n as ciNodeCallers, p as placeholderTestScript, r as ciRenovateSyncCallers, s as renovateArtifacts, t as MISSING_CHECKS_WORKFLOW, u as CI_PATH } from "../workflow-CPcNc8KL.mjs";
|
|
9
|
-
import { a as gitFiles, c as repositoryRoot } from "../files-DJ0TeaTU.mjs";
|
|
10
|
-
import { a as stepsOf, c as workspacePatterns, i as matchingScripts, n as droppedChecksSteps, o as planDocs, s as workspaceDirectories } from "../checks-
|
|
11
|
-
import { i as recordedRelease, t as measureBaseline } from "../ratchet-
|
|
10
|
+
import { a as gitFiles, c as repositoryRoot, u as trackedManifests } from "../files-DJ0TeaTU.mjs";
|
|
11
|
+
import { a as stepsOf, c as workspacePatterns, i as matchingScripts, n as droppedChecksSteps, o as planDocs, s as workspaceDirectories } from "../checks-DqTjyKCC.mjs";
|
|
12
|
+
import { i as recordedRelease, t as measureBaseline } from "../ratchet-1O8k4Dxu.mjs";
|
|
12
13
|
import { n as SUPPRESSIONS_FILE, r as adoptedBudget } from "../suppression-budget-DgYdu6JK.mjs";
|
|
13
14
|
import { u as typescript } from "../suppressions-CQTcKCi1.mjs";
|
|
14
15
|
import { t as DEFAULT_SHARED } from "../map-DRyYz_Fw.mjs";
|
|
@@ -87,6 +88,19 @@ function untypedDocsFiles(root) {
|
|
|
87
88
|
return [...found];
|
|
88
89
|
}
|
|
89
90
|
//#endregion
|
|
91
|
+
//#region src/guardrails/run-pnpm.ts
|
|
92
|
+
/** Runs pnpm, the only manager the pack's CI installs with, with `args` quietly; returns its output only when it failed. */
|
|
93
|
+
function runPnpm(root, args) {
|
|
94
|
+
const command = ["pnpm", ...args].join(" ");
|
|
95
|
+
const result = spawnSync("pnpm", args, {
|
|
96
|
+
cwd: root,
|
|
97
|
+
encoding: "utf8"
|
|
98
|
+
});
|
|
99
|
+
if (result.error) return `${command} failed: ${result.error.message}`;
|
|
100
|
+
if (result.status === 0) return void 0;
|
|
101
|
+
return `${command} failed (exit ${result.status}).\n${result.stdout}${result.stderr}`.trimEnd();
|
|
102
|
+
}
|
|
103
|
+
//#endregion
|
|
90
104
|
//#region src/guardrails/agents-block.ts
|
|
91
105
|
const AGENTS_BLOCK_START = "<!-- antelopejs-guardrails:start -->";
|
|
92
106
|
const AGENTS_BLOCK_END = "<!-- antelopejs-guardrails:end -->";
|
|
@@ -1923,19 +1937,8 @@ function ensureBranchCleanup(root) {
|
|
|
1923
1937
|
reason: failureText(write)
|
|
1924
1938
|
} : { kind: "enabled" };
|
|
1925
1939
|
}
|
|
1926
|
-
/** Runs pnpm, the only manager the pack's CI installs with, with `args` quietly; returns its output only when it failed. */
|
|
1927
|
-
function run(root, args) {
|
|
1928
|
-
const command = ["pnpm", ...args].join(" ");
|
|
1929
|
-
const result = spawnSync("pnpm", args, {
|
|
1930
|
-
cwd: root,
|
|
1931
|
-
encoding: "utf8"
|
|
1932
|
-
});
|
|
1933
|
-
if (result.error) return `${command} failed: ${result.error.message}`;
|
|
1934
|
-
if (result.status === 0) return void 0;
|
|
1935
|
-
return `${command} failed (exit ${result.status}).\n${result.stdout}${result.stderr}`.trimEnd();
|
|
1936
|
-
}
|
|
1937
1940
|
function install(root) {
|
|
1938
|
-
return
|
|
1941
|
+
return runPnpm(root, ["install"]);
|
|
1939
1942
|
}
|
|
1940
1943
|
function resolveOxfmt(root) {
|
|
1941
1944
|
const require = createRequire(join(root, "package.json"));
|
|
@@ -2087,7 +2090,7 @@ function bootstrap(root) {
|
|
|
2087
2090
|
};
|
|
2088
2091
|
const foreign = FOREIGN_INSTALL_FILES.filter(({ file }) => existsSync(join(root, file)));
|
|
2089
2092
|
paths.push(...ensurePnpmWorkspace(root, foreign.length > 0));
|
|
2090
|
-
const imported = foreign.some(({ importable }) => importable) && !existsSync(join(root, "pnpm-lock.yaml")) ?
|
|
2093
|
+
const imported = foreign.some(({ importable }) => importable) && !existsSync(join(root, "pnpm-lock.yaml")) ? runPnpm(root, ["import"]) : void 0;
|
|
2091
2094
|
if (imported !== void 0) return {
|
|
2092
2095
|
paths,
|
|
2093
2096
|
removed: [],
|
|
@@ -2141,7 +2144,92 @@ function initRepository(root, options = {}) {
|
|
|
2141
2144
|
};
|
|
2142
2145
|
}
|
|
2143
2146
|
//#endregion
|
|
2147
|
+
//#region src/guardrails/interface-ranges-sync.ts
|
|
2148
|
+
/** Each tracked manifest that parses; a fixture that is not JSON is not a package this repository releases. */
|
|
2149
|
+
function tracked(root) {
|
|
2150
|
+
return trackedManifests(root).flatMap((path) => {
|
|
2151
|
+
try {
|
|
2152
|
+
const text = readFileSync(join(root, path), "utf8");
|
|
2153
|
+
return [{
|
|
2154
|
+
path,
|
|
2155
|
+
text,
|
|
2156
|
+
manifest: parseManifest(text)
|
|
2157
|
+
}];
|
|
2158
|
+
} catch {
|
|
2159
|
+
return [];
|
|
2160
|
+
}
|
|
2161
|
+
});
|
|
2162
|
+
}
|
|
2163
|
+
function movedNote(path, violation) {
|
|
2164
|
+
return `${path}: moved ${violation.field}["${violation.name}"] from "${violation.spec}" to "${violation.expected}", the range of the interface version this repository holds.`;
|
|
2165
|
+
}
|
|
2166
|
+
/** The relock failure, after which the moved manifests are back as they were so the next sync moves them again. */
|
|
2167
|
+
function writeAndRelock(root, manifests, moved) {
|
|
2168
|
+
const rootManifest = manifests.find(({ path }) => path === "package.json");
|
|
2169
|
+
const manager = packageManager(rootManifest?.manifest ?? {});
|
|
2170
|
+
if (manager !== "pnpm") return `${manager} is not pnpm, so sync cannot relock them.`;
|
|
2171
|
+
for (const [path, { after }] of moved) writeFileSync(join(root, path), after);
|
|
2172
|
+
const failure = runPnpm(root, ["install", "--lockfile-only"]);
|
|
2173
|
+
if (failure !== void 0) for (const [path, { before }] of moved) writeFileSync(join(root, path), before);
|
|
2174
|
+
return failure;
|
|
2175
|
+
}
|
|
2176
|
+
/**
|
|
2177
|
+
* Moves each tracked manifest's range for an interface it implements from
|
|
2178
|
+
* this repository to the range `antelopejs-check-interface-ranges` expects,
|
|
2179
|
+
* then relocks, or leaves every manifest as it was when the relock fails. A
|
|
2180
|
+
* minor release of that interface otherwise leaves its module's range below
|
|
2181
|
+
* the new version and fails the check on the release commit. It runs before
|
|
2182
|
+
* the rest of sync, which then plans the docs-compat READMEs from the moved
|
|
2183
|
+
* ranges and the new lockfile. `check` reports the moves without writing.
|
|
2184
|
+
*/
|
|
2185
|
+
function moveInterfaceRanges(root, check) {
|
|
2186
|
+
const manifests = tracked(root);
|
|
2187
|
+
const versions = localVersions(manifests.map(({ manifest }) => manifest));
|
|
2188
|
+
const moves = {
|
|
2189
|
+
paths: [],
|
|
2190
|
+
notes: [],
|
|
2191
|
+
errors: []
|
|
2192
|
+
};
|
|
2193
|
+
const moved = /* @__PURE__ */ new Map();
|
|
2194
|
+
for (const { path, text, manifest } of manifests) {
|
|
2195
|
+
const fixes = checkInterfaceRanges(manifest, versions).filter((violation) => violation.role === "implementer" && violation.expected !== void 0 && versions.has(violation.name));
|
|
2196
|
+
if (!fixes.length) continue;
|
|
2197
|
+
for (const { field, name, expected } of fixes) {
|
|
2198
|
+
const dependencies = manifest[field];
|
|
2199
|
+
if (dependencies && expected) dependencies[name] = expected;
|
|
2200
|
+
}
|
|
2201
|
+
moved.set(path, {
|
|
2202
|
+
before: text,
|
|
2203
|
+
after: serializeManifest(manifest, text)
|
|
2204
|
+
});
|
|
2205
|
+
moves.paths.push(path);
|
|
2206
|
+
moves.notes.push(...fixes.map((fix) => movedNote(path, fix)));
|
|
2207
|
+
}
|
|
2208
|
+
if (check || !moved.size) return moves;
|
|
2209
|
+
const failure = writeAndRelock(root, manifests, moved);
|
|
2210
|
+
if (failure !== void 0) moves.errors.push(`Left the interface ranges in ${moves.paths.join(", ")} unmoved: the lockfile could not follow them. ${failure}`);
|
|
2211
|
+
return moves;
|
|
2212
|
+
}
|
|
2213
|
+
//#endregion
|
|
2144
2214
|
//#region src/bin/sync.ts
|
|
2215
|
+
/** The sync result with the interface range moves that ran before it, or the moves alone when relocking them failed. */
|
|
2216
|
+
function withRangeMoves(ranges, result) {
|
|
2217
|
+
if (!result) return {
|
|
2218
|
+
artifacts: [],
|
|
2219
|
+
paths: [],
|
|
2220
|
+
removed: [],
|
|
2221
|
+
errors: ranges.errors,
|
|
2222
|
+
notes: ranges.notes,
|
|
2223
|
+
verifyNotes: [],
|
|
2224
|
+
advisories: [],
|
|
2225
|
+
dependenciesAdded: false
|
|
2226
|
+
};
|
|
2227
|
+
return {
|
|
2228
|
+
...result,
|
|
2229
|
+
paths: result.errors.length ? [] : [.../* @__PURE__ */ new Set([...ranges.paths, ...result.paths])],
|
|
2230
|
+
notes: [...ranges.notes, ...result.notes]
|
|
2231
|
+
};
|
|
2232
|
+
}
|
|
2145
2233
|
function printSync(result, { check, installed }) {
|
|
2146
2234
|
for (const note of result.notes) process.stdout.write(`Note: ${check || result.errors.length ? "Planned migration. " : ""}${note}\n`);
|
|
2147
2235
|
for (const note of result.verifyNotes) process.stdout.write(`Note: ${note}\n`);
|
|
@@ -2186,12 +2274,15 @@ runCli(() => {
|
|
|
2186
2274
|
if (values.verify !== void 0 && !isVerifyChoice(values.verify)) throw new Error("--verify must be interface, module, template, or custom.");
|
|
2187
2275
|
if (values.init && (values.check || values.profile === "template")) throw new Error("--init sets up a full-profile repository; it cannot be combined with --check or --profile template.");
|
|
2188
2276
|
if (values.init) return init(values.verify);
|
|
2189
|
-
|
|
2190
|
-
|
|
2277
|
+
const root = repositoryRoot();
|
|
2278
|
+
const check = Boolean(values.check);
|
|
2279
|
+
const ranges = moveInterfaceRanges(root, check);
|
|
2280
|
+
return printSync(withRangeMoves(ranges, ranges.errors.length ? void 0 : syncRepository(root, {
|
|
2281
|
+
check,
|
|
2191
2282
|
profile: values.profile,
|
|
2192
2283
|
verify: values.verify
|
|
2193
|
-
}), {
|
|
2194
|
-
check
|
|
2284
|
+
})), {
|
|
2285
|
+
check,
|
|
2195
2286
|
installed: false
|
|
2196
2287
|
});
|
|
2197
2288
|
});
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { t as CEILINGS_FILE } from "./ceilings-B7KayYIG.mjs";
|
|
2
|
-
import { o as packageManager, s as parseManifest } from "./package-
|
|
2
|
+
import { o as packageManager, s as parseManifest } from "./package-DnxZ2CXZ.mjs";
|
|
3
3
|
import { a as gitFiles } from "./files-DJ0TeaTU.mjs";
|
|
4
4
|
import { t as accepting } from "./ports-DGP6bPJy.mjs";
|
|
5
5
|
import { createRequire } from "node:module";
|
|
@@ -11,6 +11,26 @@ import ts from "typescript";
|
|
|
11
11
|
import { createHash } from "node:crypto";
|
|
12
12
|
import { tmpdir } from "node:os";
|
|
13
13
|
import { minimatch } from "minimatch";
|
|
14
|
+
//#region src/guardrails/marker-block.ts
|
|
15
|
+
/** The comment pair sync writes a generated block between. */
|
|
16
|
+
function markers(name) {
|
|
17
|
+
return {
|
|
18
|
+
name,
|
|
19
|
+
start: `<!-- ${name}:start -->`,
|
|
20
|
+
end: `<!-- ${name}:end -->`
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
/** The README with `block` between its markers. A README without markers comes back as it is. */
|
|
24
|
+
function placeMarkedBlock(current, { name, start, end }, block) {
|
|
25
|
+
const starts = current.split(start).length - 1;
|
|
26
|
+
const ends = current.split(end).length - 1;
|
|
27
|
+
if (starts === 0 && ends === 0) return current;
|
|
28
|
+
const from = current.indexOf(start);
|
|
29
|
+
const to = current.indexOf(end);
|
|
30
|
+
if (starts !== 1 || ends !== 1 || to < from) throw new Error(`invalid ${name} markers: a README holds exactly one start marker followed by one end marker. Repair or delete them, then rerun antelopejs-sync.`);
|
|
31
|
+
return `${current.slice(0, from)}${block}${current.slice(to + end.length).replace(/^\r?\n/, "")}`;
|
|
32
|
+
}
|
|
33
|
+
//#endregion
|
|
14
34
|
//#region src/guardrails/markdown-table.ts
|
|
15
35
|
/** The lines of a Markdown table whose first row is the header, columns padded as oxfmt leaves them. */
|
|
16
36
|
function tableLines(table) {
|
|
@@ -23,12 +43,111 @@ function tableLines(table) {
|
|
|
23
43
|
];
|
|
24
44
|
}
|
|
25
45
|
//#endregion
|
|
46
|
+
//#region src/guardrails/docs-framework-modules.ts
|
|
47
|
+
const FRAMEWORK_MODULES = markers("antelopejs-framework-modules");
|
|
48
|
+
const FRAMEWORK_MODULES_START = FRAMEWORK_MODULES.start;
|
|
49
|
+
const FRAMEWORK_MODULES_END = FRAMEWORK_MODULES.end;
|
|
50
|
+
const ORGANIZATION$1 = "https://github.com/AntelopeJS";
|
|
51
|
+
const SCOPE$1 = "@antelopejs/";
|
|
52
|
+
/** The framework areas in display order. Every README holding the markers lists exactly these. */
|
|
53
|
+
const AREAS = [
|
|
54
|
+
{
|
|
55
|
+
area: "API",
|
|
56
|
+
contracts: [
|
|
57
|
+
"interface-api",
|
|
58
|
+
"interface-api-util",
|
|
59
|
+
"interface-data-api"
|
|
60
|
+
],
|
|
61
|
+
providers: ["api"]
|
|
62
|
+
},
|
|
63
|
+
{
|
|
64
|
+
area: "Auth",
|
|
65
|
+
contracts: ["interface-auth"],
|
|
66
|
+
providers: ["auth-jwt"]
|
|
67
|
+
},
|
|
68
|
+
{
|
|
69
|
+
area: "Database",
|
|
70
|
+
contracts: [
|
|
71
|
+
"interface-database",
|
|
72
|
+
"interface-database-decorators",
|
|
73
|
+
"interface-database-catalog",
|
|
74
|
+
"interface-mongodb",
|
|
75
|
+
"interface-rethinkdb"
|
|
76
|
+
],
|
|
77
|
+
providers: [
|
|
78
|
+
"postgres",
|
|
79
|
+
"mongodb",
|
|
80
|
+
"rethinkdb"
|
|
81
|
+
]
|
|
82
|
+
},
|
|
83
|
+
{
|
|
84
|
+
area: "Redis",
|
|
85
|
+
contracts: ["interface-redis", "interface-redis-scheduler"],
|
|
86
|
+
providers: ["redis"]
|
|
87
|
+
},
|
|
88
|
+
{
|
|
89
|
+
area: "Email",
|
|
90
|
+
contracts: ["interface-email"],
|
|
91
|
+
providers: ["nodemailer", "brevo"]
|
|
92
|
+
},
|
|
93
|
+
{
|
|
94
|
+
area: "File storage",
|
|
95
|
+
contracts: ["interface-file-storage"],
|
|
96
|
+
providers: ["file-storage-local", "file-storage-s3"]
|
|
97
|
+
},
|
|
98
|
+
{
|
|
99
|
+
area: "Payments",
|
|
100
|
+
contracts: [
|
|
101
|
+
"interface-payment",
|
|
102
|
+
"interface-subscriptions",
|
|
103
|
+
"interface-stripe"
|
|
104
|
+
],
|
|
105
|
+
providers: [
|
|
106
|
+
"stripe",
|
|
107
|
+
"mollie",
|
|
108
|
+
"checkout-com",
|
|
109
|
+
"payment-subscriptions"
|
|
110
|
+
]
|
|
111
|
+
}
|
|
112
|
+
];
|
|
113
|
+
function cell(repos, current) {
|
|
114
|
+
return repos.map((repo) => repo === current ? `**\`${repo}\`**` : `[\`${repo}\`](${ORGANIZATION$1}/${repo})`).join(" · ");
|
|
115
|
+
}
|
|
116
|
+
/** The generated block, the README's own repository in bold, formatted as oxfmt leaves it. */
|
|
117
|
+
function frameworkModulesBlock(current) {
|
|
118
|
+
return [
|
|
119
|
+
FRAMEWORK_MODULES_START,
|
|
120
|
+
"",
|
|
121
|
+
...tableLines([[
|
|
122
|
+
"Area",
|
|
123
|
+
"Contracts",
|
|
124
|
+
"Providers"
|
|
125
|
+
], ...AREAS.map(({ area, contracts, providers }) => [
|
|
126
|
+
area,
|
|
127
|
+
cell(contracts, current),
|
|
128
|
+
cell(providers, current)
|
|
129
|
+
])]),
|
|
130
|
+
"",
|
|
131
|
+
FRAMEWORK_MODULES_END,
|
|
132
|
+
""
|
|
133
|
+
].join("\n");
|
|
134
|
+
}
|
|
135
|
+
/** The repository a package lives in: its name without the `@antelopejs/` scope, as every framework package is named. */
|
|
136
|
+
function frameworkRepo(packageName) {
|
|
137
|
+
return packageName?.startsWith(SCOPE$1) ? packageName.slice(12) : void 0;
|
|
138
|
+
}
|
|
139
|
+
/** The README with the block between its markers rewritten for the package named `packageName`. A README without markers comes back as it is. */
|
|
140
|
+
function placeFrameworkModulesBlock(current, packageName) {
|
|
141
|
+
return placeMarkedBlock(current, FRAMEWORK_MODULES, frameworkModulesBlock(frameworkRepo(packageName)));
|
|
142
|
+
}
|
|
143
|
+
//#endregion
|
|
26
144
|
//#region src/guardrails/docs-modules.ts
|
|
27
|
-
const
|
|
28
|
-
const
|
|
145
|
+
const DMS_MODULES = markers("antelopejs-dms-modules");
|
|
146
|
+
const DMS_MODULES_START = DMS_MODULES.start;
|
|
147
|
+
const DMS_MODULES_END = DMS_MODULES.end;
|
|
29
148
|
const ORGANIZATION = "https://github.com/AntelopeJS";
|
|
30
149
|
/** The AntelopeJS DMS modules in display order. Every README holding the markers lists exactly these. */
|
|
31
|
-
const
|
|
150
|
+
const MODULES = [
|
|
32
151
|
{
|
|
33
152
|
repo: "dms-builder",
|
|
34
153
|
row: "Edit pages, tables and data sources by clicking, as TypeScript that compiles"
|
|
@@ -79,7 +198,7 @@ function modulesBlock() {
|
|
|
79
198
|
return [
|
|
80
199
|
DMS_MODULES_START,
|
|
81
200
|
"",
|
|
82
|
-
...tableLines([["Module", "What it adds"], ...
|
|
201
|
+
...tableLines([["Module", "What it adds"], ...MODULES.map(({ repo, row }) => [`[\`${repo}\`](${ORGANIZATION}/${repo})`, row])]),
|
|
83
202
|
"",
|
|
84
203
|
DMS_MODULES_END,
|
|
85
204
|
""
|
|
@@ -87,13 +206,7 @@ function modulesBlock() {
|
|
|
87
206
|
}
|
|
88
207
|
/** The README with the block between its markers rewritten. A README without markers comes back as it is. */
|
|
89
208
|
function placeModulesBlock(current) {
|
|
90
|
-
|
|
91
|
-
const end = current.indexOf(DMS_MODULES_END);
|
|
92
|
-
const starts = current.split(DMS_MODULES_START).length - 1;
|
|
93
|
-
const ends = current.split(DMS_MODULES_END).length - 1;
|
|
94
|
-
if (starts === 0 && ends === 0) return current;
|
|
95
|
-
if (starts !== 1 || ends !== 1 || end < start) throw new Error("invalid antelopejs-dms-modules markers: a README holds exactly one start marker followed by one end marker. Repair or delete them, then rerun antelopejs-sync.");
|
|
96
|
-
return `${current.slice(0, start)}${modulesBlock()}${current.slice(end + 35).replace(/^\r?\n/, "")}`;
|
|
209
|
+
return placeMarkedBlock(current, DMS_MODULES, modulesBlock());
|
|
97
210
|
}
|
|
98
211
|
//#endregion
|
|
99
212
|
//#region src/guardrails/docs-compat.ts
|
|
@@ -305,7 +418,7 @@ function readLock(root, shared, directory, documents) {
|
|
|
305
418
|
};
|
|
306
419
|
}
|
|
307
420
|
/** Adds one package's `docs-files` lines and, when it needs one, its README with the generated blocks. */
|
|
308
|
-
function planPackage(root, plan, lock, standard, { directory, ranges, published, node }) {
|
|
421
|
+
function planPackage(root, plan, lock, standard, { directory, name, ranges, published, node }) {
|
|
309
422
|
const readme = relative$1(directory, "README.md");
|
|
310
423
|
const docs = relative$1(directory, "docs");
|
|
311
424
|
if (!published) return;
|
|
@@ -324,7 +437,7 @@ function planPackage(root, plan, lock, standard, { directory, ranges, published,
|
|
|
324
437
|
plan.readmes.push({
|
|
325
438
|
path: readme,
|
|
326
439
|
current,
|
|
327
|
-
content: placeModulesBlock(rows.length > 0 ? placeCompatBlock(withRequirements, compatBlock(rows)) : withRequirements ?? "")
|
|
440
|
+
content: placeFrameworkModulesBlock(placeModulesBlock(rows.length > 0 ? placeCompatBlock(withRequirements, compatBlock(rows)) : withRequirements ?? ""), name)
|
|
328
441
|
});
|
|
329
442
|
} catch (error) {
|
|
330
443
|
plan.errors.push(`${readme}: ${error instanceof Error ? error.message : String(error)}`);
|
|
@@ -342,6 +455,7 @@ function planDocs(root, manager) {
|
|
|
342
455
|
const manifest = directory ? readManifest(root, directory) : rootManifest;
|
|
343
456
|
return {
|
|
344
457
|
directory,
|
|
458
|
+
name: manifest.name,
|
|
345
459
|
published: !directory || !manifest.private,
|
|
346
460
|
node: manifest.engines?.node,
|
|
347
461
|
ranges: manifest.private ? /* @__PURE__ */ new Map() : declaredRanges(manifest)
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
//#region src/interface-ranges.ts
|
|
2
|
+
/**
|
|
3
|
+
* At startup `@antelopejs/core` keeps one copy of each interface package, the
|
|
4
|
+
* one its implementing module installed, and refuses to start when any loaded
|
|
5
|
+
* module declares a range that copy falls outside. An exact pin (`0.1.7`) or a
|
|
6
|
+
* 0.x caret (`^0.1.2` means `<0.2.0`) therefore stops a module from starting
|
|
7
|
+
* as soon as the implementer resolves the next interface release, with no
|
|
8
|
+
* change to the module itself.
|
|
9
|
+
*
|
|
10
|
+
* A consumer accepts every release from its floor up to the next breaking one
|
|
11
|
+
* (`>=0.1.7 <1.0.0`). The module that implements an interface is the opposite
|
|
12
|
+
* case: it must never be handed a breaking minor it does not implement, so it
|
|
13
|
+
* caps the range below the next minor (`>=0.3.0 <0.4.0`) while the interface
|
|
14
|
+
* is 0.x.
|
|
15
|
+
*/
|
|
16
|
+
const INTERFACE_PACKAGE_PREFIX = "@antelopejs/interface-";
|
|
17
|
+
/** A module's own interface linked from the workspace is the copy it builds against, not a release it resolves. */
|
|
18
|
+
const LOCAL_SPEC_PREFIXES = [
|
|
19
|
+
"workspace:",
|
|
20
|
+
"file:",
|
|
21
|
+
"link:"
|
|
22
|
+
];
|
|
23
|
+
/** The fields `@antelopejs/core` checks at startup. */
|
|
24
|
+
const CHECKED_FIELDS = ["dependencies", "optionalDependencies"];
|
|
25
|
+
const BOUNDED_RANGE = /^>=(\d+)\.(\d+)\.(\d+) <(\d+)\.(\d+)\.(\d+)$/;
|
|
26
|
+
const SINGLE_VERSION = /^[\^~=]?v?(\d+)\.(\d+)\.(\d+)$/;
|
|
27
|
+
const formatVersion = ([major, minor, patch]) => `${major}.${minor}.${patch}`;
|
|
28
|
+
const sameVersion = (a, b) => a[0] === b[0] && a[1] === b[1] && a[2] === b[2];
|
|
29
|
+
/** The first release a module declaring `floor` must not be handed. */
|
|
30
|
+
function rangeCeiling(floor, role) {
|
|
31
|
+
const [major, minor] = floor;
|
|
32
|
+
if (major > 0) return [
|
|
33
|
+
major + 1,
|
|
34
|
+
0,
|
|
35
|
+
0
|
|
36
|
+
];
|
|
37
|
+
return role === "implementer" ? [
|
|
38
|
+
0,
|
|
39
|
+
minor + 1,
|
|
40
|
+
0
|
|
41
|
+
] : [
|
|
42
|
+
1,
|
|
43
|
+
0,
|
|
44
|
+
0
|
|
45
|
+
];
|
|
46
|
+
}
|
|
47
|
+
function expectedRange(floor, role) {
|
|
48
|
+
return `>=${formatVersion(floor)} <${formatVersion(rangeCeiling(floor, role))}`;
|
|
49
|
+
}
|
|
50
|
+
function toVersion(match, offset) {
|
|
51
|
+
return [
|
|
52
|
+
Number(match[offset]),
|
|
53
|
+
Number(match[offset + 1]),
|
|
54
|
+
Number(match[offset + 2])
|
|
55
|
+
];
|
|
56
|
+
}
|
|
57
|
+
/** The lowest release `spec` accepts, when it is a shape this check reads. */
|
|
58
|
+
function readFloor(spec) {
|
|
59
|
+
const bounded = BOUNDED_RANGE.exec(spec);
|
|
60
|
+
if (bounded) return toVersion(bounded, 1);
|
|
61
|
+
const single = SINGLE_VERSION.exec(spec);
|
|
62
|
+
return single ? toVersion(single, 1) : void 0;
|
|
63
|
+
}
|
|
64
|
+
function compareVersions(a, b) {
|
|
65
|
+
return a[0] - b[0] || a[1] - b[1] || a[2] - b[2];
|
|
66
|
+
}
|
|
67
|
+
/** A range is accepted when it is bounded for its role and admits the interface this package builds against. */
|
|
68
|
+
function isAcceptedRange(spec, role, local) {
|
|
69
|
+
const bounded = BOUNDED_RANGE.exec(spec);
|
|
70
|
+
if (!bounded) return false;
|
|
71
|
+
const floor = toVersion(bounded, 1);
|
|
72
|
+
const ceiling = toVersion(bounded, 4);
|
|
73
|
+
if (!sameVersion(ceiling, rangeCeiling(floor, role))) return false;
|
|
74
|
+
return local === void 0 || compareVersions(local, floor) >= 0 && compareVersions(local, ceiling) < 0;
|
|
75
|
+
}
|
|
76
|
+
function isLocalSpec(spec) {
|
|
77
|
+
return LOCAL_SPEC_PREFIXES.some((prefix) => spec.startsWith(prefix));
|
|
78
|
+
}
|
|
79
|
+
/** The version of each named package among `manifests`, the packages that sit in the same repository. */
|
|
80
|
+
function localVersions(manifests) {
|
|
81
|
+
const versions = /* @__PURE__ */ new Map();
|
|
82
|
+
for (const { name, version } of manifests) if (name && version) versions.set(name, version);
|
|
83
|
+
return versions;
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* `localVersions` holds the versions of the packages that sit in the same
|
|
87
|
+
* repository. An implemented interface is usually one of them, and its
|
|
88
|
+
* version, rather than the declared floor, decides the minor to stop below.
|
|
89
|
+
*/
|
|
90
|
+
function checkInterfaceRanges(manifest, localVersions = /* @__PURE__ */ new Map()) {
|
|
91
|
+
const implemented = new Set(manifest.antelopeJs?.implements ?? []);
|
|
92
|
+
const violations = [];
|
|
93
|
+
for (const field of CHECKED_FIELDS) for (const [name, spec] of Object.entries(manifest[field] ?? {})) {
|
|
94
|
+
if (!name.startsWith(INTERFACE_PACKAGE_PREFIX) || isLocalSpec(spec)) continue;
|
|
95
|
+
const role = implemented.has(name) ? "implementer" : "consumer";
|
|
96
|
+
const localVersion = localVersions.get(name);
|
|
97
|
+
const local = role === "implementer" && localVersion !== void 0 ? readFloor(localVersion) : void 0;
|
|
98
|
+
if (isAcceptedRange(spec, role, local)) continue;
|
|
99
|
+
const floor = local ?? readFloor(spec);
|
|
100
|
+
violations.push({
|
|
101
|
+
field,
|
|
102
|
+
name,
|
|
103
|
+
spec,
|
|
104
|
+
role,
|
|
105
|
+
expected: floor ? expectedRange(floor, role) : void 0
|
|
106
|
+
});
|
|
107
|
+
}
|
|
108
|
+
return violations;
|
|
109
|
+
}
|
|
110
|
+
function describeViolation(violation) {
|
|
111
|
+
const { field, name, spec, role, expected } = violation;
|
|
112
|
+
const fix = expected ? `use "${expected}"` : role === "implementer" ? "declare it as >=<floor> <next minor>" : "declare it as >=<floor> <1.0.0";
|
|
113
|
+
return `${field}["${name}"] is "${spec}": ${role === "implementer" ? "this package implements it, so it must stop below the next minor" : "it must accept every release up to the next breaking one"}; ${fix}`;
|
|
114
|
+
}
|
|
115
|
+
//#endregion
|
|
116
|
+
export { describeViolation as n, localVersions as r, checkInterfaceRanges as t };
|
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-Dg188oRC.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";
|
|
@@ -41,39 +41,39 @@ function execCommand(manager) {
|
|
|
41
41
|
if (manager === "bun") return "bun x --no-install";
|
|
42
42
|
return `${manager} exec`;
|
|
43
43
|
}
|
|
44
|
-
|
|
44
|
+
/** The directory of the installed `@antelopejs/tooling-configs` package, from source or from `dist`. */
|
|
45
|
+
function toolingRoot() {
|
|
45
46
|
let directory = dirname(fileURLToPath(import.meta.url));
|
|
46
47
|
while (true) {
|
|
47
48
|
const path = join(directory, "package.json");
|
|
48
|
-
if (existsSync(path))
|
|
49
|
-
const manifest = parseManifest(readFileSync(path, "utf8"));
|
|
50
|
-
if (manifest.name === "@antelopejs/tooling-configs") {
|
|
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.");
|
|
58
|
-
return {
|
|
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,
|
|
68
|
-
pack: manifest.version
|
|
69
|
-
};
|
|
70
|
-
}
|
|
71
|
-
}
|
|
49
|
+
if (existsSync(path) && parseManifest(readFileSync(path, "utf8")).name === "@antelopejs/tooling-configs") return directory;
|
|
72
50
|
const parent = dirname(directory);
|
|
73
51
|
if (parent === directory) throw new Error("Cannot find tooling-configs package.json.");
|
|
74
52
|
directory = parent;
|
|
75
53
|
}
|
|
76
54
|
}
|
|
55
|
+
function toolingVersions() {
|
|
56
|
+
const manifest = parseManifest(readFileSync(join(toolingRoot(), "package.json"), "utf8"));
|
|
57
|
+
const declared = (field, name) => {
|
|
58
|
+
const range = manifest[field]?.[name];
|
|
59
|
+
if (!range) throw new Error(`tooling-configs must declare ${name} in ${field}.`);
|
|
60
|
+
return range;
|
|
61
|
+
};
|
|
62
|
+
const dev = (name) => declared("devDependencies", name);
|
|
63
|
+
if (!manifest.version) throw new Error("tooling-configs must declare its version.");
|
|
64
|
+
return {
|
|
65
|
+
lefthook: dev("lefthook"),
|
|
66
|
+
knip: dev("knip"),
|
|
67
|
+
tsgolint: dev("oxlint-tsgolint"),
|
|
68
|
+
oxlint: dev("oxlint"),
|
|
69
|
+
oxfmt: dev("oxfmt"),
|
|
70
|
+
typescript: declared("dependencies", "typescript"),
|
|
71
|
+
nodeTypes: dev("@types/node"),
|
|
72
|
+
capture: CAPTURE_PEERS.map((name) => [name, dev(name)]),
|
|
73
|
+
packageManager: packageManager$1,
|
|
74
|
+
pack: manifest.version
|
|
75
|
+
};
|
|
76
|
+
}
|
|
77
77
|
function repositoryTools(manifest) {
|
|
78
78
|
return {
|
|
79
79
|
installed: {
|
|
@@ -281,4 +281,4 @@ function serializeManifest(manifest, current) {
|
|
|
281
281
|
return `${JSON.stringify(manifest, null, indent).replaceAll("\n", newline)}${newline}`;
|
|
282
282
|
}
|
|
283
283
|
//#endregion
|
|
284
|
-
export { managedPackage as a, repositoryTools as c,
|
|
284
|
+
export { managedPackage as a, repositoryTools as c, toolingRoot as d, toolingVersions as f, execCommand as i, serializeManifest as l, usesNuxt as m, bootstrapDependencies as n, packageManager as o, usesCaptures as p, bootstrappedManifest as r, parseManifest as s, addedDevDependencies as t, templatePackage as u };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { s as parseManifest } from "./package-
|
|
1
|
+
import { s as parseManifest } from "./package-DnxZ2CXZ.mjs";
|
|
2
2
|
import { l as resolveRevision, u as trackedManifests } from "./files-DJ0TeaTU.mjs";
|
|
3
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";
|
|
@@ -1,6 +1,6 @@
|
|
|
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 { f as toolingVersions } from "./package-DnxZ2CXZ.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
6
|
import "./suppression-budget-DgYdu6JK.mjs";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { s as parseManifest } from "./package-
|
|
1
|
+
import { s as parseManifest } from "./package-DnxZ2CXZ.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";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@antelopejs/tooling-configs",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.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",
|
|
@@ -31,12 +31,14 @@
|
|
|
31
31
|
"antelopejs-garden": "./dist/bin/garden.mjs",
|
|
32
32
|
"antelopejs-lease": "./dist/bin/lease.mjs",
|
|
33
33
|
"antelopejs-ratchet": "./dist/bin/ratchet.mjs",
|
|
34
|
+
"antelopejs-readme-strip": "./dist/bin/readme-strip.mjs",
|
|
34
35
|
"antelopejs-suppressions": "./dist/bin/suppressions.mjs",
|
|
35
36
|
"antelopejs-sync": "./dist/bin/sync.mjs",
|
|
36
37
|
"antelopejs-triage": "./dist/bin/triage.mjs",
|
|
37
38
|
"antelopejs-verify": "./dist/bin/verify.mjs"
|
|
38
39
|
},
|
|
39
40
|
"files": [
|
|
41
|
+
"assets",
|
|
40
42
|
"dist"
|
|
41
43
|
],
|
|
42
44
|
"type": "module",
|