diff --git a/local/bin/dfm b/local/bin/dfm index f795b58..208c5c0 100755 --- a/local/bin/dfm +++ b/local/bin/dfm @@ -93,9 +93,9 @@ function section_install ;; nvm) curl -o- "https://raw.githubusercontent.com/nvm-sh/nvm/$VERSION_NVM/install.sh" | bash \ - && nvm install --lts --latest-npm --default \ - && git checkout "$HOME/.zshrc" \ - && msg_yay "nvm installed!" + && nvm install --lts --latest-npm --default + git checkout "$DOTFILES/base/zshrc" + msg_yay "nvm installed!" ;; npm) bash "$DOTFILES/scripts/install-npm-packages.sh" \ diff --git a/scripts/install-npm-packages.sh b/scripts/install-npm-packages.sh index e633cd4..8c79fc1 100755 --- a/scripts/install-npm-packages.sh +++ b/scripts/install-npm-packages.sh @@ -15,7 +15,6 @@ have npm && { "prettier" "@bchatard/alfred-jetbrains" "@johnnymorganz/stylua-bin" - "js-debug" "stylelint-lsp" "blade-formatter" "@loopback/cli" @@ -29,8 +28,17 @@ have npm && { # Skip comments if [[ ${pkg:0:1} == "#" ]]; then continue; fi - msg_run "Installing npm package:" "$pkg" - npm install -g --no-fund --no-progress --no-timing "$pkg" + if [[ $(npm ls -g -p "$pkg") != "" ]]; then + msg_run_done "$pkg" "already installed" + else + msg_run "Installing npm package:" "$pkg" + npm install -g --no-fund --no-progress --no-timing "$pkg" + fi + echo "" done + + msg_run "Upgrading all global packages" + npm -g --no-progress --no-timing --no-fund outdated + npm -g --no-timing --no-fund upgrade } || msg_err "npm could not be found."