-
Notifications
You must be signed in to change notification settings - Fork 0
/
Gulpfile.js
39 lines (34 loc) · 811 Bytes
/
Gulpfile.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
'use strict';
var gulp = require('gulp'),
jshint = require('gulp-jshint'),
spawn = require('child_process').spawn,
config = require('./configurations/config.json'),
node;
gulp.task('server', function() {
if (node) {
node.kill();
}
node = spawn('node', ['./bin/www']);
node.on('close', function (code) {
if (code === 8) {
gulp.log('Error detected, waiting for changes...');
}
});
});
gulp.task('lint', function () {
gulp.src('./**/*.js')
.pipe(jshint());
});
gulp.task('default', function() {
gulp.run('lint');
gulp.run('server');
gulp.watch(['./app.js', `./${config.modelFolder}/**/*`], function() {
gulp.run('server');
});
});
// clean up if an error goes unhandled.
process.on('exit', function() {
if (node) {
node.kill();
}
});