-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathupdate_138.js
56 lines (47 loc) · 2.16 KB
/
update_138.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
let process = require('child_process')
let clc = require('cli-color');
function system(command) {
return new Promise(function(resolve, reject) {
process.exec(command, function(err, stdout, stderr) {
if (err !== null) {
console.log('exec error: ' + err);
}
resolve();
});
});
}
const CC_BIN = 'C:/CocosCreator/CocosCreator.exe';
async function update() {
console.log(clc.red('start update...\nstart building...'));
let command = CC_BIN + ' --path ./ --build "platform web-mobile"';
await system(command);
console.log(clc.green('build successfully.'))
console.log(clc.red('start copying...'))
// copy html
await system('mv ./build/web-mobile/index.html ./build/web-mobile/client_index.html & \
cp ./html/bind/index.html ./build/web-mobile/index.html & \
cp ./html/bind/bg_wp.jpg ./build/web-mobile/bg_wp.jpg & \
cp ./html/bind/icon.png ./build/web-mobile/icon.png');
console.log(clc.green('copy successfully.'))
console.log(clc.red('start zipping...'))
// zip
await system('7z a ./build/web-mobile/web-mobile.zip ./build/web-mobile/*');
console.log(clc.green('zip successfully.'))
console.log(clc.red('start uploading...'))
// upload
console.log('scp build/web-mobile/web-mobile.zip root@192.168.0.138:/yt/mgxy-server-kit/apache-tomcat-8.0.24/webapps/chinglish.war')
console.log("scp build/web-mobile/web-mobile.zip root@120.25.124.141:/usr/local/games/apache-tomcat-ytclient/webapps/chinglish.war")
console.log(clc.green('upload successfully.\nupdate complete!'))
}
async function pack() {
await system('mv ./build/web-mobile/index.html ./build/web-mobile/client_index.html & \
cp ./html/bind/index.html ./build/web-mobile/index.html & \
cp ./html/bind/bg_wp.jpg ./build/web-mobile/bg_wp.jpg & \
cp ./html/bind/icon.png ./build/web-mobile/icon.png');
console.log(clc.green('copy successfully.'))
console.log(clc.green('copy successfully.'))
// zip
await system('7z a ./build/web-mobile/web-mobile.zip ./build/web-mobile/*');
}
update();
// pack();