feat(showcase): 트웬티온스 사이트를 전면 개편한다
All checks were successful
ci / build (push) Successful in 33s

This commit is contained in:
Yun Chan 2026-08-25 03:50:28 +09:00
parent cb3c323c9f
commit 9529e3747c
29 changed files with 8906 additions and 1326 deletions

View file

@ -0,0 +1,48 @@
import { build } from "esbuild";
import fs from "node:fs";
import path from "node:path";
import url from "node:url";
import zlib from "node:zlib";
const here = path.dirname(url.fileURLToPath(import.meta.url));
const root = path.resolve(here, "..");
const entry = path.join(root, "src", "showcases", "twentyoz-core.js");
const outDir = path.join(root, "public", "work", "twentyoz-corp", "assets");
const outputFile = path.join(outDir, "core.iife.js");
const check = process.argv.includes("--check");
const result = await build({
absWorkingDir: root,
entryPoints: [entry],
outfile: outputFile,
bundle: true,
platform: "browser",
format: "iife",
globalName: "TwentyozCore",
target: ["es2020"],
minify: true,
treeShaking: true,
legalComments: "eof",
sourcemap: false,
write: false,
});
const output = result.outputFiles?.find((item) => path.resolve(item.path) === path.resolve(outputFile));
if (!output) throw new Error("twentyoz core bundle output not found");
const generated = Buffer.from(output.contents);
const gzipBytes = zlib.gzipSync(generated, { level: 9 }).byteLength;
const maxGzipBytes = 200 * 1024;
if (gzipBytes > maxGzipBytes) {
throw new Error(`twentyoz WebGL bundle ${gzipBytes}B gzip exceeds ${maxGzipBytes}B budget`);
}
if (check) {
if (!fs.existsSync(outputFile)) throw new Error("twentyoz core bundle is missing; run npm run build:showcase-assets");
const current = fs.readFileSync(outputFile);
if (!current.equals(generated)) throw new Error("twentyoz core bundle is stale; run npm run build:showcase-assets");
} else {
fs.mkdirSync(outDir, { recursive: true });
fs.writeFileSync(outputFile, generated);
}
console.log(`twentyoz core ${generated.byteLength}B raw · ${gzipBytes}B gzip · budget ${maxGzipBytes}B`);