1 | #!/usr/bin/env node
|
2 |
|
3 | const path = require('path');
|
4 | const program = require('commander');
|
5 | const pkg = require(path.join(__dirname, '../../package.json'));
|
6 |
|
7 | program
|
8 | .option(
|
9 | '-F, --filter <expression>',
|
10 | 'Filter where the task should be run'
|
11 | )
|
12 | .option(
|
13 | '-C, --concurrency <number>',
|
14 | 'Number of tasks to be run concurrently',
|
15 | (arg) => /^\d+$/.test(arg) ? parseInt(arg, 10) : 1,
|
16 | 1
|
17 | )
|
18 | .option(
|
19 | '-P, --preserve-order',
|
20 | 'Preserve topological sort order when running tasks concurrently'
|
21 | )
|
22 | .option(
|
23 | '-R, --reverse',
|
24 | 'Reverse package running order'
|
25 | )
|
26 | .version(pkg.version)
|
27 |
|
28 | const tasks = [
|
29 | 'exec',
|
30 | 'run',
|
31 | 'script',
|
32 | 'version',
|
33 | 'publish'
|
34 | ];
|
35 |
|
36 | tasks.forEach((task) => {
|
37 | const module = require(path.join('../tasks/', task));
|
38 | module.register(program);
|
39 | });
|
40 |
|
41 | const argv = program.parse(process.argv);
|
42 |
|
43 | if (argv.args.length === 0) {
|
44 | program.help();
|
45 | }
|