-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathbundle.cjs
39 lines (30 loc) · 1.18 KB
/
bundle.cjs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
const fs = require("fs");
const archiver = require("archiver");
const success = (message) => console.log("\x1b[32m%s\x1b[0m", message); // Green color for success
const log = (message) => console.log("\x1b[36m%s\x1b[0m", message); // Cyan color for logs
const error = (message) => console.log("\x1b[31m%s\x1b[0m", message); // Red color for errors
if (fs.existsSync("resources")) {
fs.rmSync("resources", { recursive: true });
log("Deleted resources folder");
}
fs.mkdirSync("resources/assets/liquidbounce", { recursive: true });
// Create a zip archive
const output = fs.createWriteStream("resources/assets/liquidbounce/default_theme.zip");
const archive = archiver("zip", {});
output.on("close", () => {
success("Successfully created theme bundle");
log("\n=> Done\n====================\n");
});
archive.on("error", (e) => {
error(e);
});
archive.pipe(output);
log("=> Creating theme bundle\n====================\n");
if (fs.existsSync("./dist")) {
// Add contents of the public folder to the zip archive
archive.directory("./dist", ".");
log(`Added public folder to theme bundle`);
} else {
error(`Theme does not contain a public folder`);
}
archive.finalize();