Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ bash init.sh
| `just julia` | Install Julia via juliaup |
| `just haskell` | Install Haskell via ghcup |
| `just python` | Install uv (Python package manager) |
| `just node` | Install fnm (Node version manager) with Node LTS and enable pnpm via corepack |
| `just go` / `just go update` | Install or update Go |
| `just neovim` / `just neovim update` | Install or update Neovim (pass `home` to install under `~/.local`) |
| `just emacs` / `just emacs update` | Install or update Emacs (system build is pgtk, home build is nox) |
Expand Down
43 changes: 43 additions & 0 deletions scripts/install-node.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
#!/usr/bin/env bash
set -euo pipefail

# fnm's install is OS-uniform (curl | bash), so no <os> arg is needed.

# fnm (Fast Node Manager)
# --skip-shell: the installer aborts with "Could not infer shell" when $SHELL is
# unset (CI / non-interactive). Persistent shell integration lives statically in the
# repo-tracked rc files (settings-bash/.bashrc, settings-zsh/.zshrc).
if ! command -v fnm &>/dev/null; then
curl -fsSL https://fnm.vercel.app/install | bash -s -- --skip-shell
fi

# On Linux the installer drops fnm in ~/.local/share/fnm; on mac it uses Homebrew,
# which is already on PATH (this prepend is then a harmless no-op).
export PATH="$HOME/.local/share/fnm:$PATH"
# --shell bash: this script always runs under bash (shebang + `bash ...` in the
# recipe), and fnm's process-tree shell detection is unreliable in CI
# (su -l ci -c ... just), emitting nothing so a later `fnm use` aborts with
# "We can't find the necessary environment variables". Forcing the shell is safe
# regardless of the user's interactive shell.
eval "$(fnm env --shell bash)"

# Already fully set up (fnm present with Node + pnpm) — nothing to do.
if command -v pnpm &>/dev/null; then
echo "fnm and pnpm are already installed"
fnm --version
node --version
pnpm --version
exit 0
fi

# Node LTS provides corepack, which provides pnpm
fnm install --lts
fnm use lts-latest
fnm default lts-latest

# Enable pnpm shim via corepack
corepack enable pnpm

fnm --version
node --version
pnpm --version
4 changes: 4 additions & 0 deletions settings-bash/.bashrc
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,10 @@ case ":$PATH:" in
;;
esac

# fnm (Node version manager)
export PATH="$HOME/.local/share/fnm:$PATH"
command -v fnm >/dev/null && eval "$(fnm env --use-on-cd)"

# ble.sh attach and keybindings
if [[ ${BLE_VERSION-} ]]; then
ble-bind -m auto_complete -f 'S-TAB' auto_complete/insert
Expand Down
4 changes: 4 additions & 0 deletions settings-zsh/.zshrc
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,10 @@ export PATH

# <<< juliaup initialize <<<

# fnm (Node version manager)
export PATH="$HOME/.local/share/fnm:$PATH"
command -v fnm >/dev/null && eval "$(fnm env --use-on-cd)"

[ -f "$HOME/.ghcup/env" ] && source "$HOME/.ghcup/env" # ghcup-envexport PYENV_ROOT="$HOME/.pyenv"
[[ -d $PYENV_ROOT/bin ]] && export PATH="$PYENV_ROOT/bin:$PATH"
eval "$(pyenv init -)"
Expand Down
Loading