@zgeoff/chex 0.3.15 → 0.3.16

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.15",
3
+ "version": "0.3.16",
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",
@@ -1,8 +1,9 @@
1
- import { existsSync, lstatSync } from 'node:fs';
1
+ import { lstatSync } from 'node:fs';
2
2
  import { dirname, join, relative, sep } from 'node:path';
3
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.
4
+ // Returns a probe for a file under the repo root. A path reads as absent when a folder below the root
5
+ // is a link (git tracks no file beyond a link) or when it is a folder itself (a deleted path comes
6
+ // back only as a file or a link). Neither is a restored copy.
6
7
  export function makeFileProbe(root: string): (path: string) => boolean {
7
8
  return (path) => {
8
9
  const folders = relative(root, dirname(path))
@@ -16,6 +17,12 @@ export function makeFileProbe(root: string): (path: string) => boolean {
16
17
  })?.isSymbolicLink() === true,
17
18
  );
18
19
 
19
- return !linked && existsSync(path);
20
+ if (linked) {
21
+ return false;
22
+ }
23
+
24
+ const entry = lstatSync(path, { throwIfNoEntry: false });
25
+
26
+ return entry !== undefined && !entry.isDirectory();
20
27
  };
21
28
  }