-
Notifications
You must be signed in to change notification settings - Fork 1
/
gulpfile.js
35 lines (32 loc) · 852 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
//basic babel task
var paths = {
babel : 'src/*.js',
dest: 'test/lib',
testOutDest: 'test/dest',
};
var gulp = require("gulp");
var fs = require("fs");
var babel = require("gulp-babel");
var sourcemaps = require('gulp-sourcemaps');
gulp.task('runtest', function() {
var pathOut = paths.testOutDest;
var exec = require('child_process').execSync;
if (!fs.existsSync(pathOut)) {
exec('mkdir ' + pathOut);
}
exec('gulp babel && node test/index', function (error, stdout, stderr) {
if (error) {
console.error(error);
}
});
});
gulp.task('babel', function() {
return gulp.src(paths.babel)
.pipe(sourcemaps.init())
.pipe(babel())
.pipe(sourcemaps.write('.'))
.pipe(gulp.dest(paths.dest))
})
gulp.task('watch', ['babel'], function() {
gulp.watch(paths.babel, ['babel'])
})