diff --git a/zip.js b/zip.js index 293df4c..b479099 100644 --- a/zip.js +++ b/zip.js @@ -1,6 +1,7 @@ const fs = require("fs"); const path = require('path'); const JSZip = require("jszip"); +const { log } = require("console"); const folderPath = "./configs" const start = () => { const files = fs.readdirSync(folderPath); @@ -11,11 +12,9 @@ const start = () => { // 并行读取所有的 JSON 文件内容 const combinedJson = {} const jsonContents = jsonFiles.forEach(file => { - const fileData = fs.readFileSync(path.join(folderPath, file), 'utf8') + const fileData = JSON.parse(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 => {