2
2
mirror of https://github.com/Llewellynvdm/nativefier.git synced 2024-11-14 00:54:04 +00:00
nativefier/gulp/helpers/gulp-helpers.js
2018-05-24 00:02:44 -07:00

30 lines
607 B
JavaScript

import gulp from 'gulp';
import shellJs from 'shelljs';
import sourcemaps from 'gulp-sourcemaps';
import babel from 'gulp-babel';
function shellExec(cmd, silent, callback) {
shellJs.exec(cmd, { silent }, (code, stdout, stderr) => {
if (code) {
callback(JSON.stringify({ code, stdout, stderr }));
return;
}
callback();
});
}
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,
};