diff --git a/gulpfile.babel.js b/gulpfile.babel.js new file mode 100644 index 0000000..656aeb5 --- /dev/null +++ b/gulpfile.babel.js @@ -0,0 +1,33 @@ +import gulp from 'gulp'; +import del from 'del'; +import ext from 'gulp-ext'; +import babel from 'gulp-babel'; +import uglify from 'gulp-uglify'; +import help from 'gulp-task-listing'; + +gulp.task('help', help); + +gulp.task('compile', [ + 'compile-lib', + 'compile-bin' +]); + +gulp.task('compile-lib', () => + gulp.src('lib/**/*.js') + .pipe(babel()) + .pipe(uglify()) + .pipe(gulp.dest('build/lib'))); + +gulp.task('compile-bin', () => + gulp.src('bin/*') + .pipe(babel()) + .pipe(uglify()) + .pipe(ext.crop()) + .pipe(gulp.dest('build/bin'))); + +gulp.task('watch-lib', () => gulp.watch('lib/*.js', ['compile-lib'])); +gulp.task('watch-bin', () => gulp.watch('bin/*', ['compile-bin'])); +gulp.task('clean', () => del(['build'])); + +gulp.task('watch', ['watch-lib', 'watch-bin']); +gulp.task('default', ['compile', 'watch']); diff --git a/gulpfile.js b/gulpfile.js deleted file mode 100644 index 86ada6c..0000000 --- a/gulpfile.js +++ /dev/null @@ -1,58 +0,0 @@ -const gulp = require('gulp'); -const del = require('del'); -const ext = require('gulp-ext'); -const babel = require('gulp-babel'); -const uglify = require('gulp-uglify'); -const help = require('gulp-task-listing'); - -gulp.task('help', help); - -gulp.task('compile', [ - 'compile-lib', - 'compile-bin' -]); - -gulp.task('compile-lib', () => { - return gulp.src('lib/**/*.js') - .pipe(babel({ - presets: ['es2015'], - plugins: [ - 'syntax-async-functions', - 'transform-async-to-generator', - 'transform-runtime' - ] - })) - .pipe(uglify()) - .pipe(gulp.dest('build/lib')); -}); - -gulp.task('compile-bin', () => { - return gulp.src('bin/*') - .pipe(babel({ - presets: ['es2015'], - plugins: [ - 'syntax-async-functions', - 'transform-async-to-generator', - 'transform-runtime' - ] - })) - .pipe(uglify()) - .pipe(ext.crop()) - .pipe(gulp.dest('build/bin')); -}); - -gulp.task('watch', ['watch-lib', 'watch-bin']); - -gulp.task('watch-lib', () => { - return gulp.watch('lib/*.js', ['compile-lib']); -}); - -gulp.task('watch-bin', () => { - return gulp.watch('bin/*', ['compile-bin']); -}); - -gulp.task('clean', () => { - return del(['build']); -}); - -gulp.task('default', ['compile', 'watch']); diff --git a/package.json b/package.json index c175ca7..1f973b3 100644 --- a/package.json +++ b/package.json @@ -7,6 +7,16 @@ "files": [ "build" ], + "babel": { + "presets": [ + "es2015" + ], + "plugins": [ + "syntax-async-functions", + "transform-async-to-generator", + "transform-runtime" + ] + }, "eslintConfig": { "extends": "standard", "parser": "babel-eslint",