2
2
mirror of https://github.com/Llewellynvdm/nativefier.git synced 2024-11-16 18:15:08 +00:00
nativefier/gulp/helpers/gulp-helpers.js
2016-02-28 01:07:52 +08:00

29 lines
659 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: 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
};