-
Notifications
You must be signed in to change notification settings - Fork 58
/
gulpfile.js
50 lines (44 loc) · 1.18 KB
/
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
44
45
46
47
48
49
50
process.env.NODE_ENV = 'production';
const gulp = require('gulp');
const plumber = require('gulp-plumber');
const gulpBabel = require('gulp-babel');
const babelConfig = require('./config/babel');
const defaultConfig = require('./config/config.defaults');
const dest = './publish';
const copy = () => {
return gulp
.src([
'./!(node_modules|publish)/**/*',
'./!(node_modules|publish)',
'./.!(git)*',
'./!*.js',
])
.pipe(plumber())
.pipe(gulp.dest(dest));
};
const babel = () => {
return gulp
.src([
'./!(node_modules|publish)/**/*.@(js|ts|jsx|tsx)',
'./*.@(js|ts|jsx|tsx)',
])
.pipe(gulpBabel(babelConfig(true, defaultConfig)))
.on('error', (error) => console.log(error))
.pipe(plumber())
.pipe(gulp.dest(dest));
};
const watch = () => {
return gulp
.watch(
['./!(node_modules|publish)**/*', './!(node_modules|publish)'],
['babel']
)
.on('change', function (event) {
console.log(
'File ' + event.path + ' was ' + event.type + ', running tasks...'
);
})
.on('error', (error) => console.log(error));
};
exports.watch = watch;
exports.default = gulp.series(copy, babel);