Files
Waleed 4c20ff63ec improvement(audits): eliminate repeated parsing and scans (#7361)
* improvement(audits): eliminate repeated parsing and scans

* fix(audits): resolve local bins under vitest

* fix(audits): include drizzle subpath imports
2026-09-01 11:56:18 -07:00

21 lines
936 B
TypeScript

import path from 'node:path'
import { fileURLToPath } from 'node:url'
const ROOT = path.resolve(path.dirname(fileURLToPath(import.meta.url)), '..')
/**
* Absolute path to a locally-installed executable.
*
* Scripts spawn these instead of shelling out through `bunx`, which re-resolves the package on
* every call against the shared install cache — a network-backed sticky-disk mount on CI. That
* is cheap for a lone caller and serializes badly once the audits run concurrently: it took the
* desktop-bridge audit from 1s to 39s and made it the entire wall clock of the batch.
*
* `tsc` resolves here to the native TypeScript 7 compiler, which `check:native-typecheck`
* asserts — so this is the one path guarded against the bin-shadowing that otherwise silently
* selects the ~10x slower JavaScript compiler.
*/
export function localBin(name: string): string {
return path.join(ROOT, 'node_modules', '.bin', name)
}