-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwatcherCli.js
More file actions
54 lines (53 loc) · 1.95 KB
/
watcherCli.js
File metadata and controls
54 lines (53 loc) · 1.95 KB
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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
#!/usr/bin/env node
const { watcher } = require('./watcher');
const argv = require('yargs')
.usage(`Usage: $0 <command> [options]`)
// .command('-w -p ./src/** -o ./dist', 'Watches ./src/** and outputs to ./dist')
// .command('-p ./src/** -o ./dist', 'Runs script once for ./src/** and outputs to ./dist')
// .command('-c ./watcher.config.js', 'Imports configuration file and can use custom processors')
// .command('-j ./watcher.config.json', 'Imports json configuration file and will use default processors [html, js, css]')
// .example('$0 -w -o ./dist -p ./src/**', 'Watches ./src dir and creates output in ./dist')
// .example('$0 -w -o ./dist -p ./src/js/** ./src/html/** ./src/css/**', 'Watches selected directories in ./src and creates output in ./dist')
// .example('$0 -o ./dist -p ./src/**', 'Runs script once that takes all ./src files and creates output in ./dist')
// .example('$0 -c watcher.config.js', 'Imports configuration file.')
// .example('$0 -j watcher.config.json', 'Imports json configuration file.')
.option('w', {
alias: 'watch',
type: 'boolean',
describe: 'Run script in watch mode',
default: false
})
.option('n', {
alias: 'fileName',
type: 'string',
describe: 'Modifies output file name'
})
.option('o', {
alias: 'output',
type: 'string',
describe: 'Output path'
})
.option('p', {
alias: 'patterns',
type: 'array',
describe: 'List of file patterns to match'
})
.option('c', {
alias: 'config',
type: 'string',
config: true,
describe: 'Path to js configuration file',
configParser: configPath => require(configPath)
})
.option('q', {
alias: 'quiet',
type: 'boolean',
describe: 'No output log',
default: false
})
.option('h', {
alias: 'help'
})
.help('h')
.argv;
watcher(argv);