Fix bake codegen on windows (#17654)

This commit is contained in:
pfg
2025-02-24 19:57:35 -08:00
committed by GitHub
parent 032f99285c
commit a8c8fa15b9
3 changed files with 13 additions and 14 deletions

View File

@@ -30,6 +30,16 @@ function convertZigEnum(zig: string, names: string[]) {
return output;
}
function css(file: string, is_development: boolean): string {
const { success, stdout, stderr } = Bun.spawnSync({
cmd: [process.execPath, "build", file, "--minify"],
cwd: import.meta.dir,
stdio: ["ignore", "pipe", "pipe"],
});
if (!success) throw new Error(stderr.toString("utf-8"));
return stdout.toString("utf-8");
}
async function run() {
const devServerZig = readFileSync(join(base_dir, "DevServer.zig"), "utf-8");
writeIfNotChanged(join(base_dir, "generated.ts"), convertZigEnum(devServerZig, ["IncomingMessageId", "MessageId"]));
@@ -43,6 +53,7 @@ async function run() {
side: JSON.stringify(side),
IS_ERROR_RUNTIME: String(file === "error"),
IS_BUN_DEVELOPMENT: String(!!debug),
OVERLAY_CSS: css("../bake/client/overlay.css", !!debug),
},
minify: {
syntax: !debug,