fix(release): read workspace versions safely with Bun

This commit is contained in:
root committed 2026-10-13 14:38:04 +08:00
1 parent 7639c115de
commit 86351f20f3
1 file changed
+2 -2
+2 -2
View File
@@ -28,7 +28,7 @@ die() { echo "✗ $*" >&2; exit 1; }
version=$(bun -e 'console.log(JSON.parse(require("node:fs").readFileSync("package.json")).version)')
tag="v$version"
for f in apps/*/package.json packages/*/package.json; do
v=$(bun -e "console.log(JSON.parse(require("node:fs").readFileSync('$f')).version ?? '')")
v=$(bun -e 'console.log(JSON.parse(require("node:fs").readFileSync(process.argv[1])).version ?? "")' "$f")
[ -z "$v" ] || [ "$v" = "$version" ] || die "$f 版本 $v 与根 package.json $version 不一致"
done
grep -q "^## \[$version\]" CHANGELOG.md || die "CHANGELOG.md 还没有 ## [$version] 条目"
@@ -63,7 +63,7 @@ set_env SOURCE_REVISION "$head"
if [ $BUILD -eq 1 ]; then
echo "▶ 构建 uhd-media-tool:$tag"
# 构建阶段要下载 Deno 运行时等外网资源;.env.deploy 配了 BUILD_PROXY 时经它构建(直连可能卡住,见 lessons #30)
# 构建阶段要下载 Bun 运行时等外网资源;.env.deploy 配了 BUILD_PROXY 时经它构建(直连可能卡住,见 lessons #30)
build_proxy=$(sed -n 's/^BUILD_PROXY=//p' "$ENV_FILE" | tail -1)
if [ -n "$build_proxy" ]; then
compose build --build-arg HTTPS_PROXY="$build_proxy" --build-arg HTTP_PROXY="$build_proxy" \