@avi2dg/checks 0.1.0 → 0.2.0

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 CHANGED
@@ -50,7 +50,7 @@ cp node_modules/@avi2dg/checks/bunfig.toml bunfig.toml
50
50
  `package.json` gains three scripts:
51
51
 
52
52
  ```json
53
- "lint": "oxlint --type-aware && ./node_modules/@avi2dg/checks/scripts/lint-coverage.sh && bun ./node_modules/@avi2dg/checks/scripts/test-layout.ts && bun ./node_modules/@avi2dg/checks/scripts/commit-identity.ts HEAD",
53
+ "lint": "oxlint --type-aware && checks-lint-coverage && checks-test-layout && checks-commit-identity HEAD",
54
54
  "typecheck": "tsc --noEmit && effect-tsgo diagnostics --project tsconfig.json --format text --strict",
55
55
  "test": "bun test --randomize"
56
56
  ```
@@ -69,9 +69,8 @@ The registry version is pinned by the consumer's lockfile; bump
69
69
 
70
70
  ## Test layout
71
71
 
72
- `bun ./node_modules/@avi2dg/checks/scripts/test-layout.ts` fails unless the
73
- repo holds this shape, and names the file and the path to move it to when
74
- it does not:
72
+ `checks-test-layout` fails unless the repo holds this shape, and names the
73
+ file and the path to move it to when it does not:
75
74
 
76
75
  - Every test file is `tests/**/*.test.ts` or `.tsx`. A `*.test.ts`, `*.spec.ts` or
77
76
  `*_test.ts` under `src/`, `test/`, `__tests__/` or the repo root fails.
@@ -192,8 +191,8 @@ commit-identity check below is the enforcement.
192
191
  one carries an identity other than the repository owner's:
193
192
 
194
193
  ```sh
195
- bun ./node_modules/@avi2dg/checks/scripts/commit-identity.ts <base-ref> <head-ref>
196
- bun ./node_modules/@avi2dg/checks/scripts/commit-identity.ts <ref>
194
+ bun run checks-commit-identity <base-ref> <head-ref>
195
+ bun run checks-commit-identity <ref>
197
196
  ```
198
197
 
199
198
  With one argument it checks that commit alone, which is the form the
@@ -235,8 +234,8 @@ leaves stale once the base branch advances after the pull request opens.
235
234
  when an added line carries a banned comment:
236
235
 
237
236
  ```sh
238
- bun ./node_modules/@avi2dg/checks/scripts/comment-gate.ts <base-ref> <head-ref>
239
- bun ./node_modules/@avi2dg/checks/scripts/comment-gate.ts <ref>
237
+ bun run checks-comment-gate <base-ref> <head-ref>
238
+ bun run checks-comment-gate <ref>
240
239
  ```
241
240
 
242
241
  With two arguments it diffs the base against the head. With one it diffs
@@ -268,7 +267,7 @@ jobs:
268
267
  at each recent commit, so a repository can measure its own history:
269
268
 
270
269
  ```sh
271
- bun ./node_modules/@avi2dg/checks/scripts/backtest.ts [commit-count]
270
+ bun run checks-backtest [commit-count]
272
271
  ```
273
272
 
274
273
  It walks the last `commit-count` first-parent commits, 60 by default,
@@ -308,9 +307,12 @@ of reach, so the figures are authored code.
308
307
  consumer's copy is compared key by key against the installed one
309
308
  instead. `[test] pathIgnorePatterns` is a real bunfig key, and an empty
310
309
  `--path-ignore-patterns` flag overrides the file's own list.
311
- - The layout check ships as `.ts` and is invoked with `bun`, which needs
312
- no build step and no `dist/` entry, unlike the oxlint plugin that node
313
- loads.
310
+ - Each runnable script ships a `checks-` bin entry, so consumer
311
+ `package.json` scripts call the short name, which the package manager
312
+ puts on `PATH` only there; a shell runs it through `bun run`, which
313
+ never falls back to the registry the way `bunx` does. The `.ts` checks
314
+ keep a `bun` shebang, which needs no build step and no `dist/`
315
+ entry, unlike the oxlint plugin that node loads.
314
316
  - `bun` counts as a built-in module. Nothing installed resolves it except
315
317
  `@types/bun`, which would otherwise make every runtime `bun` import look
316
318
  like a dev-only dependency.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@avi2dg/checks",
3
- "version": "0.1.0",
3
+ "version": "0.2.0",
4
4
  "description": "Deterministic checks shared across the captain's TypeScript repos",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -39,6 +39,13 @@
39
39
  "./tsconfig.effect.json": "./tsconfig.effect.json",
40
40
  "./dist/index.js": "./dist/index.js"
41
41
  },
42
+ "bin": {
43
+ "checks-lint-coverage": "scripts/lint-coverage.sh",
44
+ "checks-test-layout": "scripts/test-layout.ts",
45
+ "checks-commit-identity": "scripts/commit-identity.ts",
46
+ "checks-comment-gate": "scripts/comment-gate.ts",
47
+ "checks-backtest": "scripts/backtest.ts"
48
+ },
42
49
  "scripts": {
43
50
  "build": "bun build effect-channel/index.ts --outdir dist --target node --format esm",
44
51
  "lint": "oxlint --type-aware && ./scripts/lint-coverage.sh && bun scripts/test-layout.ts && bun scripts/commit-identity.ts HEAD && bun scripts/comment-gate.ts HEAD && depcruise --config .dependency-cruiser.cjs effect-channel scripts tests commitlint.config.js dependency-cruiser.config.js .dependency-cruiser.cjs",
File without changes
File without changes
@@ -40,6 +40,7 @@ const BANNED_GLOBAL_CALLS: readonly string[] = ["fetch"];
40
40
 
41
41
  export const REQUIRED_TEST_SCRIPT = "bun test --randomize";
42
42
  export const LAYOUT_CHECK_MARK = "scripts/test-layout.ts";
43
+ export const LAYOUT_CHECK_BIN = "checks-test-layout";
43
44
 
44
45
  function isRecord(value: unknown): value is Record<string, unknown> {
45
46
  return typeof value === "object" && value !== null;
@@ -215,11 +216,11 @@ export function scriptViolations(manifest: unknown): readonly Violation[] {
215
216
  message: `scripts.test must be exactly "${REQUIRED_TEST_SCRIPT}", found ${JSON.stringify(test ?? null)}`,
216
217
  });
217
218
  }
218
- if (typeof lint !== "string" || !lint.includes(LAYOUT_CHECK_MARK)) {
219
+ if (typeof lint !== "string" || (!lint.includes(LAYOUT_CHECK_MARK) && !lint.includes(LAYOUT_CHECK_BIN))) {
219
220
  violations.push({
220
221
  file,
221
222
  line: undefined,
222
- message: `scripts.lint must run the layout check: add "bun ./node_modules/@avi2dg/checks/${LAYOUT_CHECK_MARK}"`,
223
+ message: `scripts.lint must run the layout check: add "${LAYOUT_CHECK_BIN}"`,
223
224
  });
224
225
  }
225
226
  return violations;