UNPKG

867 BPlain TextView Raw
1#!/usr/bin/env node
2
3const path = require('path');
4const program = require('commander');
5const pkg = require(path.join(__dirname, '../../package.json'));
6
7program
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
28const tasks = [
29 'exec',
30 'run',
31 'script',
32 'version',
33 'publish'
34];
35
36tasks.forEach((task) => {
37 const module = require(path.join('../tasks/', task));
38 module.register(program);
39});
40
41const argv = program.parse(process.argv);
42
43if (argv.args.length === 0) {
44 program.help();
45}