-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcli.js
More file actions
34 lines (27 loc) · 758 Bytes
/
cli.js
File metadata and controls
34 lines (27 loc) · 758 Bytes
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
#!/usr/bin/env node
const program = require('commander');
const hardcode = require('./hardcode');
const options = {};
program
.version('1.4.0')
.arguments('<glob>')
.description('<glob> = the glob pattern for matching files to build')
.action(pattern => {
options.pattern = pattern;
})
.option('-o, --out <out>', 'output folder. Default is ./build')
.option('-p, --prefix <prefix>', 'skips over a pattern prefix when building');
program.parse(process.argv);
options.out = program.out;
options.prefix = program.prefix;
hardcode(options)
.then(paths => {
console.log(`\n${paths.length} files have been hardcoded:`);
for (const path of paths) {
console.log(`\t- ${path}`);
}
console.log();
})
.catch(error => {
throw error;
});