feat: save index.android.bundle (hbc) to data branch root

This commit is contained in:
user 2026-07-20 15:04:11 -03:00
parent 4370a68dce
commit cadefac038

View file

@ -4,6 +4,8 @@ import type { Progress } from "../progress";
import { codePath, commitAnyway, cuteVersion, modulePathsDest, modulesPath, workFolder } from "../shared"; import { codePath, commitAnyway, cuteVersion, modulePathsDest, modulesPath, workFolder } from "../shared";
import { handleShellErr, join } from "../utils"; import { handleShellErr, join } from "../utils";
const bundleDest = join("..", "data", "index.android.bundle");
const gzipWorkerURL = new URL("decompile-gzip.ts", import.meta.url).href; const gzipWorkerURL = new URL("decompile-gzip.ts", import.meta.url).href;
export default async function decompile(progress: Progress, pathToBundle: string) { export default async function decompile(progress: Progress, pathToBundle: string) {
@ -64,11 +66,13 @@ export default async function decompile(progress: Progress, pathToBundle: string
if (process.env.NODE_ENV !== "test" && !commitAnyway) { if (process.env.NODE_ENV !== "test" && !commitAnyway) {
const gzFile = "code.js.gz"; const gzFile = "code.js.gz";
await Bun.write(bundleDest, Bun.file(pathToBundle));
const gzipper = new Worker(gzipWorkerURL); const gzipper = new Worker(gzipWorkerURL);
progress.start("decompile_gzip"); progress.start("decompile_gzip");
gzipper.addEventListener("message", async ({ data }) => { gzipper.addEventListener("message", async ({ data }) => {
if (data === true) { if (data === true) {
await commit([gzFile, "module-paths.json"], `chore: update decompiled code for ${cuteVersion}`); await commit([gzFile, "module-paths.json", "index.android.bundle"], `chore: update decompiled code for ${cuteVersion}`);
progress.update("decompile_gzip", true); progress.update("decompile_gzip", true);
} }
gzipper.terminate(); gzipper.terminate();