1
0
mirror of https://github.com/yldio/copilot.git synced 2024-11-14 23:30:05 +02:00
copilot/scripts/parallel-run

35 lines
709 B
Plaintext
Raw Permalink Normal View History

2017-06-01 15:03:11 +03:00
#!/usr/bin/env node
const argv = require('yargs').argv;
const forEach = require('apr-for-each');
const main = require('apr-main');
2017-06-01 17:57:28 +03:00
const intercept = require('apr-intercept');
2017-06-01 15:03:11 +03:00
const execa = require('execa');
const path = require('path');
const ROOT = process.cwd();
if (!argv.cmd) {
throw new Error('Missing --cmd argument');
}
const run = () =>
2017-06-01 17:57:28 +03:00
forEach(argv._, async file => {
const cwd = path.dirname(path.join(ROOT, file));
const [err] = await intercept(
execa('yarn', ['run', argv.cmd], {
stdio: 'inherit',
cwd
})
);
if (err) {
console.error(`cmd: ${argv.cmd} | cwd: ${cwd}`);
console.error(err);
throw err;
}
});
2017-06-01 15:03:11 +03:00
main(run());