Documentation
¶
Overview ¶
Package nodepm detects which Node package manager governs a repo (pnpm, yarn, npm) from its lockfile. Every TS gate uses this to run project-local binaries via the pm's exec command instead of relying on global PATH.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func HasLocalBin ¶
HasLocalBin returns true when `node_modules/.bin/<tool>` exists at root. Every TS gate calls this before invoking the package manager: if the project-local binary isn't there, the gate emits a visible SKIP instead of trying to shell out and failing on cryptic pm errors.
Types ¶
type Manager ¶
type Manager struct {
Name Name
Binary string // the pm binary to invoke ("pnpm", "npm", "yarn")
Exec []string // args that prefix the tool name (e.g. ["exec"] for pnpm)
Run []string // args that prefix a package.json script name
}
Manager describes how to run a repo-local binary via a specific pm.
func Detect ¶
Detect walks the lockfile hierarchy at `root` and returns the pm. When no lockfile is present it defaults to npm — npx still resolves project-local bins, so this is the least-surprising fallback.
func (Manager) ExecArgs ¶
ExecArgs returns the full argv to run a local binary with args.
m := nodepm.Detect(root); cmd := exec.Command(m.Binary, m.ExecArgs("tsc", "--noEmit")...)
func (Manager) RunScriptArgs ¶
RunScriptArgs returns the argv to run a package.json script.
m := nodepm.Detect(root); cmd := exec.Command(m.Binary, m.RunScriptArgs("build")...)