2
2
mirror of https://github.com/Llewellynvdm/nativefier.git synced 2024-12-24 02:55:26 +00:00
nativefier/gulp/helpers/gulp-helpers.js

29 lines
659 B
JavaScript
Raw Normal View History

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) {
shellJs.exec(cmd, {silent: silent}, (code, stdout, stderr) => {
if (code) {
callback(JSON.stringify({code, stdout, stderr}));
return;
}
callback();
});
}
2016-02-27 17:07:52 +00:00
function buildES6(src, dest, callback) {
return gulp.src(src)
.pipe(sourcemaps.init())
.pipe(babel())
.on('error', callback)
.pipe(sourcemaps.write('.'))
.pipe(gulp.dest(dest));
}
export default {
shellExec,
buildES6
};