Binato/tooling/mangle.ts
2023-09-10 20:37:46 +01:00

17 lines
No EOL
469 B
TypeScript

import { readFileSync, writeFileSync } from "fs";
import { minify } from "terser";
const DISABLE = false;
if (DISABLE) {
writeFileSync("./build/Binato.min.js", readFileSync("./build/combined.js"));
console.warn("[WARNING] mangle.ts is disabled!");
} else {
(async () => {
const mangled = await minify(readFileSync("./build/combined.js").toString(), {
mangle: true,
toplevel: true,
});
writeFileSync("./build/Binato.min.js", `${mangled.code}`);
})();
}