@casomoltd/tooling 0.23.3 → 0.23.5

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.
@@ -19,8 +19,9 @@
19
19
  //
20
20
  // Declared exceptions are printed on every run: excusing a gap must not be the
21
21
  // same thing as hiding it.
22
- import {readFileSync} from "node:fs";
22
+ import {readFileSync, realpathSync} from "node:fs";
23
23
  import {join} from "node:path";
24
+ import {pathToFileURL} from "node:url";
24
25
 
25
26
  /** Gates every repo must define and run, absent a declared exception. */
26
27
  export const REQUIRED = [
@@ -129,4 +130,16 @@ const main = () => {
129
130
  );
130
131
  };
131
132
 
132
- if (import.meta.url === `file://${process.argv[1]}`) main();
133
+ /** True only when this file is the entry point. npm installs a bin as a symlink,
134
+ * so `process.argv[1]` is the link while `import.meta.url` is the target it
135
+ * resolves to — comparing them raw silently skips `main`, and the gate then
136
+ * "passes" in every consumer without ever running. Resolve before comparing. */
137
+ const isEntryPoint = () => {
138
+ try {
139
+ return import.meta.url === pathToFileURL(realpathSync(process.argv[1])).href;
140
+ } catch {
141
+ return false;
142
+ }
143
+ };
144
+
145
+ if (isEntryPoint()) main();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@casomoltd/tooling",
3
- "version": "0.23.3",
3
+ "version": "0.23.5",
4
4
  "description": "Casomo's shared dev config: ESLint, Prettier, commitlint, knip & jscpd presets and dev CLIs (git hooks, readability, screenshots)",
5
5
  "license": "MIT",
6
6
  "repository": {