38 lines
965 B
Cheetah
38 lines
965 B
Cheetah
|
|
#!/bin/bash
|
||
|
|
# Install Node.js via fnm (Fast Node Manager)
|
||
|
|
# This script runs once before other chezmoi operations
|
||
|
|
|
||
|
|
set -e
|
||
|
|
|
||
|
|
echo "==> Installing Node.js via fnm..."
|
||
|
|
|
||
|
|
# Install fnm if not present
|
||
|
|
if ! command -v fnm &> /dev/null; then
|
||
|
|
echo "==> Installing fnm..."
|
||
|
|
curl -fsSL https://fnm.vercel.app/install | bash -s -- --skip-shell
|
||
|
|
|
||
|
|
# Add fnm to PATH for this script
|
||
|
|
export PATH="$HOME/.local/share/fnm:$PATH"
|
||
|
|
eval "$(fnm env)"
|
||
|
|
else
|
||
|
|
echo "==> fnm already installed"
|
||
|
|
eval "$(fnm env)"
|
||
|
|
fi
|
||
|
|
|
||
|
|
# Install latest LTS Node.js
|
||
|
|
echo "==> Installing Node.js LTS..."
|
||
|
|
fnm install --lts
|
||
|
|
fnm default lts-latest
|
||
|
|
fnm use lts-latest
|
||
|
|
|
||
|
|
# Verify installation
|
||
|
|
echo "==> Node.js installed successfully!"
|
||
|
|
echo " node: $(node --version)"
|
||
|
|
echo " npm: $(npm --version)"
|
||
|
|
|
||
|
|
# Install common global npm packages
|
||
|
|
echo "==> Installing global npm packages..."
|
||
|
|
npm install -g typescript ts-node npm-check-updates 2>/dev/null || true
|
||
|
|
|
||
|
|
echo "==> Node.js setup complete!"
|