Skip to content

Commit 9abf036

Browse files
committed
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.
1 parent f56f36d commit 9abf036

1 file changed

Lines changed: 20 additions & 0 deletions

File tree

browse/scripts/build-node-server.sh

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,4 +66,24 @@ rm -f "$RAW"
6666
# Step 4: copy polyfill to dist/
6767
cp "$SRC_DIR/bun-polyfill.cjs" "$DIST_DIR/bun-polyfill.cjs"
6868

69+
# Step 5: guard — this script only builds the Node.js server bundle. The
70+
# runnable `browse` CLI binary (plus find-browse/design/pdf) are *compiled*
71+
# artifacts produced by scripts/build.sh (bun build --compile ...). They are
72+
# gitignored and deleted by a bare `rm -rf browse/dist`, so a standalone run
73+
# of this script can leave a working server-node.mjs with no `browse` binary.
74+
# Warn clearly instead of letting the next `./browse/dist/browse` fail with a
75+
# cryptic ENOENT.
76+
BROWSE_BIN=""
77+
for _cand in "$DIST_DIR/browse" "$DIST_DIR/browse.exe"; do
78+
[ -f "$_cand" ] && BROWSE_BIN="$_cand" && break
79+
done
80+
if [ -z "$BROWSE_BIN" ]; then
81+
echo "WARNING: compiled CLI binary 'browse' is missing from $DIST_DIR." >&2
82+
echo " This script only produces server-node.mjs (the Node.js server" >&2
83+
echo " bundle). To build the runnable 'browse' executable, run:" >&2
84+
echo " bash scripts/build.sh" >&2
85+
echo " or compile it directly:" >&2
86+
echo " bun build --compile browse/src/cli.ts --outfile browse/dist/browse" >&2
87+
fi
88+
6989
echo "Node server bundle ready: $FINAL"

0 commit comments

Comments
 (0)