mirror of
https://github.com/pnpm/pnpm.git
synced 2026-06-28 01:45:30 -04:00
* fix: silence verify-deps auto-install output * fix: pass reporter to dependency status install --------- Co-authored-by: cyphercodes <cyphercodes@users.noreply.github.com>
25 lines
768 B
TypeScript
25 lines
768 B
TypeScript
import path from 'node:path'
|
|
|
|
import { sync as execSync } from 'execa'
|
|
|
|
export interface RunPnpmCliOptions {
|
|
cwd: string
|
|
reporter?: string
|
|
}
|
|
|
|
export function runPnpmCli (command: string[], { cwd, reporter }: RunPnpmCliOptions): void {
|
|
const execOpts = {
|
|
cwd,
|
|
stdio: 'inherit' as const,
|
|
}
|
|
const cliCommand = reporter ? [...command, `--reporter=${reporter}`] : command
|
|
const execFileName = path.basename(process.execPath).toLowerCase()
|
|
if (execFileName === 'pnpm' || execFileName === 'pnpm.exe') {
|
|
execSync(process.execPath, cliCommand, execOpts)
|
|
} else if (path.basename(process.argv[1]) === 'pnpm.mjs') {
|
|
execSync(process.execPath, [process.argv[1], ...cliCommand], execOpts)
|
|
} else {
|
|
execSync('pnpm', cliCommand, execOpts)
|
|
}
|
|
}
|