-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathgulpfile.js
40 lines (34 loc) · 939 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
40
'use strict';
const gulp = require('gulp');
const eslint = require('gulp-eslint');
const mocha = require('gulp-mocha');
const nodemon = require('gulp-nodemon');
gulp.task('lint', function() {
gulp.src(['**/*.js', '**/*/*.js', '!node_modules'])
.pipe(eslint())
.pipe(eslint.format())
.pipe(eslint.failAfterError());
});
gulp.task('test', function() {
gulp.src(['./test/*.js', '!node_modules'], { read: false })
.pipe(mocha( { report: 'spec' } ));
});
gulp.task('dev', function() {
var stream = nodemon({
script: 'server.js',
ext: 'js html',
ignore: ['node_modules'],
watch: ['*'],
env: { 'NODE_ENV': 'development' },
tasks: ['lint', 'test']
});
stream
.on('restart', function() {
console.log('Restarted Server');
})
.on('crash', function() {
console.error('Applicaiton has crashed');
stream.emit('restart', 5);
});
});
gulp.task('default', ['dev']);