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

30 lines
607 B
JavaScript
Raw Permalink 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 }, (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) {
2018-05-24 07:02:44 +00:00
return gulp
.src(src)
.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 {
shellExec,
buildES6,
2016-02-27 17:07:52 +00:00
};