fix(build): warn when compiled 'browse' CLI binary is missing

build-node-server.sh only produces server-node.mjs (the Node.js server
bundle). The runnable 'browse' executable is a *compiled* artifact from
scripts/build.sh (bun build --compile) and is gitignored, so a bare
'rm -rf browse/dist' can leave a valid server bundle with no CLI binary.
Add a Step 5 that detects the missing binary and prints remediation
instead of failing later with a cryptic ENOENT.
This commit is contained in:
Spooks444 2026-07-14 07:31:35 -05:00
parent f56f36d083
commit 9abf03631f
1 changed files with 20 additions and 0 deletions

View File

@ -66,4 +66,24 @@ rm -f "$RAW"
# Step 4: copy polyfill to dist/
cp "$SRC_DIR/bun-polyfill.cjs" "$DIST_DIR/bun-polyfill.cjs"
# Step 5: guard — this script only builds the Node.js server bundle. The
# runnable `browse` CLI binary (plus find-browse/design/pdf) are *compiled*
# artifacts produced by scripts/build.sh (bun build --compile ...). They are
# gitignored and deleted by a bare `rm -rf browse/dist`, so a standalone run
# of this script can leave a working server-node.mjs with no `browse` binary.
# Warn clearly instead of letting the next `./browse/dist/browse` fail with a
# cryptic ENOENT.
BROWSE_BIN=""
for _cand in "$DIST_DIR/browse" "$DIST_DIR/browse.exe"; do
[ -f "$_cand" ] && BROWSE_BIN="$_cand" && break
done
if [ -z "$BROWSE_BIN" ]; then
echo "WARNING: compiled CLI binary 'browse' is missing from $DIST_DIR." >&2
echo " This script only produces server-node.mjs (the Node.js server" >&2
echo " bundle). To build the runnable 'browse' executable, run:" >&2
echo " bash scripts/build.sh" >&2
echo " or compile it directly:" >&2
echo " bun build --compile browse/src/cli.ts --outfile browse/dist/browse" >&2
fi
echo "Node server bundle ready: $FINAL"