@zgeoff/chex 0.3.5 → 0.3.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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zgeoff/chex",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.6",
|
|
4
4
|
"description": "Run each shared docs and repo check as one subcommand, with the lefthook pre-push baseline that calls them",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"checks",
|
|
@@ -36,7 +36,7 @@
|
|
|
36
36
|
},
|
|
37
37
|
"dependencies": {
|
|
38
38
|
"@zgeoff/std": "0.4.3",
|
|
39
|
-
"oxc-parser": "0.
|
|
39
|
+
"oxc-parser": "0.158.0",
|
|
40
40
|
"ts-pattern": "5.9.2"
|
|
41
41
|
},
|
|
42
42
|
"devDependencies": {
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { existsSync, lstatSync } from 'node:fs';
|
|
2
|
+
import { dirname, join, relative, sep } from 'node:path';
|
|
3
|
+
|
|
4
|
+
// Returns a probe for a file under the repo root. A path whose folder below the root is a symbolic
|
|
5
|
+
// link reads as absent: git tracks no file beyond a link, so a deleted path there is no restored copy.
|
|
6
|
+
export function makeFileProbe(root: string): (path: string) => boolean {
|
|
7
|
+
return (path) => {
|
|
8
|
+
const folders = relative(root, dirname(path))
|
|
9
|
+
.split(sep)
|
|
10
|
+
.filter((part) => part !== '');
|
|
11
|
+
|
|
12
|
+
const linked = folders.some(
|
|
13
|
+
(_, index) =>
|
|
14
|
+
lstatSync(join(root, ...folders.slice(0, index + 1)), {
|
|
15
|
+
throwIfNoEntry: false,
|
|
16
|
+
})?.isSymbolicLink() === true,
|
|
17
|
+
);
|
|
18
|
+
|
|
19
|
+
return !linked && existsSync(path);
|
|
20
|
+
};
|
|
21
|
+
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { existsSync } from 'node:fs';
|
|
2
1
|
import { join } from 'node:path';
|
|
2
|
+
import { makeFileProbe } from './make-file-probe.ts';
|
|
3
3
|
import { readBranchFiles } from './read-branch-files.ts';
|
|
4
4
|
import type { RunProgram } from './run-program.ts';
|
|
5
5
|
import { runProgram } from './run-program.ts';
|
|
@@ -58,7 +58,7 @@ export function runUncommittedCommand(): number {
|
|
|
58
58
|
env: process.env,
|
|
59
59
|
files,
|
|
60
60
|
runProgram,
|
|
61
|
-
probeFile:
|
|
61
|
+
probeFile: makeFileProbe(cwd),
|
|
62
62
|
});
|
|
63
63
|
|
|
64
64
|
if (changed.length > 0) {
|