@nodeve/checks 1.9.0 → 2.0.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 +1 -1
- package/dist/bin/format.d.ts +3 -0
- package/dist/bin/format.d.ts.map +1 -0
- package/dist/bin/{format-markdown.js → format.js} +10 -6
- package/dist/bin/format.js.map +1 -0
- package/lefthook.checks.yml +12 -6
- package/package.json +3 -3
- package/dist/bin/format-markdown.d.ts +0 -3
- package/dist/bin/format-markdown.d.ts.map +0 -1
- package/dist/bin/format-markdown.js.map +0 -1
package/README.md
CHANGED
|
@@ -106,7 +106,7 @@ All blocking checks accept `--warn` (report-only, exit 0) and `--explain` (expan
|
|
|
106
106
|
|
|
107
107
|
Unlike the gates above, fixers mutate staged files and let lefthook re-stage them (`stage_fixed: true`). They run before the `checks` group so the gates see the fixed content.
|
|
108
108
|
|
|
109
|
-
- `nodeve-format
|
|
109
|
+
- `nodeve-format` — prettier-formats staged docs, code, and config in place, so they land formatted without a manual `prettier --write`. Bundles its own prettier (nothing needed on PATH, portable across pnpm and bun) yet honors the repo's prettier config, `.prettierignore`, and plugins, which prettier resolves per file. Skips symlinks (e.g. `CLAUDE.md` → `README.md`), which prettier can't format and which get formatted via their real target's own staged entry. Exclude machine output and vendored code with `.prettierignore` — the lefthook glob stays wide.
|
|
110
110
|
|
|
111
111
|
### Running ad hoc
|
|
112
112
|
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"format.d.ts","sourceRoot":"","sources":["../../src/bin/format.ts"],"names":[],"mappings":""}
|
|
@@ -1,9 +1,13 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
/**
|
|
3
|
-
* Commit fixer: prettier-format staged
|
|
3
|
+
* Commit fixer: prettier-format staged files in place, so they land formatted
|
|
4
4
|
* without a manual `prettier --write`. Wired in the shared lefthook config with
|
|
5
5
|
* `stage_fixed: true`, which re-stages whatever this touches.
|
|
6
6
|
*
|
|
7
|
+
* Scope is the lefthook glob's call, not this bin's — it formats whatever paths
|
|
8
|
+
* it's handed. The glob must only name types prettier has a parser for: given a
|
|
9
|
+
* path it can't infer a parser for, prettier errors rather than skipping.
|
|
10
|
+
*
|
|
7
11
|
* WHY a bin instead of `bunx prettier --write` in the hook: the rest of the
|
|
8
12
|
* shared config shells `node_modules/.bin/nodeve-*` so it's portable across pnpm
|
|
9
13
|
* and bun and needs nothing on PATH. `bunx` needs Bun, and under pnpm's strict
|
|
@@ -14,14 +18,14 @@
|
|
|
14
18
|
* The bundled prettier still honors the consumer's `.prettierrc`/`.prettierignore`
|
|
15
19
|
* and plugins: prettier resolves both relative to each file, not to this bin.
|
|
16
20
|
*
|
|
17
|
-
* Skips
|
|
21
|
+
* Skips symlinks (e.g. CLAUDE.md → README.md): prettier errors on a symlink
|
|
18
22
|
* path, and the real target is formatted via its own staged entry anyway.
|
|
19
23
|
*/
|
|
20
24
|
import { spawnSync } from 'node:child_process';
|
|
21
25
|
import { createRequire } from 'node:module';
|
|
22
26
|
import { lstatSync } from 'node:fs';
|
|
23
27
|
const argPaths = process.argv.slice(2).filter((a) => !a.startsWith('--'));
|
|
24
|
-
const
|
|
28
|
+
const files = argPaths.filter((p) => {
|
|
25
29
|
try {
|
|
26
30
|
return !lstatSync(p).isSymbolicLink();
|
|
27
31
|
}
|
|
@@ -30,9 +34,9 @@ const mdFiles = argPaths.filter((p) => {
|
|
|
30
34
|
return false;
|
|
31
35
|
}
|
|
32
36
|
});
|
|
33
|
-
if (
|
|
37
|
+
if (files.length === 0)
|
|
34
38
|
process.exit(0);
|
|
35
39
|
const prettierCli = createRequire(import.meta.url).resolve('prettier/bin/prettier.cjs');
|
|
36
|
-
const res = spawnSync(process.execPath, [prettierCli, '--write', ...
|
|
40
|
+
const res = spawnSync(process.execPath, [prettierCli, '--write', ...files], { stdio: 'inherit' });
|
|
37
41
|
process.exit(res.status ?? 1);
|
|
38
|
-
//# sourceMappingURL=format
|
|
42
|
+
//# sourceMappingURL=format.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"format.js","sourceRoot":"","sources":["../../src/bin/format.ts"],"names":[],"mappings":";AACA;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAC/C,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAEpC,MAAM,QAAQ,GAAG,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC,CAAC;AAE1E,MAAM,KAAK,GAAG,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE;IACnC,IAAI,CAAC;QACJ,OAAO,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,cAAc,EAAE,CAAC;IACvC,CAAC;IAAC,MAAM,CAAC;QACR,wEAAwE;QACxE,OAAO,KAAK,CAAC;IACd,CAAC;AACF,CAAC,CAAC,CAAC;AAEH,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC;IAAE,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAExC,MAAM,WAAW,GAAG,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,OAAO,CAAC,2BAA2B,CAAC,CAAC;AACxF,MAAM,GAAG,GAAG,SAAS,CAAC,OAAO,CAAC,QAAQ,EAAE,CAAC,WAAW,EAAE,SAAS,EAAE,GAAG,KAAK,CAAC,EAAE,EAAE,KAAK,EAAE,SAAS,EAAE,CAAC,CAAC;AAElG,OAAO,CAAC,IAAI,CAAC,GAAG,CAAC,MAAM,IAAI,CAAC,CAAC,CAAC"}
|
package/lefthook.checks.yml
CHANGED
|
@@ -33,14 +33,20 @@
|
|
|
33
33
|
pre-commit:
|
|
34
34
|
jobs:
|
|
35
35
|
# Fixer, runs before the `checks` group so the gates see formatted, re-staged
|
|
36
|
-
# content. Prettier-formats staged
|
|
36
|
+
# content. Prettier-formats staged files in place; `stage_fixed` re-adds
|
|
37
37
|
# whatever it touched. The bin bundles its own prettier (portable across pnpm
|
|
38
38
|
# and bun, needs nothing on PATH) and honors the repo's prettier config and
|
|
39
|
-
# `.prettierignore`. It skips
|
|
40
|
-
#
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
39
|
+
# `.prettierignore`. It skips symlinks itself, so no `file_types` filter is
|
|
40
|
+
# needed here.
|
|
41
|
+
#
|
|
42
|
+
# The glob covers code as well as docs: `eslint-config-prettier` turns OFF every
|
|
43
|
+
# stylistic eslint rule, so with markdown-only formatting nothing in the gate
|
|
44
|
+
# judged code formatting at all. It must only name types prettier has a parser
|
|
45
|
+
# for — prettier errors on a path it can't infer one for. Repos exclude paths
|
|
46
|
+
# via `.prettierignore` (machine output, vendored code), not by narrowing this.
|
|
47
|
+
- name: format
|
|
48
|
+
glob: '*.{md,ts,tsx,js,jsx,mjs,cjs,mts,cts,svelte,json,jsonc,css,html,yml,yaml}'
|
|
49
|
+
run: node_modules/.bin/nodeve-format {staged_files}
|
|
44
50
|
stage_fixed: true
|
|
45
51
|
|
|
46
52
|
- name: checks
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nodeve/checks",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.0.0",
|
|
4
4
|
"description": "Org-wide commit-gate checks (doc budgets, reshape/dup/helper smells, page size) and helper-index generators, driven by a per-repo config file and wired through lefthook.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -42,7 +42,7 @@
|
|
|
42
42
|
"nodeve-check-catalog": "./dist/bin/catalog.js",
|
|
43
43
|
"nodeve-check-require-deps": "./dist/bin/require-deps.js",
|
|
44
44
|
"nodeve-check-require-eslint": "./dist/bin/require-eslint.js",
|
|
45
|
-
"nodeve-format
|
|
45
|
+
"nodeve-format": "./dist/bin/format.js",
|
|
46
46
|
"nodeve-build-lib-names": "./dist/bin/build-lib-names.js",
|
|
47
47
|
"nodeve-build-helper-manifest": "./dist/bin/build-helper-manifest.js"
|
|
48
48
|
},
|
|
@@ -61,7 +61,7 @@
|
|
|
61
61
|
"devDependencies": {
|
|
62
62
|
"@types/node": "^24.0.0",
|
|
63
63
|
"@types/pluralize": "^0.0.33",
|
|
64
|
-
"@nodeve/config": "0.
|
|
64
|
+
"@nodeve/config": "0.5.0"
|
|
65
65
|
},
|
|
66
66
|
"scripts": {
|
|
67
67
|
"build": "tsc -p tsconfig.json && cp dist/lib/defaults.js nodeve.checks.defaults.js",
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"format-markdown.d.ts","sourceRoot":"","sources":["../../src/bin/format-markdown.ts"],"names":[],"mappings":""}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"format-markdown.js","sourceRoot":"","sources":["../../src/bin/format-markdown.ts"],"names":[],"mappings":";AACA;;;;;;;;;;;;;;;;;GAiBG;AACH,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAC/C,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAEpC,MAAM,QAAQ,GAAG,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC,CAAC;AAE1E,MAAM,OAAO,GAAG,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE;IACrC,IAAI,CAAC;QACJ,OAAO,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,cAAc,EAAE,CAAC;IACvC,CAAC;IAAC,MAAM,CAAC;QACR,wEAAwE;QACxE,OAAO,KAAK,CAAC;IACd,CAAC;AACF,CAAC,CAAC,CAAC;AAEH,IAAI,OAAO,CAAC,MAAM,KAAK,CAAC;IAAE,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAE1C,MAAM,WAAW,GAAG,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,OAAO,CAAC,2BAA2B,CAAC,CAAC;AACxF,MAAM,GAAG,GAAG,SAAS,CAAC,OAAO,CAAC,QAAQ,EAAE,CAAC,WAAW,EAAE,SAAS,EAAE,GAAG,OAAO,CAAC,EAAE,EAAE,KAAK,EAAE,SAAS,EAAE,CAAC,CAAC;AAEpG,OAAO,CAAC,IAAI,CAAC,GAAG,CAAC,MAAM,IAAI,CAAC,CAAC,CAAC"}
|