-
Notifications
You must be signed in to change notification settings - Fork 8
/
gulpfile.js
82 lines (73 loc) · 1.76 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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
const { series, parallel, src, dest } = require("gulp");
var exec = require("child_process").exec;
var del = require("del");
function cleanGame(cb) {
return del([
"build/web-mobile",
// 这里我们使用一个通配模式来匹配 `mobile` 文件夹中的所有东西
]).then(() => {
cb();
process.exit();
});
}
// 删除本地调试的引擎文件
function delDevCocosJs(cb) {
return del(["build/web-mobile/cocos2d-js.js"]).then(() => {
cb();
});
}
// 拷贝发布版本的引擎文件
function copyProductCocosJs() {
return src("src/assets/cocos2d-js.js").pipe(dest("build/web-mobile/"));
}
function end(cb) {
cb();
process.exit(0);
}
function cleanGame(cb) {
return del([
"build/web-mobile",
// 这里我们使用一个通配模式来匹配 `mobile` 文件夹中的所有东西
]).then(() => {
cb();
process.exit();
});
}
function githubPull(cb) {
let data = process.argv.slice(2);
let type = data[1];
let param = data[2];
let branchTemp;
if (type === "-b") {
branchTemp = param;
}
return exec("git pull", function (err, stdout, stderr) {
console.log(stdout);
console.log(err);
cb(err);
});
}
function giteePull(cb) {
let data = process.argv.slice(2);
let type = data[1];
let param = data[2];
let branchTemp;
if (type === "-b") {
branchTemp = param;
}
return exec(
`git pull gitee ${branchTemp || "main"}`,
function (err, stdout, stderr) {
console.log(stdout);
console.log(stderr);
cb(err);
}
);
}
// electron任务
exports.delDevCocosJs = delDevCocosJs;
// electron任务
exports.processGame = series(delDevCocosJs, copyProductCocosJs, end);
exports.pull = series(githubPull, giteePull, end);
// 正常打包的任务
exports.cleanGame = cleanGame;