build: make install fallback to ~/.local/bin when pnpm global bin is unset

This commit is contained in:
William Valentin
2026-02-16 10:58:14 -08:00
parent 91282a9c47
commit a27f18d4f2
+14 -3
View File
@@ -106,11 +106,22 @@ check: lint typecheck test-run ## Run all checks (lint, typecheck, test)
deps: ## Install dependencies
pnpm install
install: ## Install flynn CLI as a shell command (build + global link)
install: ## Install flynn CLI as a shell command (global link or ~/.local/bin fallback)
pnpm install
pnpm build
pnpm link --global
@echo "flynn installed. If the command is not found, add PNPM_HOME to your PATH."
@set -e; \
if pnpm link --global; then \
echo "flynn installed via pnpm global link."; \
else \
echo "pnpm global bin is not configured; installing fallback shim at $$HOME/.local/bin/flynn"; \
mkdir -p "$$HOME/.local/bin"; \
chmod +x "$(CURDIR)/dist/cli/index.js"; \
ln -sf "$(CURDIR)/dist/cli/index.js" "$$HOME/.local/bin/flynn"; \
case ":$$PATH:" in \
*":$$HOME/.local/bin:"*) echo "flynn installed at $$HOME/.local/bin/flynn";; \
*) echo "flynn installed at $$HOME/.local/bin/flynn (add $$HOME/.local/bin to PATH)";; \
esac; \
fi
# Utilities
help: ## Show this help message