-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
executable file
·65 lines (56 loc) · 1.65 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
const babel = require('gulp-babel');
const batch = require('gulp-batch');
const clean = require('gulp-rimraf');
const debug = require('gulp-debug');
const eslint = require('gulp-eslint');
const gulp = require('gulp');
const runSequence = require('run-sequence');
const tape = require('gulp-tape');
const tapColorize = require('tap-colorize');
const watch = require('gulp-watch');
gulp.task('default', ['build']);
gulp.task('build', function build(f) {
runSequence('clean-build',
'build-src',
f);
});
gulp.task('test', function test(f) {
runSequence('lint',
'build',
'build-test',
'run-test',
f);
});
gulp.task('test-watch', function test() {
// simple rebuild all watcher
watch(['src/**', 'test/**'], batch(function f(events, done) {
gulp.start('test', done);
}));
});
gulp.task('lint', function test() {
return gulp.src(['src/js/**/*.js', 'test/js/**/*.js'])
.pipe(eslint())
.pipe(eslint.format())
.pipe(eslint.failOnError());
});
gulp.task('build-src', function buildSrc() {
return gulp.src('src/js/**/*.js')
.pipe(babel())
.pipe(gulp.dest('build'));
});
gulp.task('build-test', function buildTest() {
return gulp.src('test/js/**/*.js')
.pipe(babel())
.pipe(gulp.dest('build'));
});
gulp.task('clean-build', function cleanBuild() {
return gulp.src('build')
.pipe(clean());
});
gulp.task('run-test', function test() {
return gulp.src('build/**/*-test.js')
.pipe(debug())
.pipe(tape({
reporter: tapColorize(),
}));
});