( cmd: string, args: string[], skipExecution?: boolean, dryRunCliFlag?: boolean, opts?: Options )
| 264 | } |
| 265 | |
| 266 | export async function run( |
| 267 | cmd: string, |
| 268 | args: string[], |
| 269 | skipExecution?: boolean, |
| 270 | dryRunCliFlag?: boolean, |
| 271 | opts?: Options |
| 272 | ) { |
| 273 | if (dryRunCliFlag) { |
| 274 | args = [...args, '--dry-run']; |
| 275 | } |
| 276 | const bash = ` ${cmd} ${args.join(' ')}`; |
| 277 | console.log(bash, opts ? JSON.stringify(opts) : ''); |
| 278 | if (!skipExecution) { |
| 279 | const result = await execa(cmd, args, opts); |
| 280 | if (result.failed) { |
| 281 | panic(`Finished with error: ${bash}`); |
| 282 | } |
| 283 | } |
| 284 | } |
| 285 | |
| 286 | export function panic(msg: string | Error) { |
| 287 | const err = typeof msg === 'string' ? new Error(msg) : msg; |
no test coverage detected