forked from expo/exp
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgulpfile.js
43 lines (38 loc) · 1015 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
37
38
39
40
41
42
43
const path = require('path');
const gulp = require('gulp');
const babel = require('gulp-babel');
const changed = require('gulp-changed');
const plumber = require('gulp-plumber');
const sourcemaps = require('gulp-sourcemaps');
const rimraf = require('rimraf');
const paths = {
source: 'src/**/*.js',
build: 'build',
sourceRoot: path.join(__dirname, 'src'),
};
const tasks = {
babel() {
return gulp
.src(paths.source)
.pipe(changed(paths.build))
.pipe(plumber())
.pipe(sourcemaps.init())
.pipe(babel())
.pipe(
sourcemaps.write('__sourcemaps__', { sourceRoot: paths.sourceRoot })
)
.pipe(gulp.dest(paths.build));
},
watchBabel(done) {
gulp.watch(paths.source, tasks.babel);
done();
},
};
gulp.task('build', tasks.babel);
gulp.task('babel', tasks.babel);
gulp.task('build', tasks.babel);
gulp.task('watch', tasks.watchBabel);
gulp.task('clean', done => {
rimraf(paths.build, done);
});
gulp.task('default', gulp.series('watch'));