forked from vitelabs/vite-wallet
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgulpfile.js
43 lines (36 loc) · 1.02 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
const path = require('path');
const gulp = require('gulp');
const babel = require('gulp-babel');
const BUILD_PATH = path.join(__dirname, 'app/');
let taskNames = [];
let tasksConfig = [{
name: 'walletSrc',
startPath: 'walletSrc/**/*.js',
buildPath: path.join(BUILD_PATH, '/walletSrc')
}, {
name: 'utils',
startPath: 'utils/**/*.js',
buildPath: path.join(BUILD_PATH, '/utils')
}, {
name: 'main',
startPath: 'main.js',
buildPath: BUILD_PATH
}];
tasksConfig.forEach((taskConf) => {
taskNames.push(taskConf.name);
gulp.task(taskConf.name, function () {
return gulp.src(taskConf.startPath)
.pipe(babel({
presets: ['@babel/preset-env']
}))
.pipe(gulp.dest(taskConf.buildPath));
});
});
gulp.task('srcJson', function () {
return gulp.src('walletSrc/**/*.json')
.pipe(gulp.dest(path.join(BUILD_PATH, '/walletSrc')));
});
taskNames.push('srcJson');
gulp.task('default', gulp.series(...taskNames, function(done) {
done();
}));