2
2
mirror of https://github.com/Llewellynvdm/nativefier.git synced 2024-11-16 01:37:07 +00:00
nativefier/gulp/helpers/gulp-helpers.js

29 lines
602 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 }, (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) {
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
};