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
30
build.esbuild.ts
Normal file
30
build.esbuild.ts
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
#!/usr/bin/env tsx
|
||||
import { execSync } from "child_process";
|
||||
import * as esbuild from "esbuild";
|
||||
|
||||
// Run TypeScript compiler for type declarations
|
||||
execSync("tsc", { stdio: "inherit" });
|
||||
|
||||
const isDevelopment = process.env.NODE_ENV === "development";
|
||||
|
||||
// Build all JavaScript/TypeScript files
|
||||
async function buildJs(
|
||||
entrypoint: string,
|
||||
opts: { outdir?: string; target?: "browser" | "node" } = {},
|
||||
) {
|
||||
return esbuild.build({
|
||||
entryPoints: [entrypoint],
|
||||
outdir: opts.outdir ?? "dist",
|
||||
platform: opts.target === "node" ? "node" : "browser",
|
||||
format: "esm",
|
||||
bundle: true,
|
||||
minify: !isDevelopment,
|
||||
sourcemap: isDevelopment ? "inline" : false,
|
||||
});
|
||||
}
|
||||
|
||||
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