build(scripts): add bun compile scripts for linux and windows binaries

Wrap bun build --compile to produce self-contained executables for linux-x64 (glibc/musl) and windows-x64, each in modern (AVX2) and baseline (SSE2) variants. The build:binary:* aliases run the existing build pipeline first so dist/cli.js post-processing (feature flags, import.meta.require) stays in effect.

Signed-off-by: 林凯90331 <90331@sangfor.com>

Co-authored-by: CoStrict <zgsm@sangfor.com.cn>
This commit is contained in:
林凯90331 2026-05-11 17:46:44 +08:00
parent dbef683bb2
commit 5515699125

View File

@ -44,6 +44,19 @@
"build:vite": "vite build && bun run scripts/post-build.ts",
"build:vite:only": "vite build",
"build:bun": "bun run build.ts",
"build:binary:linux": "bun run build && bun run compile:linux",
"build:binary:linux-baseline": "bun run build && bun run compile:linux-baseline",
"build:binary:linux-musl": "bun run build && bun run compile:linux-musl",
"build:binary:linux-musl-baseline": "bun run build && bun run compile:linux-musl-baseline",
"build:binary:win": "bun run build && bun run compile:win",
"build:binary:win-baseline": "bun run build && bun run compile:win-baseline",
"build:binary:all": "bun run build && bun run compile:linux && bun run compile:linux-baseline && bun run compile:linux-musl && bun run compile:linux-musl-baseline && bun run compile:win && bun run compile:win-baseline",
"compile:linux": "bun build dist/cli.js --compile --target=bun-linux-x64 --outfile dist/csc-linux-x64",
"compile:linux-baseline": "bun build dist/cli.js --compile --target=bun-linux-x64-baseline --outfile dist/csc-linux-x64-baseline",
"compile:linux-musl": "bun build dist/cli.js --compile --target=bun-linux-x64-musl --outfile dist/csc-linux-x64-musl",
"compile:linux-musl-baseline": "bun build dist/cli.js --compile --target=bun-linux-x64-musl-baseline --outfile dist/csc-linux-x64-musl-baseline",
"compile:win": "bun build dist/cli.js --compile --target=bun-windows-x64 --outfile dist/csc-windows-x64.exe",
"compile:win-baseline": "bun build dist/cli.js --compile --target=bun-windows-x64-baseline --outfile dist/csc-windows-x64-baseline.exe",
"dev": "bun run scripts/dev.ts",
"dev:inspect": "bun run scripts/dev-debug.ts",
"prepublishOnly": "bun run build",