-
Notifications
You must be signed in to change notification settings - Fork 6
/
createNodemonArgs.js
51 lines (49 loc) · 1.08 KB
/
createNodemonArgs.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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
module.exports = function createNodemonArgs(argv) {
var options = []
var args = []
var stopSlurping = false
for (var i = 0; i < argv.length; i++) {
if (stopSlurping) {
args.push(argv[i])
continue
}
switch (argv[i]) {
case '-e':
case '--ext':
case '-w':
case '--watch':
case '-i':
case '--ignore':
case '--delay':
case '--signal':
options.push(argv[i])
options.push(argv[++i])
break
case '-q':
case '--quiet':
case '-L':
case '--legacy-watch':
case '-V':
case '--verbose':
options.push(argv[i])
break
case '--':
stopSlurping = true
break
default:
args.push(argv[i])
}
}
if (!options.length) {
options.push(
'--ignore', 'node_modules/',
'--watch', '*.js',
'--watch', '*.jsx',
'--watch', '*.js.flow',
'--watch', '.flowconfig',
'--ext', 'js,mjs,jsx,json'
)
}
if (args.length) args.unshift('--')
return options.concat([require.resolve('./runFlow')], args)
}