Skip to content

Commit 3c48bf8

Browse files
committed
fix release build on Bun 1.2.22
1 parent accf764 commit 3c48bf8

3 files changed

Lines changed: 12 additions & 11 deletions

File tree

‎apps/cli/src/build.ts‎

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -124,14 +124,17 @@ const createEmbeddedWebUISource = async () => {
124124
const buildBinaries = async (targets: Target[]) => {
125125
const meta = await readMetadata();
126126
const binaries: Record<string, string> = {};
127+
const embeddedWebUIPath = join(cliRoot, "src/embedded-web-ui.gen.ts");
127128

128129
await rm(distDir, { recursive: true, force: true });
129130

130131
console.log("Generating embedded web UI bundle...");
131132
const embeddedWebUI = await createEmbeddedWebUISource();
133+
await writeFile(embeddedWebUIPath, `${embeddedWebUI}\n`);
132134
const quickJsWasmPath = resolveQuickJsWasmPath();
133135

134-
for (const target of targets) {
136+
try {
137+
for (const target of targets) {
135138
const name = targetPackageName(target);
136139
const outDir = join(distDir, name);
137140
const binDir = join(outDir, "bin");
@@ -140,11 +143,8 @@ const buildBinaries = async (targets: Target[]) => {
140143
console.log(`Building ${name}...`);
141144

142145
await Bun.build({
143-
entrypoints: [join(cliRoot, "src/main.ts"), "embedded-web-ui.gen.ts"],
146+
entrypoints: [join(cliRoot, "src/main.ts"), embeddedWebUIPath],
144147
minify: true,
145-
files: {
146-
"embedded-web-ui.gen.ts": embeddedWebUI,
147-
},
148148
compile: {
149149
target: bunTarget(target) as any,
150150
outfile: join(binDir, binaryName(target)),
@@ -181,7 +181,10 @@ const buildBinaries = async (targets: Target[]) => {
181181
binaries[name] = meta.version;
182182
}
183183

184-
return binaries;
184+
return binaries;
185+
} finally {
186+
await rm(embeddedWebUIPath, { force: true });
187+
}
185188
};
186189

187190
// ---------------------------------------------------------------------------
Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,2 @@
1-
declare module "embedded-web-ui.gen.ts" {
2-
const files: Record<string, string>;
3-
export default files;
4-
}
1+
declare const files: Record<string, string>;
2+
export default files;

‎apps/cli/src/main.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ const DEFAULT_BASE_URL = `http://localhost:${DEFAULT_PORT}`;
4141

4242
// Embedded web UI — baked into compiled binaries via `with { type: "file" }`
4343
const embeddedWebUI: Record<string, string> | null =
44-
await import("embedded-web-ui.gen.ts")
44+
await import("./embedded-web-ui.gen")
4545
.then((m) => m.default as Record<string, string>)
4646
.catch(() => null);
4747

0 commit comments

Comments
 (0)