1 | #! /usr/bin/env node
|
2 |
|
3 | const program = require('commander');
|
4 |
|
5 | const compile = require('../lib/compile');
|
6 |
|
7 | program
|
8 | .command('compile')
|
9 | .option('-t --task <task>')
|
10 | .option('-i, --input <input>')
|
11 | .option('-o, --output <output>')
|
12 | .action((opts) => {
|
13 | let { output } = opts;
|
14 | const { task = 'es', input = 'src' } = opts;
|
15 | const taskReg = new RegExp('dist');
|
16 | if (taskReg.test(task)) {
|
17 | output = output || 'dist';
|
18 | } else if (task === 'es') {
|
19 | output = 'es';
|
20 | } else {
|
21 | output = 'lib';
|
22 | }
|
23 |
|
24 | compile(task, input, output);
|
25 |
|
26 | });
|
27 |
|
28 | program.parse(process.argv); |
\ | No newline at end of file |