aboutsummaryrefslogtreecommitdiff
path: root/scripts/build
diff options
context:
space:
mode:
authorVendicated <vendicated@riseup.net>2022-10-22 23:35:30 +0200
committerVendicated <vendicated@riseup.net>2022-10-22 23:35:30 +0200
commita3b0556a9a5cba131aa7869ada5f01f210dbd1a6 (patch)
treedb6c91f9605ca72971bf4e5e92f789bb3083f394 /scripts/build
parent35d2b8d1cfaad8ff92b6a812238d62b029a217a0 (diff)
downloadVencord-a3b0556a9a5cba131aa7869ada5f01f210dbd1a6.tar.gz
Vencord-a3b0556a9a5cba131aa7869ada5f01f210dbd1a6.tar.bz2
Vencord-a3b0556a9a5cba131aa7869ada5f01f210dbd1a6.zip
buildWeb: use fflate instead of yazl
Diffstat (limited to 'scripts/build')
-rwxr-xr-xscripts/build/buildWeb.mjs32
1 files changed, 21 insertions, 11 deletions
diff --git a/scripts/build/buildWeb.mjs b/scripts/build/buildWeb.mjs
index 286aad3..4d6cf3d 100755
--- a/scripts/build/buildWeb.mjs
+++ b/scripts/build/buildWeb.mjs
@@ -18,9 +18,12 @@
*/
-import { createWriteStream, readFileSync } from "fs";
-import yazl from "yazl";
import esbuild from "esbuild";
+import { zip } from "fflate";
+import { readFileSync, writeFileSync } from "fs";
+import { readFile } from "fs/promises";
+import { join } from "path";
+
// wtf is this assert syntax
import PackageJSON from "../../package.json" assert { type: "json" };
import { commonOpts, fileIncludePlugin, gitHashPlugin, globPlugins } from "./common.mjs";
@@ -66,13 +69,20 @@ await Promise.all(
]
);
-const zip = new yazl.ZipFile();
-zip.outputStream.pipe(createWriteStream("dist/extension.zip")).on("close", () => {
- console.info("Extension written to dist/extension.zip");
-});
-
-zip.addFile("dist/browser.js", "dist/Vencord.js");
-["background.js", "content.js", "manifest.json"].forEach(f => {
- zip.addFile(`browser/${f}`, `${f}`);
+zip({
+ dist: {
+ "Vencord.js": readFileSync("dist/browser.js", "binary")
+ },
+ ...Object.fromEntries(await Promise.all(["background.js", "content.js", "manifest.json"].map(async f => [
+ f,
+ await readFile(join("browser", f), "binary")
+ ]))),
+}, {}, (err, data) => {
+ if (err) {
+ console.error(err);
+ process.exitCode = 1;
+ } else {
+ writeFileSync("dist/extension.zip", data);
+ console.info("Extension written to dist/extension.zip");
+ }
});
-zip.end();