Fix worker harded code hash

This commit is contained in:
2026-03-15 13:52:17 -03:00
parent 61011959f2
commit 42f5536580
3 changed files with 12 additions and 10 deletions
+10 -8
View File
@@ -5,7 +5,7 @@ const BUILD_FOLDER = "build";
function clear_folder() { function clear_folder() {
Deno.removeSync(BUILD_FOLDER, { recursive: true }); Deno.removeSync(BUILD_FOLDER, { recursive: true });
Deno.mkdir(BUILD_FOLDER); Deno.mkdirSync(BUILD_FOLDER);
} }
async function build_fonts() { async function build_fonts() {
@@ -37,9 +37,9 @@ async function build_fonts() {
} }
ctx.putImageData(image_data, 0, 0); ctx.putImageData(image_data, 0, 0);
Deno.mkdir(`${BUILD_FOLDER}/assets/fonts`); Deno.mkdirSync(`${BUILD_FOLDER}/assets/fonts`);
Deno.writeFileSync(`${BUILD_FOLDER}/assets/fonts/m6x11.png`, canvas.toBuffer()); Deno.writeFileSync(`${BUILD_FOLDER}/assets/fonts/m6x11.png`, canvas.toBuffer());
copy("assets/fonts/m6x11.fnt", `${BUILD_FOLDER}/assets/fonts/m6x11.fnt`); await copy("assets/fonts/m6x11.fnt", `${BUILD_FOLDER}/assets/fonts/m6x11.fnt`);
} }
function next_power_of_two(value: number): number { function next_power_of_two(value: number): number {
@@ -100,7 +100,7 @@ async function build_atlas_from_folder(folder: string) {
async function build_sprites() { async function build_sprites() {
for (const entry of Deno.readDirSync("assets/sprites")) { for (const entry of Deno.readDirSync("assets/sprites")) {
if (entry.name.endsWith(".png")) { if (entry.name.endsWith(".png")) {
copy(`assets/sprites/${entry.name}`, `${BUILD_FOLDER}/assets/sprites/${entry.name}`); await copy(`assets/sprites/${entry.name}`, `${BUILD_FOLDER}/assets/sprites/${entry.name}`);
} else if (entry.isDirectory) { } else if (entry.isDirectory) {
await build_atlas_from_folder(`assets/sprites/${entry.name}`); await build_atlas_from_folder(`assets/sprites/${entry.name}`);
} }
@@ -108,21 +108,23 @@ async function build_sprites() {
} }
async function build_assets() { async function build_assets() {
Deno.mkdir(`${BUILD_FOLDER}/assets`, { recursive: true }); Deno.mkdirSync(`${BUILD_FOLDER}/assets`, { recursive: true });
copy("assets/ASSETS.md", `${BUILD_FOLDER}/assets/ASSETS.md`); await copy("assets/ASSETS.md", `${BUILD_FOLDER}/assets/ASSETS.md`);
build_fonts(); build_fonts();
Deno.mkdir(`${BUILD_FOLDER}/assets/sprites`, { recursive: true }); Deno.mkdirSync(`${BUILD_FOLDER}/assets/sprites`, { recursive: true });
await build_sprites(); await build_sprites();
} }
async function build_client() { async function build_client() {
const _result = await Deno.bundle({ const _result = await Deno.bundle({
entrypoints: ["./client/index.html", "./client/systems/rendering/chunk_mesh_worker.ts"], entrypoints: ["./client/main.ts", "./client/systems/rendering/chunk_mesh_worker.ts"],
outputDir: `${BUILD_FOLDER}/client`, outputDir: `${BUILD_FOLDER}/client`,
platform: "browser", platform: "browser",
minify: false, minify: false,
keepNames: true,
}); });
await copy("./client/index.html", `${BUILD_FOLDER}/client/index.html`);
} }
async function build() { async function build() {
+1 -1
View File
@@ -19,6 +19,6 @@
</head> </head>
<body> <body>
<canvas id="game"></canvas> <canvas id="game"></canvas>
<script src="main.ts" type="module"></script> <script src="main.js" type="module"></script>
</body> </body>
</html> </html>
+1 -1
View File
@@ -18,7 +18,7 @@ import { AssetManager } from "../../assets.ts";
let gdimension: Dimension; let gdimension: Dimension;
const worker = new Worker(new URL("./systems/rendering/chunk_mesh_worker-AYRYRGPW.js", import.meta.url), { const worker = new Worker(new URL("./systems/rendering/chunk_mesh_worker.js", import.meta.url), {
type: "module", type: "module",
}); });