( command: string, args: Array<string>, )
| 114 | } |
| 115 | |
| 116 | function parseExecuteCommand( |
| 117 | command: string, |
| 118 | args: Array<string>, |
| 119 | ): { pkg: string; args: Array<string> } | null { |
| 120 | if (command === 'npx') { |
| 121 | const filtered = args[0] === '-y' ? args.slice(1) : args |
| 122 | const [pkg, ...rest] = filtered |
| 123 | return pkg ? { pkg, args: rest } : null |
| 124 | } |
| 125 | if (command === 'pnpx' || command === 'bunx') { |
| 126 | const filtered = command === 'bunx' && args[0] === '--bun' ? args.slice(1) : args |
| 127 | const [pkg, ...rest] = filtered |
| 128 | return pkg ? { pkg, args: rest } : null |
| 129 | } |
| 130 | if ((command === 'pnpm' || command === 'yarn') && args[0] === 'dlx') { |
| 131 | const [, pkg, ...rest] = args |
| 132 | return pkg ? { pkg, args: rest } : null |
| 133 | } |
| 134 | if (command === 'deno' && args[0] === 'run' && args[1]?.startsWith('npm:')) { |
| 135 | const pkg = args[1].slice(4) |
| 136 | return pkg ? { pkg, args: args.slice(2) } : null |
| 137 | } |
| 138 | return null |
| 139 | } |
| 140 | |
| 141 | export function packageManagerExecute( |
| 142 | environment: Environment, |
no outgoing calls
no test coverage detected