mirror of
https://github.com/pnpm/pnpm.git
synced 2026-03-31 21:42:15 -04:00
Add n/prefer-node-protocol rule and autofix all bare builtin imports to use the node: prefix. Simplify the simple-import-sort builtins pattern to just ^node: since all imports now use the prefix.
19 lines
592 B
TypeScript
19 lines
592 B
TypeScript
import path from 'node:path'
|
|
|
|
import { sync as execSync } from 'execa'
|
|
|
|
export function runPnpmCli (command: string[], { cwd }: { cwd: string }): void {
|
|
const execOpts = {
|
|
cwd,
|
|
stdio: 'inherit' as const,
|
|
}
|
|
const execFileName = path.basename(process.execPath).toLowerCase()
|
|
if (execFileName === 'pnpm' || execFileName === 'pnpm.exe') {
|
|
execSync(process.execPath, command, execOpts)
|
|
} else if (path.basename(process.argv[1]) === 'pnpm.mjs') {
|
|
execSync(process.execPath, [process.argv[1], ...command], execOpts)
|
|
} else {
|
|
execSync('pnpm', command, execOpts)
|
|
}
|
|
}
|