-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
36 lines (28 loc) · 955 Bytes
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#!/usr/bin/env node
const program = require('commander');
const Bundler = require('./bundler');
function list(val) {
return val.split(',');
}
program
.version('0.0.1')
.usage('<file> [options]')
.option('-o, --output <file>', 'output file')
.option('-v, --verbose', 'enable verbose')
.option('-b, --beautify', 'beautify output')
.option('-i, --ignore <files> example: bundle index.js -i file1.js,lib/file2.js', 'ignore files', list)
.option('-j, --ignoreJSON', 'ignore json files')
.option('-z, --zip', 'output zip file with bundle, required files and package.json')
program.parse(process.argv);
if (program.args.length === 0) program.help()
const b = new Bundler({
inputFile: program.args[0],
outputFile: program.output,
verbose: program.verbose,
beautify: program.beautify,
ignoreFiles: program.ignore,
disableJSON: program.ignoreJSON,
zip: program.zip
});
b.saveFile();
process.exit(0)