mirror of
https://github.com/xodio/xod.git
synced 2026-03-13 04:06:53 +01:00
40 lines
1.0 KiB
JavaScript
Executable File
40 lines
1.0 KiB
JavaScript
Executable File
#!/usr/bin/env node
|
|
/*
|
|
* CLI tool to run Yarn commands on packages taking their
|
|
* dependency graph into account. Usage example:
|
|
*
|
|
* $ ./tools/lerna-run-sorted --tree build xod-client-browser
|
|
*
|
|
* Run `./tools/lerna-run-sorted --help` for details
|
|
*/
|
|
const path = require('path');
|
|
const program = require('commander');
|
|
const SortedRunCommand = require('./lerna-ext/SortedRunCommand');
|
|
|
|
program
|
|
.version('0.0.0')
|
|
.arguments('<yarn-command> [package]')
|
|
.option('--only', 'Do not run command on dependencies, just run it on package')
|
|
.action((cmd, pkg) => {
|
|
const flags = {
|
|
scope: pkg,
|
|
withDeps: !program.only,
|
|
};
|
|
|
|
const lernaCommand = new SortedRunCommand([cmd], flags);
|
|
|
|
// extend path with root-level node_modules to access build tools
|
|
// binaries
|
|
process.env['PATH'] = path.resolve(__dirname, '..', 'node_modules', '.bin') +
|
|
':' + process.env['PATH'];
|
|
|
|
lernaCommand.run();
|
|
});
|
|
|
|
program.parse(process.argv);
|
|
if (program.args.length === 0) {
|
|
console.log(program.help());
|
|
}
|
|
|
|
// vim:ft=javascript
|