1 | var nodemon = require('nodemon') |
||
2 | var clc = require('cli-color') |
||
3 | |||
4 | // NODE_ENV=development nodemon --exec npm run babel-app src/server/app.js --kill-others |
||
5 | // ROOT=/path/to/my/abesite node src/tasks/nodemon.js |
||
6 | |||
7 | nodemon({ |
||
8 | script: __dirname + '/../../src/server/app.js', |
||
0 ignored issues
–
show
Compatibility
introduced
by
![]() |
|||
9 | options: { |
||
10 | exec: __dirname + '/../../node_modules/.bin/babel-node --presets es2015' |
||
0 ignored issues
–
show
|
|||
11 | }, |
||
12 | nodeArgs: ['--debug'], |
||
13 | restartable: 'rs', |
||
14 | colours: true, |
||
15 | execMap: { |
||
16 | js: __dirname + '/../../node_modules/.bin/babel-node --presets es2015' |
||
0 ignored issues
–
show
|
|||
17 | }, |
||
18 | env: { |
||
19 | 'NODE_ENV': 'development' |
||
20 | }, |
||
21 | ignore: [ |
||
22 | // 'docs/*' //TODO: find out why in dev mode this line uncommented break server reload on file change |
||
23 | ], |
||
24 | watch: [ |
||
25 | 'src/cli/*', |
||
26 | 'src/hooks/*', |
||
27 | 'src/server/routes/*', |
||
28 | 'src/server/helpers/*', |
||
29 | 'src/server/middlewares/*', |
||
30 | 'src/server/controllers/*', |
||
31 | 'src/server/app.js', |
||
32 | 'src/server/index.js', |
||
33 | process.env.ROOT + '/scripts/**/**/*.js', |
||
34 | process.env.ROOT + '/abe.json', |
||
35 | process.env.ROOT + '/locales/*', |
||
36 | process.env.ROOT + '/hooks/**/*.js', |
||
37 | process.env.ROOT + '/reference/**/*.json' |
||
38 | ], |
||
39 | stdin: true, |
||
40 | runOnChangeOnly: false, |
||
41 | verbose: true, |
||
42 | // 'stdout' refers to the default behaviour of a required nodemon's child, |
||
43 | // but also includes stderr. If this is false, data is still dispatched via |
||
44 | // nodemon.on('stdout/stderr') |
||
45 | stdout: true |
||
46 | }) |
||
47 | |||
48 | nodemon.on('start', function () { |
||
49 | }).on('quit', function () { |
||
50 | console.log(clc.green('Kill process nodemon')) |
||
0 ignored issues
–
show
|
|||
51 | process.exit() |
||
0 ignored issues
–
show
Compatibility
Debugging Code
Best Practice
introduced
by
|
|||
52 | }).on('restart', function (files) { |
||
53 | console.log('------------------------------------------------------------') |
||
0 ignored issues
–
show
|
|||
54 | console.log(clc.green('App restarted due to: '), files[0]) |
||
55 | }) |