-
Notifications
You must be signed in to change notification settings - Fork 5
/
gulpfile.js
57 lines (49 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
51
52
53
54
55
56
57
let gulp = require('gulp');
let fs = require('fs');
let mri = require('mri');
let config = {
dest: {
root: 'release',
assets: 'release/assets',
plugin: 'release/trunk',
tag: 'release/tag'
},
src: {
release: 'release/trunk/**/*.*',
assets: 'svn/assets/*.*',
plugin: [
'app*/**/*',
'assets*/**/*',
'build*/**/*',
'lang*/**/*.pot',
'views*/**/*',
'iframely.php',
'index.php',
'readme.txt',
],
},
};
function clean(ob) {
fs.rmSync(config.dest.root, { recursive: true, force: true });
ob();
}
function copyAssets() {
return gulp.src(config.src.assets).pipe(gulp.dest(config.dest.assets));
}
function copyPlugin() {
return gulp.src(config.src.plugin).pipe(gulp.dest(config.dest.plugin));
}
function copyTag(ob) {
let argv = mri(process.argv.slice(2), {
string: 'tag',
});
let tag = argv.tag || false;
if (tag) {
let dest = `${config.dest.tag}/${tag}`;
return gulp.src(config.src.release).pipe(gulp.dest(dest));
}
ob();
}
gulp.task('clean', gulp.series(clean));
gulp.task('release', gulp.series(clean, copyAssets, copyPlugin, copyTag));
gulp.task('default', gulp.series('release'));