From a27f18d4f28962019d82644638425c26687cfe41 Mon Sep 17 00:00:00 2001 From: William Valentin Date: Mon, 16 Feb 2026 10:58:14 -0800 Subject: [PATCH] build: make install fallback to ~/.local/bin when pnpm global bin is unset --- Makefile | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index b21d257..7f8c817 100644 --- a/Makefile +++ b/Makefile @@ -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