feat(config): 添加跨服活动配置文件

- 新增 ACTcrossServerTabCfg.json 配置文件,定义了多种跨服活动的属性
- 在 .gitignore 文件中添加了 package-lock.json、node_modules 和 config.xml
This commit is contained in:
aixianling
2024-12-19 12:02:43 +08:00
commit 9f9f874610
246 changed files with 316 additions and 0 deletions

34
zip.js Normal file
View File

@@ -0,0 +1,34 @@
const fs = require("fs");
const path = require('path');
const JSZip = require("jszip");
const folderPath = "./configs"
const start = () => {
const files = fs.readdirSync(folderPath);
// 过滤出所有的 JSON 文件
const jsonFiles = files.filter(file => path.extname(file) === '.json');
// 并行读取所有的 JSON 文件内容
const combinedJson = {}
const jsonContents = jsonFiles.forEach(file => {
const fileData = fs.readFileSync(path.join(folderPath, file), 'utf8')
combinedJson[path.basename(file, '.json')] = fileData
});
// 将所有 JSON 文件的内容压缩为config.xml
compress(JSON.stringify(combinedJson, null, 2))
}
const compress = json => {
const zip = new JSZip();
// 将JSON文件内容添加到ZIP实例中
zip.file('config.json', json, { compression: "DEFLATE", compressionOptions: { level: 9 } });
// 生成ZIP文件内容
zip.generateNodeStream({ type: 'nodebuffer', streamFiles: true })
.pipe(fs.createWriteStream('config.xml'))
.on('finish', function () {
console.log('ZIP file created.');
});
}
start()