Skip to content

Commit 837dd6e

Browse files
committed
Fetch every cross-compile target's OpenTUI native package before building
An install only lands the host platform's optional package, so the release build could compile the host binary and nothing else.
1 parent 0981a50 commit 837dd6e

1 file changed

Lines changed: 24 additions & 0 deletions

File tree

scripts/release.sh

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -196,12 +196,36 @@ EOF
196196
rm -rf "$wd"
197197
}
198198

199+
# The OpenTUI renderer ships its native core as one optional package per
200+
# platform, and an install only ever lands the host's own. A cross-compile for
201+
# any other target then fails to resolve it, so every target's package is
202+
# fetched straight from the registry into node_modules before the build.
203+
# Nothing is written to package.json: these are already declared there as
204+
# optionalDependencies, and this only makes the ones bun skipped present.
205+
fetch_native_modules() {
206+
local version platform pkg dir url
207+
version=$(jq -r '.optionalDependencies["@opentui/core-darwin-arm64"] // empty' package.json)
208+
[ -n "$version" ] || die "no @opentui/core-* version in package.json optionalDependencies"
209+
for entry in "${TARGETS[@]}"; do
210+
IFS='|' read -r _label bun_target _kind _deb <<< "$entry"
211+
platform=${bun_target#bun-}
212+
pkg="core-$platform"
213+
dir="node_modules/@opentui/$pkg"
214+
[ -d "$dir" ] && continue
215+
url="https://registry.npmjs.org/@opentui/$pkg/-/$pkg-$version.tgz"
216+
info "fetching @opentui/$pkg@$version (cross-compile target)"
217+
mkdir -p "$dir"
218+
curl -fsSL "$url" | tar -xz -C "$dir" --strip-components=1 || die "could not fetch @opentui/$pkg@$version from the registry"
219+
done
220+
}
221+
199222
# ---- preflight -------------------------------------------------------------
200223
step "Preflight for $TAG"
201224
for t in git gh bun jq ar tar shasum; do command -v "$t" >/dev/null || die "missing tool: $t"; done
202225
gh auth status >/dev/null 2>&1 || die "gh is not authenticated (run: gh auth login)"
203226
info "installing dependencies (bun install)"
204227
bun install >/dev/null 2>&1 || die "bun install failed"
228+
fetch_native_modules
205229
if [ "$SKIP_TAP" != 1 ]; then
206230
TAP_DIR=$(brew --repository "$TAP_SLUG" 2>/dev/null) || die "brew not found; use --skip-tap"
207231
if [ ! -d "$TAP_DIR/.git" ]; then

0 commit comments

Comments
 (0)