* `process.argv[1]` points at the CLI entry script but on global installs the * entry is usually a shim in a `bin/` dir that symlinks to the real install * under `lib/node_modules/`. Resolve through the symlink so the classifier * sees the canonical install prefix.
()
| 26 | * sees the canonical install prefix. |
| 27 | */ |
| 28 | function resolveEntry(): string | null { |
| 29 | const entry = process.argv[1]; |
| 30 | if (!entry) return null; |
| 31 | try { |
| 32 | return realpathSync(entry); |
| 33 | } catch { |
| 34 | return entry; |
| 35 | } |
| 36 | } |
| 37 | |
| 38 | function normalizePath(path: string): string { |
| 39 | return path.replaceAll("\\", "/"); |