const fs = require("fs") const path = require("path") const archiver = require("archiver") const output = fs.createWriteStream(path.resolve(__dirname, "../release_v0.1.zip")) const archive = archiver("zip", { zlib: { level: 9 }, }) output.on("close", function () { console.log(archive.pointer() + " total bytes") console.log("archiver has been finalized and the output file descriptor has closed.") }) output.on("end", function () { console.log("Data has been drained") }) archive.on("warning", function (err) { if (err.code === "ENOENT") { } else { throw err } }) archive.on("error", function (err) { throw err }) archive.on("progress", function (progress) { // const percent = progress.fs.processedBytes / totalSize * 100; // let percent = // progress.entries.total > 0 ? Math.round((progress.entries.processed * 100.0) / progress.entries.total) : -1 // console.log("TOTAL", progress.entries.total, "PROCESSED", progress.entries.processed, "|", percent, "%") const percent = Math.round(progress.entries.processed * 100.0 / progress.entries.total); console.log(`\rZipping: ${percent.toFixed(2)}%`); }) archive.pipe(output) archive.directory("node_modules/") archive.directory("dist/") archive.directory("template/") archive.directory("patches/") archive.directory("public/") archive.file(".env.production") archive.file("package.json") archive.file("pnpm-lock.yaml") archive.finalize()