(cmd, showOutput = false)
| 344 | }; |
| 345 | |
| 346 | const execute = async (cmd, showOutput = false) => { |
| 347 | const {spawn} = await import('child_process'); |
| 348 | return new Promise((resolve, reject) => { |
| 349 | const [command, ...args] = cmd.split(' '); |
| 350 | const child = spawn(command, args, showOutput ? {stdio: 'inherit'} : {}); |
| 351 | let output = ''; |
| 352 | if (!showOutput) { |
| 353 | child.stdout.on('data', (data) => (output += data.toString())); |
| 354 | child.stderr.on('data', (data) => (output += data.toString())); |
| 355 | } |
| 356 | child.on('close', (code) => { |
| 357 | if (code === 0) { |
| 358 | resolve(); |
| 359 | } else { |
| 360 | // eslint-disable-next-line no-console |
| 361 | console.error(`Command failed with code ${code}: ${cmd}\n${output}`); |
| 362 | reject(); |
| 363 | } |
| 364 | }); |
| 365 | }); |
| 366 | }; |
| 367 | |
| 368 | const lintCheckFiles = async (dir) => { |
| 369 | const {default: prettier} = await import('prettier'); |
no outgoing calls
no test coverage detected
searching dependent graphs…