Skip to content

Commit

Permalink
feat: fit 13KB limit!
Browse files Browse the repository at this point in the history
closes #54
  • Loading branch information
karjona authored Sep 12, 2022
2 parents feabcc1 + 4b37bff commit 6ede83a
Show file tree
Hide file tree
Showing 22 changed files with 2,226 additions and 6,136 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -125,3 +125,6 @@ dist
.yarn/build-state.yml
.yarn/install-state.gz
.pnp.*

# zipped release
reapers.zip
30 changes: 30 additions & 0 deletions build/Compress.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
// @ts-nocheck
import zip from "bestzip";
import crossExecFile from "cross-exec-file";
import efficientCompressionTool from "ect-bin";
import { existsSync, unlinkSync, statSync } from "fs";
import { resolve } from "path";

async function Compress() {
const distPath = resolve(__dirname, "..", "dist");
const zipPath = resolve(__dirname, "..", "reapers.zip");

if (existsSync(zipPath)) {
unlinkSync(zipPath);
}

await zip({
cwd: distPath,
source: "index.html",
destination: zipPath,
});

await crossExecFile(efficientCompressionTool, ["-9", "-zip", zipPath]);

const size = statSync(zipPath).size;
const zipEmoji = size > 13 * 1024 ? "😰" : "🎉";

console.log(`\n${zipEmoji} Compressed size: ${size} bytes`);
}

Compress();
Loading

0 comments on commit 6ede83a

Please sign in to comment.