2016-02-27 17:07:52 +00:00
|
|
|
import gulp from 'gulp';
|
2016-02-27 16:45:44 +00:00
|
|
|
import shellJs from 'shelljs';
|
2016-02-27 17:07:52 +00:00
|
|
|
import sourcemaps from 'gulp-sourcemaps';
|
|
|
|
import babel from 'gulp-babel';
|
2016-02-27 16:45:44 +00:00
|
|
|
|
|
|
|
function shellExec(cmd, silent, callback) {
|
2017-04-29 14:52:12 +00:00
|
|
|
shellJs.exec(cmd, { silent }, (code, stdout, stderr) => {
|
|
|
|
if (code) {
|
|
|
|
callback(JSON.stringify({ code, stdout, stderr }));
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
callback();
|
|
|
|
});
|
2016-02-27 16:45:44 +00:00
|
|
|
}
|
|
|
|
|
2016-02-27 17:07:52 +00:00
|
|
|
function buildES6(src, dest, callback) {
|
2017-04-29 14:52:12 +00:00
|
|
|
return gulp.src(src)
|
2017-11-14 13:05:01 +00:00
|
|
|
.pipe(sourcemaps.init())
|
|
|
|
.pipe(babel())
|
|
|
|
.on('error', callback)
|
|
|
|
.pipe(sourcemaps.write('.'))
|
|
|
|
.pipe(gulp.dest(dest));
|
2016-02-27 17:07:52 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
export default {
|
2017-04-29 14:52:12 +00:00
|
|
|
shellExec,
|
|
|
|
buildES6,
|
2016-02-27 17:07:52 +00:00
|
|
|
};
|