-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
49 lines (38 loc) · 985 Bytes
/
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
var gulp = require('gulp');
var del = require('del');
var babel = require('gulp-babel');
var mocha = require('gulp-mocha');
var rename = require('gulp-rename');
var plumber = require('gulp-plumber');
var vinylPaths = require('vinyl-paths');
gulp.task('clean', function(cb) {
return del([
'./index.js',
'./docs/',
]);
});
gulp.task('babel', ['clean'], function() {
return gulp.src('index.es6')
.pipe(babel())
.pipe(rename('index.js'))
.pipe(gulp.dest('.'));
});
gulp.task('watch', function() {
gulp.watch('index.es6', ['babel', 'test-noexit']);
});
function test(noexit) {
var path = gulp.src('test.js')
.pipe(babel())
.pipe(rename('test.es5.js'))
.pipe(gulp.dest('.'));
if (noexit) { path = path.pipe(plumber()); }
path = path.pipe(mocha());
return path
.pipe(vinylPaths(del));
}
gulp.task('test', ['babel'], function() {
return test(false);
});
gulp.task('test-noexit', ['babel'], function() {
return test(true);
});