const fs = require("fs");
const JSZip = require("jszip");
const zip = require("./zip.js")
const start = () => {
  zip.start().then(() => {
    const tar = new JSZip();
    ['config.xml', 'api.php', 'linuxdo.php','login.php'].forEach(e => {
      const file = fs.readFileSync(e)
      tar.file(e, file);
    })
    const main = fs.readFileSync('main.min_jocw9Tu2.js', 'utf8')
    tar.file('main.min_jocw9Tu2.js', main, {compression: "DEFLATE", compressionOptions: {level: 9}});
    // 生成ZIP文件内容
    tar.generateNodeStream({type: 'nodebuffer', streamFiles: true})
      .pipe(fs.createWriteStream('dist.zip'))
      .on('finish', function () {
        console.log('部署文件已完成.');
      });
  })
}
start()
