提交工具
This commit is contained in:
2
.gitignore
vendored
Normal file
2
.gitignore
vendored
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
/python/switchBundle.spec
|
||||||
|
/python/build
|
||||||
106
nodejs/switchGame.js
Normal file
106
nodejs/switchGame.js
Normal file
@@ -0,0 +1,106 @@
|
|||||||
|
var fs = require('fs');
|
||||||
|
var path = require('path');
|
||||||
|
|
||||||
|
var GameID = process.argv[2]
|
||||||
|
|
||||||
|
var absPath = path.resolve('../build/web-mobile/') + '\\'
|
||||||
|
console.log(absPath)
|
||||||
|
|
||||||
|
|
||||||
|
const BundleConfig = {
|
||||||
|
'6001': 'whot',
|
||||||
|
'6002': 'whot',
|
||||||
|
'6003': 'whot',
|
||||||
|
'6005': 'BRWhot',
|
||||||
|
'2001': 'roulette',
|
||||||
|
'2002': 'wajeSpin',
|
||||||
|
'2003': 'bottleSpin',
|
||||||
|
'2004': 'blackjack',
|
||||||
|
'2006': 'betterjack',
|
||||||
|
'6007': 'whot',
|
||||||
|
'2008': 'slots',
|
||||||
|
}
|
||||||
|
|
||||||
|
var emptyDir = function (fileUrl) {
|
||||||
|
var files = fs.readdirSync(fileUrl);//读取该文件夹
|
||||||
|
files.forEach(function (file) {
|
||||||
|
var stats = fs.statSync(fileUrl + '/' + file);
|
||||||
|
if (stats.isDirectory()) {
|
||||||
|
emptyDir(fileUrl + '/' + file);
|
||||||
|
} else {
|
||||||
|
fs.unlinkSync(fileUrl + '/' + file);
|
||||||
|
// console.log("删除文件" + fileUrl + '/' + file + "成功");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
//删除所有的空文件夹
|
||||||
|
var rmEmptyDir = function (fileUrl) {
|
||||||
|
var files = fs.readdirSync(fileUrl);
|
||||||
|
if (files.length > 0) {
|
||||||
|
var tempFile = 0;
|
||||||
|
files.forEach(function (fileName) {
|
||||||
|
tempFile++;
|
||||||
|
rmEmptyDir(fileUrl + '/' + fileName);
|
||||||
|
});
|
||||||
|
if (tempFile == files.length) {//删除母文件夹下的所有字空文件夹后,将母文件夹也删除
|
||||||
|
fs.rmdirSync(fileUrl);
|
||||||
|
// console.log('删除空文件夹' + fileUrl + '成功');
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
fs.rmdirSync(fileUrl);
|
||||||
|
// console.log('删除空文件夹' + fileUrl + '成功');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function checkDirectory(dst) {
|
||||||
|
let arr = dst.substring(0, dst.lastIndexOf('/') + 1).split('/')
|
||||||
|
let dstPath = ''
|
||||||
|
while (arr.length) {
|
||||||
|
dstPath += arr.splice(0, 1)
|
||||||
|
dstPath += '/'
|
||||||
|
try {
|
||||||
|
fs.accessSync(dstPath)
|
||||||
|
} catch (error) {
|
||||||
|
fs.mkdirSync(dstPath)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
const unlinkArray = [
|
||||||
|
'cocos2d-js-min.13181.js',
|
||||||
|
'physics-min.ce5ee.js',
|
||||||
|
'style-desktop.dfd76.css',
|
||||||
|
'style-mobile.6e9cd.css'
|
||||||
|
]
|
||||||
|
const filesArray = fs.readdirSync(absPath)
|
||||||
|
|
||||||
|
filesArray.forEach(function (fname) {
|
||||||
|
const file = path.join(absPath, fname)
|
||||||
|
if (unlinkArray.includes(fname)) {
|
||||||
|
// 删除公用文件
|
||||||
|
fs.unlinkSync(file)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
const keepArray = [
|
||||||
|
'main',
|
||||||
|
'internal',
|
||||||
|
'resources',
|
||||||
|
BundleConfig[GameID]
|
||||||
|
]
|
||||||
|
|
||||||
|
const bundleRoot = path.join(absPath, 'assets')
|
||||||
|
const bundleArray = fs.readdirSync(bundleRoot)
|
||||||
|
|
||||||
|
bundleArray.forEach(function (fname) {
|
||||||
|
const dir = path.join(bundleRoot, fname)
|
||||||
|
if (!keepArray.includes(fname)) {
|
||||||
|
// 删除公用文件
|
||||||
|
// fs.unlinkSync(file)
|
||||||
|
// console.log(dir)
|
||||||
|
emptyDir(dir)
|
||||||
|
rmEmptyDir(dir)
|
||||||
|
}
|
||||||
|
})
|
||||||
BIN
python/dist/switchBundle.exe
vendored
Normal file
BIN
python/dist/switchBundle.exe
vendored
Normal file
Binary file not shown.
66
python/switchBundle.py
Normal file
66
python/switchBundle.py
Normal file
@@ -0,0 +1,66 @@
|
|||||||
|
import os
|
||||||
|
import sys
|
||||||
|
import subprocess
|
||||||
|
|
||||||
|
if len(sys.argv) < 3:
|
||||||
|
exit()
|
||||||
|
if '123!@#' != sys.argv[2]:
|
||||||
|
exit()
|
||||||
|
|
||||||
|
ProjDir = sys.argv[1]
|
||||||
|
BuildDir = ProjDir + '\\build\\web-mobile\\'
|
||||||
|
SubgamePath = 's3://web-h5game-test/internal/'
|
||||||
|
|
||||||
|
BundleConfig = {
|
||||||
|
'6001': 'whot',
|
||||||
|
'6002': 'whot',
|
||||||
|
'6003': 'whot',
|
||||||
|
'6005': 'BRWhot',
|
||||||
|
'2001': 'roulette',
|
||||||
|
'2002': 'wajeSpin',
|
||||||
|
'2003': 'bottleSpin',
|
||||||
|
'2004': 'blackjack',
|
||||||
|
'2006': 'betterjack',
|
||||||
|
'6007': 'whot',
|
||||||
|
'2008': 'slots',
|
||||||
|
}
|
||||||
|
|
||||||
|
unlinkArray = [
|
||||||
|
'cocos2d-js-min.13181.js',
|
||||||
|
'physics-min.ce5ee.js',
|
||||||
|
'style-desktop.dfd76.css',
|
||||||
|
'style-mobile.6e9cd.css',
|
||||||
|
'splash.85cfd.png'
|
||||||
|
]
|
||||||
|
|
||||||
|
def remove_folder(path):
|
||||||
|
if os.path.exists(path):
|
||||||
|
if os.path.isfile(path) or os.path.islink(path):
|
||||||
|
os.remove(path)
|
||||||
|
else:
|
||||||
|
for filename in os.listdir(path):
|
||||||
|
remove_folder(os.path.join(path, filename))
|
||||||
|
os.rmdir(path)
|
||||||
|
|
||||||
|
for filename in os.listdir(BuildDir):
|
||||||
|
file_path = os.path.join(BuildDir, filename)
|
||||||
|
if filename in unlinkArray:
|
||||||
|
os.remove(file_path)
|
||||||
|
|
||||||
|
for gameid in BundleConfig:
|
||||||
|
awsPath = SubgamePath + gameid + '/assets/' + BundleConfig[gameid] +'/'
|
||||||
|
subgameDir = BuildDir + 'assets\\' + BundleConfig[gameid] +'\\'
|
||||||
|
cmd = 'call aws s3 cp '+ subgameDir +' '+awsPath + ' --recursive --region ap-east-1'
|
||||||
|
result = subprocess.run(['cmd', '/c', cmd], capture_output=True, text=True)
|
||||||
|
print(result)
|
||||||
|
|
||||||
|
for gameid in BundleConfig:
|
||||||
|
awsPath = SubgamePath + gameid + '/assets/' + BundleConfig[gameid] +'/'
|
||||||
|
subgameDir = BuildDir + 'assets\\' + BundleConfig[gameid]
|
||||||
|
remove_folder(subgameDir)
|
||||||
|
|
||||||
|
for gameid in BundleConfig:
|
||||||
|
awsPath = SubgamePath + gameid + '/'
|
||||||
|
cmd = 'call aws s3 cp '+ BuildDir +' '+awsPath + ' --recursive --region ap-east-1'
|
||||||
|
result = subprocess.run(['cmd', '/c', cmd], capture_output=True, text=True)
|
||||||
|
print(result)
|
||||||
Reference in New Issue
Block a user