-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathbuild.tui.mjs
More file actions
22 lines (20 loc) · 880 Bytes
/
Copy pathbuild.tui.mjs
File metadata and controls
22 lines (20 loc) · 880 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
import * as esbuild from "esbuild"
import { existsSync, readFileSync, writeFileSync } from "fs"
import { resolve } from "path"
import { solidPlugin } from "esbuild-plugin-solid"
// Generate src/_version.ts when missing (not tracked in git; generated by
// the "version" npm script on release). Without it the bundle build fails.
const versionFile = resolve("src/_version.ts")
if (!existsSync(versionFile)) {
const pkg = JSON.parse(readFileSync("package.json", "utf-8"))
writeFileSync(versionFile, `// auto-generated\nexport const PLUGIN_VERSION=${JSON.stringify(pkg.version)};\n`)
}
await esbuild.build({
entryPoints: ["src/index.tsx"],
outfile: "dist/tui.js",
format: "esm",
platform: "node",
bundle: true,
external: ["@opencode-ai/*", "@opentui/*", "solid-js"],
plugins: [solidPlugin({ solid: { moduleName: "@opentui/solid", generate: "universal" } })],
})