-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathgulpfile.js
More file actions
49 lines (39 loc) · 1.06 KB
/
gulpfile.js
File metadata and controls
49 lines (39 loc) · 1.06 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
47
48
49
var gulp = require('gulp');
var gutil = require('gulp-util');
var livereload = require('gulp-livereload');
var nodemon = require('gulp-nodemon');
var jshint = require('gulp-jshint');
var mocha = require('gulp-mocha');
var path = {
server: './server/index.js',
serverSideJs: './server/**/*.js',
test: './test/**/*.js',
}
gulp.task('watch', function() {
});
// TODO: watch out for dev mode vs prod mode
gulp.task('lint', function() {
return gulp.src([path.serverSideJs])
.pipe(jshint())
.pipe(jshint.reporter('default'));
});
gulp.task('mocha', function () {
return gulp.src(path.test)
.pipe(mocha({reporter: 'nyan'}));
});
gulp.task('mochaWatch', function() {
return gulp.watch(path.serverSideJs, ['mocha']);
})
gulp.task('expressDev', function() {
nodemon({
script: path.server,
})
.on('restart', function() {
console.log('restarted server');
});
});
/////////////Command-line API////////////////////////////
// $> gulp
gulp.task('default', ['lint', 'watch', 'expressDev']);
// $> gulp test
gulp.task('test', ['mochaWatch', 'mocha']);