feat(build): 支持桌面端多架构打包矩阵

This commit is contained in:
2026-02-15 23:26:00 +08:00
parent 627e6f9dd3
commit 8245abe217
6 changed files with 72 additions and 14 deletions

View File

@@ -1,4 +1,4 @@
import { rm } from 'node:fs/promises'
import { mkdir, rm } from 'node:fs/promises'
import { parseArgs } from 'node:util'
const ENTRYPOINT = '.output/server/index.mjs'
@@ -7,6 +7,7 @@ const OUTDIR = 'out'
const SUPPORTED_TARGETS: readonly Bun.Build.CompileTarget[] = [
'bun-windows-x64',
'bun-darwin-arm64',
'bun-darwin-x64',
'bun-linux-x64',
'bun-linux-arm64',
]
@@ -43,7 +44,11 @@ const main = async () => {
const suffix = target.replace('bun-', '')
const outfile = `server-${suffix}`
await rm(OUTDIR, { recursive: true, force: true })
await mkdir(OUTDIR, { recursive: true })
await Promise.all([
rm(`${OUTDIR}/${outfile}`, { force: true }),
rm(`${OUTDIR}/${outfile}.exe`, { force: true }),
])
const result = await Bun.build({
entrypoints: [ENTRYPOINT],