Files
nanobot/tui/scripts/prepare-target.ts
T
chengyongruandXubin Ren ae7fed88e2 perf(tui): shrink standalone builds and target native bindings (#6432)
* perf(tui): shrink standalone builds without dropping features

* fix(tui): resolve macOS diagram fonts through CoreText

* fix(webui): preserve history pagination at the page boundary

* docs(tui): streamline release preflight guidance

---------

Co-authored-by: Xubin Ren <52506698+Re-bin@users.noreply.github.com>
2026-10-24 22:00:50 +08:00

36 lines
1.1 KiB
TypeScript

import { join } from "node:path"
import { nativePackages, targetPlan } from "./targets"
const target = process.argv[2]
if (!target) throw new Error("target is required")
const packages = nativePackages(targetPlan(target))
const root = join(import.meta.dir, "..")
const manifest = await Bun.file(join(root, "package.json")).json()
const versions: Record<string, string> = {}
for (const name of ["@opentui/core", "@resvg/resvg-js"]) {
const version = manifest.dependencies?.[name]
if (typeof version !== "string" || !/^\d+\.\d+\.\d+$/.test(version)) throw new Error(`${name} must use an exact version`)
versions[name] = version
}
const npm = process.platform === "win32" ? "npm.cmd" : "npm"
const result = Bun.spawnSync(
[
npm,
"install",
"--no-save",
"--ignore-scripts",
"--force",
"--package-lock=false",
...packages.map((name) => `${name}@${versions[name.startsWith("@opentui/") ? "@opentui/core" : "@resvg/resvg-js"]}`),
],
{
cwd: root,
stdout: "inherit",
stderr: "inherit",
},
)
if (result.exitCode !== 0) process.exit(result.exitCode)