This commit is contained in:
Paul-Henri Froidmont 2026-01-13 13:55:05 +01:00
parent 6007651e0a
commit 8ae17f0ef0
Signed by: phfroidmont
GPG key ID: BE948AFD7E7873BE
7 changed files with 370 additions and 5 deletions

38
packages/mia/bundle.ts Normal file
View file

@ -0,0 +1,38 @@
#!/usr/bin/env bun
import solidPlugin from "./node_modules/@opentui/solid/scripts/solid-plugin"
import fs from "fs"
const version = process.env.OPENCODE_VERSION!
const channel = process.env.OPENCODE_CHANNEL!
const result = await Bun.build({
target: "bun",
outdir: "./dist",
entrypoints: [
"./src/index.ts",
"./src/cli/cmd/tui/worker.ts"
],
plugins: [solidPlugin],
naming: {
entry: "[dir]/[name].js"
},
define: {
OPENCODE_VERSION: JSON.stringify(version),
OPENCODE_CHANNEL: JSON.stringify(channel),
},
external: [
"@opentui/core-*",
],
})
if (!result.success) {
console.error("Bundle failed:", result.logs)
process.exit(1)
}
// Move worker file to worker.ts at the dist root so the code can find it
if (fs.existsSync("./dist/cli/cmd/tui/worker.js")) {
fs.renameSync("./dist/cli/cmd/tui/worker.js", "./dist/worker.ts")
fs.rmdirSync("./dist/cli/cmd/tui", { recursive: true })
}