mirror of
https://github.com/Llewellynvdm/nativefier.git
synced 2024-12-22 18:18:55 +00:00
DRY for building es6 with babel
This commit is contained in:
parent
8ef3137d02
commit
e0e5b16f0b
@ -1,13 +1,9 @@
|
||||
import gulp from 'gulp';
|
||||
import PATHS from './../helpers/src-paths';
|
||||
import sourcemaps from 'gulp-sourcemaps';
|
||||
import babel from 'gulp-babel';
|
||||
import helpers from './../helpers/gulp-helpers';
|
||||
|
||||
const {buildES6} = helpers;
|
||||
|
||||
gulp.task('build-cli', done => {
|
||||
return gulp.src(PATHS.CLI_SRC_JS)
|
||||
.pipe(sourcemaps.init())
|
||||
.pipe(babel())
|
||||
.on('error', done)
|
||||
.pipe(sourcemaps.write('.'))
|
||||
.pipe(gulp.dest('lib'));
|
||||
return buildES6(PATHS.CLI_SRC_JS, PATHS.CLI_DEST, done);
|
||||
});
|
||||
|
@ -1,8 +1,8 @@
|
||||
import gulp from 'gulp';
|
||||
import PATHS from './../helpers/src-paths';
|
||||
import helpers from './../helpers/gulp-helpers';
|
||||
|
||||
import babel from 'gulp-babel';
|
||||
import sourcemaps from 'gulp-sourcemaps';
|
||||
const {buildES6} = helpers;
|
||||
|
||||
gulp.task('build-static-not-js', () => {
|
||||
return gulp.src([PATHS.APP_STATIC_ALL, '!**/*.js'])
|
||||
@ -10,12 +10,7 @@ gulp.task('build-static-not-js', () => {
|
||||
});
|
||||
|
||||
gulp.task('build-static-js', done => {
|
||||
return gulp.src(PATHS.APP_STATIC_JS)
|
||||
.pipe(sourcemaps.init())
|
||||
.pipe(babel())
|
||||
.on('error', done)
|
||||
.pipe(sourcemaps.write('.'))
|
||||
.pipe(gulp.dest(PATHS.APP_STATIC_DEST));
|
||||
return buildES6(PATHS.APP_STATIC_JS, PATHS.APP_STATIC_DEST, done);
|
||||
});
|
||||
|
||||
gulp.task('build-static', ['build-static-js', 'build-static-not-js']);
|
||||
|
@ -1,4 +1,7 @@
|
||||
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) => {
|
||||
@ -10,4 +13,16 @@ function shellExec(cmd, silent, callback) {
|
||||
});
|
||||
}
|
||||
|
||||
export default {shellExec};
|
||||
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
|
||||
};
|
||||
|
@ -1,14 +1,9 @@
|
||||
import gulp from 'gulp';
|
||||
import PATHS from './../helpers/src-paths';
|
||||
import helpers from './../helpers/gulp-helpers';
|
||||
|
||||
import sourcemaps from 'gulp-sourcemaps';
|
||||
import babel from 'gulp-babel';
|
||||
const {buildES6} = helpers;
|
||||
|
||||
gulp.task('build-tests', done => {
|
||||
return gulp.src(PATHS.TEST_SRC_JS)
|
||||
.pipe(sourcemaps.init())
|
||||
.pipe(babel())
|
||||
.on('error', done)
|
||||
.pipe(sourcemaps.write('.'))
|
||||
.pipe(gulp.dest(PATHS.TEST_DEST));
|
||||
return buildES6(PATHS.TEST_SRC_JS, PATHS.TEST_DEST, done);
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user