-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathscript.nodemon.js
More file actions
46 lines (39 loc) · 1.12 KB
/
script.nodemon.js
File metadata and controls
46 lines (39 loc) · 1.12 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
const nodemon = require('nodemon');
const nodemonCli = require('nodemon/lib/cli');
const deepMerge = require('lodash.merge');
const weblog = require('webpack-log');
const ENV = require('./app.env');
const logger = weblog({ name: 'nodemon' });
const nodemonConfig = {
delay: '2500',
ext: 'js,html',
watch: ['*.*', '.*'],
ignore: ['**/.hg/**', '**/.git/**', '**/.svn/**', 'build', 'source/js', 'source/partials', 'source/html.data.js'].concat(
ENV.SITEMAP.map((i) => i.template),
),
verbose: true,
};
const options = deepMerge({}, nodemonConfig, nodemonCli.parse(process.argv));
nodemon(options);
nodemon
.on('start', () => {
logger.info('App has started');
})
.on('quit', () => {
logger.warn('App has quit');
process.exit(0);
})
.on('restart', (files) => {
logger.info('App restarted due to: ', files);
});
process
.on('exit', (code) => {
// Handle normal exits
nodemon.emit('quit');
process.exit(code);
})
.on('SIGINT', () => {
// Handle CTRL+C
nodemon.emit('quit');
process.exit(0);
});