Something went wrong. Try again.
Mirroring: https://github.com/MunifTanjim/scripts.sh
Something went wrong. Try again.
scripts.sh setup-fnm
771 B · 26 lines
at main
123456789101112131415161718192021222324252627#!/usr/bin/env bash
# install/update fnm# https://github.com/Schniz/fnm
FNM_DIR="${FNM_DIR:-"${XDG_DATA_HOME:-"${HOME}/.local/share"}/fnm"}"
declare -r bin_dir="${HOME}/.local/bin"declare -r install_dir="${FNM_DIR}/bin"
curl -fsSL https://fnm.vercel.app/install | bash -s -- --install-dir "${install_dir}" --skip-shell
if test -x "${install_dir}/fnm"; then # linux (without brew) echo "Setting up binary: fnm" if test "$(readlink --canonicalize-existing --no-newline "${bin_dir}/fnm")" != "${install_dir}/fnm"; then ln -nsf "${install_dir}/fnm" "${bin_dir}/fnm" fifi
export PATH="${PATH}:${bin_dir}"
if ! fnm exec --using=default node -v >/dev/null 2>&1; then fnm install --lts fnm default "$(fnm list-remote --lts --latest | cut -d' ' -f1)"fi