-
Notifications
You must be signed in to change notification settings - Fork 56
/
gulpfile.js
36 lines (30 loc) · 956 Bytes
/
gulpfile.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
const fs = require('fs-extra');
const gulp = require('gulp');
const babel = require('gulp-babel');
const watch = require('gulp-watch');
gulp.task('default', ['clearLib', 'compileJS', 'moveConfig']);
gulp.task('clearLib', [], function() {
return fs.removeSync('./lib/')
});
gulp.task('compileJS', [], function() {
var babelProcess = babel({
presets: ['es2015', 'es2017'],
plugins: ['transform-runtime']
})
babelProcess.on('error', function(e) {
console.log(e);
process.exit(1);
});
return watch('src/**/*.js', {
verbose: true,
ignoreInitial: false
}).pipe(babelProcess).pipe(gulp.dest('lib'));
})
gulp.task('moveConfig', [], function() {
return watch(['src/config/**/*.*', 'src/config/**/.*'], {
verbose: true,
ignoreInitial: false
}, () => {
gulp.src(['src/config/**/*.*', 'src/config/**/.*'], {base: 'src/'}).pipe(gulp.dest('lib'));
})
});