build w/ bun to avoid internal deps hell
This commit is contained in:
parent
69c814dae2
commit
7d38af9bbb
1 changed files with 59 additions and 71 deletions
27
build.bun.ts
Normal file
27
build.bun.ts
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
#!/usr/bin/env bun
|
||||
import { $ } from "bun";
|
||||
|
||||
// Run TypeScript compiler for type declarations
|
||||
await $`tsc`;
|
||||
|
||||
const isDevelopment = Bun.env.NODE_ENV === "development";
|
||||
|
||||
// Build all JavaScript/TypeScript files
|
||||
function buildJs(entrypoint: string, opts: Record<string, string> = {}) {
|
||||
return Bun.build({
|
||||
entrypoints: [entrypoint],
|
||||
outdir: "dist",
|
||||
target: "browser",
|
||||
minify: !isDevelopment,
|
||||
...(isDevelopment ? {
|
||||
sourcemap: "inline",
|
||||
} : {}),
|
||||
...opts
|
||||
})
|
||||
}
|
||||
|
||||
await Promise.all([
|
||||
buildJs("src/app.ts", { outdir: "dist/src" }),
|
||||
buildJs("src/app-bridge.ts", { outdir: "dist/src" }),
|
||||
buildJs("src/react/index.tsx", { outdir: "dist/src/react" }),
|
||||
])
|
||||
Loading…
Reference in a new issue