forked from brave/vault
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgulpfile.js
73 lines (66 loc) · 1.54 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
68
69
70
71
72
73
var gulp = require('gulp')
var del = require('del')
var nodemon = require('gulp-nodemon')
var runSequence = require('run-sequence')
var standard = require('gulp-standard')
var SRC = [
'gulpfile.js',
'src/**/[A-Za-z]*.js',
'src/controllers/**/[A-Za-z]*.js',
'test/**/[A-Za-z]*.js'
]
/**
* Runs travis tests and the pre-commit hook.
*/
var failOnLint = false
gulp.task('angry-lint', function (cb) {
failOnLint = true
runSequence(['lint'], cb)
})
gulp.task('run', function () {
nodemon({
script: 'src/index.js',
ext: 'js',
execMap: {
js: './node_modules/.bin/babel-node'
},
watch: SRC
}).on('change', ['lint', 'run'])
.on('restart', function () {
console.log('restarted!')
})
})
/**
* Runs linters on all javascript files found in the src dir.
*/
gulp.task('lint', function () {
// Note: To have the process exit with an error code (1) on
// lint error, return the stream and pipe to failOnError last.
return gulp.src(SRC)
.pipe(standard())
.pipe(standard.reporter('default', {
breakOnError: failOnLint
}))
})
/**
* Install pre-commit hook for app.
*/
gulp.task('pre-commit', function () {
return gulp.src(['./pre-commit'])
.pipe(gulp.dest('.git/hooks/'))
})
/**
* The default task when `gulp` is run.
* Adds a listener which will re-build on a file save.
*/
gulp.task('default', function () {
runSequence('lint', 'run')
})
/**
* Cleans all created files by this gulpfile, and node_modules.
*/
gulp.task('clean', function (cb) {
del([
'node_modules/'
], cb)
})