-
Notifications
You must be signed in to change notification settings - Fork 41
/
Copy pathgulpfile.js
55 lines (47 loc) · 1.36 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
var gulp = require('gulp');
var mocha = require('gulp-mocha');
var bump = require('gulp-bump');
var eslint = require('gulp-eslint');
var istanbul = require('gulp-istanbul');
gulp.task('lint', ['lint-src', 'lint-test', 'lint-root']);
gulp.task('lint-src', function() {
return gulp.src('src/**/*.js').
pipe(eslint()).
pipe(eslint.format()).
pipe(eslint.failAfterError());
});
gulp.task('lint-test', function() {
return gulp.src('test/**/*.js').
pipe(eslint()).
pipe(eslint.format()).
pipe(eslint.failAfterError());
});
gulp.task('lint-root', function() {
return gulp.src('*.js').
pipe(eslint()).
pipe(eslint.format()).
pipe(eslint.failAfterError());
});
gulp.task('bump', function() {
return gulp.
src('package.json').
pipe(bump({type: 'patch'})).
pipe(gulp.dest('./'));
});
gulp.task('test-coverage', function (cb) {
gulp.src(['./src/**/*.js']).
pipe(istanbul()).
pipe(istanbul.hookRequire()).
on('finish', function () {
gulp.src(['./test/index.js']).
pipe(mocha()).
pipe(istanbul.writeReports()).
on('end', cb);
});
});
gulp.task('test', function (cb) {
gulp.src(['./test/index.js'])
.pipe(mocha())
.on('end', cb);
});
gulp.task('dist', ['lint', 'test-coverage']);