Something went wrong. Try again.
opencode v2 mirror
Something went wrong. Try again.
TypeScript
1234567891011121314151617181920212223242526272829303132333435363738394041424344#!/usr/bin/env bun
import { $ } from "bun"import { rm } from "node:fs/promises"import path from "node:path"import { fileURLToPath } from "node:url"
process.chdir(fileURLToPath(new URL("..", import.meta.url)))
await rm("dist", { recursive: true, force: true })await $`bun tsc -p tsconfig.build.json`
const root = path.resolve("src")const files = await Array.fromAsync(new Bun.Glob("**/*.ts").scan({ cwd: root, absolute: true }))const result = await Bun.build({ entrypoints: files.filter((file) => !file.endsWith(".d.ts")), root, outdir: "dist", target: "node", format: "esm", packages: "external", external: [ "#sqlite", "#pty", "#persistent-pty-binary", "#fff", "#photon-wasm", "#shell-parser-wasm", "#process-lock-ffi", "#v1-migration", ], splitting: true, loader: { ".txt": "text", ".md": "text", }, naming: { entry: "[dir]/[name].[ext]", chunk: "chunks/[name]-[hash].[ext]", asset: "assets/[name]-[hash].[ext]", },})if (!result.success) throw new AggregateError(result.logs, "Failed to build Core")