mirror of
https://github.com/samsonjs/vibetunnel.git
synced 2026-03-25 09:25:50 +00:00
This commit is contained in:
parent
ea3c22fba1
commit
48ea8898fa
1 changed files with 11 additions and 28 deletions
|
|
@ -1,38 +1,21 @@
|
|||
#!/bin/bash
|
||||
# node-path-setup.sh
|
||||
# -------------------------------------------------------------
|
||||
# Common helper to ensure Node.js managers add their binaries to
|
||||
# PATH for VibeTunnel build scripts. Source this instead of
|
||||
# duplicating logic in every script.
|
||||
#
|
||||
# Usage (Bash):
|
||||
# SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]:-${0}}")" && pwd)"
|
||||
# source "${SCRIPT_DIR}/node-path-setup.sh"
|
||||
# Usage (Zsh):
|
||||
# SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
|
||||
# source "${SCRIPT_DIR}/node-path-setup.sh"
|
||||
# -------------------------------------------------------------
|
||||
|
||||
# Homebrew (Apple Silicon & Intel)
|
||||
if [ -d "/opt/homebrew/bin" ]; then
|
||||
export PATH="/opt/homebrew/bin:$PATH"
|
||||
fi
|
||||
if [ -d "/usr/local/bin" ]; then
|
||||
export PATH="/usr/local/bin:$PATH"
|
||||
# Load fnm if available
|
||||
if command -v fnm >/dev/null 2>&1; then
|
||||
eval "$(fnm env --use-on-cd=false)" 2>/dev/null || true
|
||||
fi
|
||||
|
||||
# NVM default location
|
||||
# Load NVM if available
|
||||
if [ -s "$HOME/.nvm/nvm.sh" ]; then
|
||||
export NVM_DIR="$HOME/.nvm"
|
||||
. "$NVM_DIR/nvm.sh"
|
||||
source "$NVM_DIR/nvm.sh" 2>/dev/null || true
|
||||
fi
|
||||
|
||||
# Volta
|
||||
if [ -d "$HOME/.volta/bin" ]; then
|
||||
export PATH="$HOME/.volta/bin:$PATH"
|
||||
fi
|
||||
# Set final PATH with Homebrew priority
|
||||
export PATH="/opt/homebrew/bin:/usr/local/bin:$HOME/.volta/bin:$HOME/Library/pnpm:$HOME/.bun/bin:$PATH"
|
||||
|
||||
# fnm (Fast Node Manager)
|
||||
if command -v fnm &> /dev/null; then
|
||||
eval "$(fnm env)"
|
||||
# Verify Node.js is available
|
||||
if ! command -v node >/dev/null 2>&1; then
|
||||
echo "error: Node.js not found. Install via: brew install node" >&2
|
||||
return 1 2>/dev/null || exit 1
|
||||
fi
|
||||
|
|
|
|||
Loading…
Reference in a new issue