diff --git a/src/dashboard.ts b/src/dashboard.ts index 1e1fd79..b8759b4 100644 --- a/src/dashboard.ts +++ b/src/dashboard.ts @@ -184,11 +184,20 @@ if [ "$major" -lt 22 ]; then echo "submitfleet needs Node.js 22.5 or newer (found $(node -v))" >&2 exit 1 fi -if command -v pnpm >/dev/null 2>&1; then - pnpm add -g @profullstack/submitfleet +# npm first: its global bin works out of the box. pnpm only when npm is missing or fails +# (pnpm add -g aborts unless its global bin directory was set up beforehand). +if command -v npm >/dev/null 2>&1 && npm install -g @profullstack/submitfleet; then + bin_dir="$(npm prefix -g)/bin" +elif command -v pnpm >/dev/null 2>&1 && pnpm add -g @profullstack/submitfleet; then + bin_dir="$(pnpm bin -g)" else - npm install -g @profullstack/submitfleet + echo "submitfleet: install failed (tried npm and pnpm)" >&2 + exit 1 +fi +if command -v submitfleet >/dev/null 2>&1; then + submitfleet doctor || true + echo "Installed. Try: submitfleet coverage report" +else + echo "Installed to $bin_dir, which is not on your PATH. Add it, then run: submitfleet doctor" fi -submitfleet doctor || true -echo "Installed. Try: submitfleet coverage report" `;