-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgulpfile.js
More file actions
98 lines (82 loc) · 2.24 KB
/
gulpfile.js
File metadata and controls
98 lines (82 loc) · 2.24 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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
// gulp
const gulp = require('gulp');
// plugins
const eslint = require('gulp-eslint');
// testing
const istanbul = require('gulp-istanbul');
const mocha = require('gulp-mocha');
// utilities
const del = require('del');
const exec = require('child_process').exec;
const runSequence = require('run-sequence');
// package info
const pkginfo = require('./package.json');
gulp.task('clean', () => {
return del(['dist/**', 'coverage/**']);
});
gulp.task('docs', function(done) {
exec(`mr-doc -n "${pkginfo.description} ${pkginfo.version} API Reference" -s src --theme glint`, function(err, stdout, stderr) {
console.log(stdout);
console.log(stderr);
done(err);
});
});
gulp.task('lint', () => {
return gulp.src(['src/**/*.js', 'test/**/*.js', 'gulpfile.js'])
.pipe(eslint())
.pipe(eslint.format())
.pipe(eslint.failAfterError());
});
gulp.task('coverage', ['lint'], () => {
return gulp.src(['src/**/*.js'])
.pipe(istanbul())
.pipe(istanbul.hookRequire());
});
gulp.task('test:coverage', ['lint', 'coverage'], () => {
return gulp.src('./test/unit/**/*.js')
.pipe(mocha({
reporter: 'spec',
quiet: false,
colors: true,
timeout: 10000
}))
.pipe(istanbul.writeReports({
reporters: ['lcov']
}));
});
gulp.task('test:no-coverage', ['lint'], () => {
return gulp.src('./test/unit/**/*.js')
.pipe(mocha({
reporter: 'spec',
quiet: false,
colors: true,
timeout: 10000
}));
});
gulp.task('test', ['lint', 'coverage'], () => {
return gulp.src('./test/unit/**/*.js')
.pipe(mocha({
reporter: 'spec',
quiet: false,
colors: true,
timeout: 10000
}))
.pipe(istanbul.writeReports({
reporters: ['text-summary']
}));
});
gulp.task('build', ['test'], () => {
// commented out, since we don't do any transpilation or concatenation or minification or whatever (yet)
// return gulp.src('src/**/*.js')
// .pipe(gulp.dest('dist'));
});
gulp.task('watch', () => {
gulp.watch('src/**/*.js', ['build']);
});
gulp.task('default', (callback) => {
runSequence('clean', 'test', callback);
});
gulp.task('ci', (callback) => {
runSequence('clean', 'build', 'test:coverage', callback);
});
gulp.task('dist', ['lint']);