1 | const taskify = require('../cli-task');
|
2 | const runPackage = require('../run-package');
|
3 |
|
4 | function exec(packages = [], command, args = []) {
|
5 | return packages.map(pkg => {
|
6 | const apply = () => runPackage(command, args, pkg.location);
|
7 | return { pkg, apply };
|
8 | });
|
9 | }
|
10 |
|
11 | exports.task = exec;
|
12 |
|
13 | exports.register = program => {
|
14 | program
|
15 | .command('exec <path> [args...]')
|
16 | .description('Runs an arbitrary command in the scope of each package')
|
17 | .action(taskify(exec));
|
18 | };
|