-
Notifications
You must be signed in to change notification settings - Fork 41
/
gulpfile.js
67 lines (60 loc) · 1.97 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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
const gulp = require('gulp')
const fs = require('fs')
const path = require('path')
const concat = require('gulp-concat');
const rename = require('gulp-rename');
const uglifyes = require('uglify-es');
const composer = require('gulp-uglify/composer');
const minify = composer(uglifyes, console);
const babel = require('gulp-babel');
const clean = require('gulp-clean');
const sequence = require('run-sequence');
// const oss = require('ali-oss')
const crypto = require('crypto')
const self_config = require('./gulpfile-config.json')
// 合并用户JS
gulp.task('compile', function () {
let stream = gulp.src(self_config.source)
// .pipe(babel())
// .pipe(concat('main.js'))
.pipe(minify())
.pipe(gulp.dest(self_config.dist));
return stream;
});
gulp.task('copy-res-scripts', function () {
let stream = gulp.src(self_config.dist '*')
.pipe(rename({ 'extname': '.js.txt' }))
.pipe(gulp.dest(self_config.resources "dist"))
return stream;
});
gulp.task('copy-res-config', function () {
let stream = gulp.src(self_config.config '*')
.pipe(rename({ 'extname': '.json.txt' }))
.pipe(gulp.dest(self_config.resources "config"))
return stream;
});
gulp.task('copy-res-protogen', function () {
let stream = gulp.src(self_config.protogen '*')
.pipe(rename({ 'extname': '.js.txt' }))
.pipe(gulp.dest(self_config.resources "protogen"))
return stream;
});
gulp.task('clean', function () {
let stream = gulp.src([
self_config.resources 'dist/*',
self_config.resources 'protogen/*',
self_config.resources 'config/*'
]).pipe(clean({ force: true }))
return stream;
});
// 打包
gulp.task('default', gulp.series(
'clean',
'compile',
'copy-res-scripts',
'copy-res-config',
'copy-res-protogen',
function (cb) {
// target_platform = "release"
cb();
}));