From 7fd0da4984520102eef3021784360ad06f999a7b Mon Sep 17 00:00:00 2001 From: Anthony Ettinger Date: Tue, 13 Oct 2026 00:10:27 +0000 Subject: [PATCH] fix(install): give bun's global dir its own package.json When ${BUN_INSTALL:-$HOME/.bun}/install/global/package.json does not exist, `bun add -g` walks up from that dir and writes the dependency into the nearest package.json above it, such as a user's ~/package.json. Create an empty one first. Co-Authored-By: Claude Opus 5.5 --- public/install.sh | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/public/install.sh b/public/install.sh index caf9ec5..2aa814a 100755 --- a/public/install.sh +++ b/public/install.sh @@ -21,6 +21,11 @@ have() { command -v "$1" >/dev/null 2>&1; } say "Installing crawlproof (CrawlProof CLI)..." if have bun; then + # bun add -g writes into the nearest package.json above its global dir when + # that dir has none (e.g. ~/package.json): give it its own first. + BUN_GLOBAL="${BUN_INSTALL:-$HOME/.bun}/install/global" + mkdir -p "$BUN_GLOBAL" + [ -f "$BUN_GLOBAL/package.json" ] || printf '{}\n' > "$BUN_GLOBAL/package.json" bun add -g "$PKG@latest" BIN_DIR="${BUN_INSTALL:-$HOME/.bun}/bin" elif have npm && have node; then