UNPKG

465 BJavaScriptView Raw
1const taskify = require('../cli-task');
2const runPackage = require('../run-package');
3
4function exec(packages = [], command, args = []) {
5 return packages.map(pkg => {
6 const apply = () => runPackage(command, args, pkg.location);
7 return { pkg, apply };
8 });
9}
10
11exports.task = exec;
12
13exports.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};