-
Notifications
You must be signed in to change notification settings - Fork 2
/
gulpfile.js
67 lines (60 loc) · 1.48 KB
/
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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
var gulp = require('gulp'),
jshint = require('gulp-jshint'),
console = require('better-console'),
stylish = require('jshint-stylish'),
lab = require('gulp-lab'),
nodemon = require('gulp-nodemon');
var paths = {
jsLintFiles: [
'./config/**/*.js',
'./controllers/**/*.js',
'./knexfile.js',
'./models/**/*.js',
'./public/**/*.js',
'./routes/**/*.js',
'./server.js',
'./test/**/*.js',
'./utils/**/*.js',
'./validators/**/*.js'
],
allTestSource: [
'./config/**/*.js',
'./controllers/**/*.js',
'./models/**/*.js',
'./public/**/*.js',
'./public/**/*.css',
'./routes/**/*.js',
'./server.js',
'./test/**/*.js',
'./utils/**/*.js',
'./validators/**/*.js',
'./views/**/*.html'
]
};
gulp.task('clear', function () {
return console.clear();
});
gulp.task('lint', function () {
return gulp.src(paths.jsLintFiles)
.pipe(jshint({ node: true }))
.pipe(jshint.reporter('jshint-stylish'));
});
gulp.task('lintw', ['clear'], function() {
return gulp.watch(paths.jsLintFiles, ['clear', 'lint']);
});
gulp.task('test', function () {
return gulp.src('test')
.pipe(lab('-c'));
});
gulp.task('testw', ['clear'], function () {
return gulp.watch(paths.allTestSource, ['clear', 'test']);
});
gulp.task('nodemon', ['clear'], function () {
return nodemon({
script: './bin/www',
ext: 'html js css',
tasks: ['clear']})
.on('restart', function () {
console.log('restarted...');
});
});