flying-squid/gulpfile.js
Romain Beaumont 7efb2daea3 rewrite tests using async/await
much easier to understand that way
2015-12-06 19:42:44 +01:00

48 lines
1.1 KiB
JavaScript

var gulp = require('gulp');
var plumber = require('gulp-plumber');
var babel = require('gulp-babel');
var options = {
stage: 0, // Dat ES7 goodness
optional: ["runtime"]
};
var sourcemaps = require('gulp-sourcemaps');
gulp.task('compile', function() {
return gulp
.src('src/**/*.js')
.pipe(plumber({
errorHandler: function(err) {
console.error(err.stack);
this.emit('end');
}
}))
.pipe(sourcemaps.init())
.pipe(babel(options))
.pipe(plumber.stop())
.pipe(sourcemaps.write('maps/'))
.pipe(gulp.dest('dist/'));
});
gulp.task('compileTest', function() {
return gulp
.src('test/**/*.js')
.pipe(plumber({
errorHandler: function(err) {
console.error(err.stack);
this.emit('end');
}
}))
.pipe(sourcemaps.init())
.pipe(babel(options))
.pipe(plumber.stop())
.pipe(sourcemaps.write('maps/'))
.pipe(gulp.dest('distTest/'));
});
gulp.task('watch', function() {
return gulp.watch('src/**/*.js', ['compile']);
});
gulp.task('default', ['compile','compileTest']);