diff --git a/zsh/bin/update b/zsh/bin/update index 4bb9eb2..21293af 100755 --- a/zsh/bin/update +++ b/zsh/bin/update @@ -188,6 +188,27 @@ update-rust() { } +update-npm() { + + # Update node packages if installed + command -v npm > /dev/null 2>&1 + if [ $? -ne 0 ]; then + return + fi + + start_npm_update=`date +%s` + echo "\033[32;1m=== Updating node packages ===\033[0m" + + for package in $(npm -g outdated --parseable --depth=0 | cut -d: -f3) + do + npm -g install "$package" + done + + seconds=$((`date +%s` - $start_rust_update )) + formatted=`date -ud "@$seconds" +'%H hours %M minutes %S seconds'` + echo "\033[32;1m=== Node packages updated in $formatted ===\033[0m" +} + update-dotfiles() { start_dotfiles_update=`date +%s` @@ -224,6 +245,9 @@ main() { # Update rust and rust packages update-rust + # Update npm and npm packages + update-npm + # Update the dotfiles update-dotfiles @@ -244,6 +268,7 @@ main() { "system") update-system;; "rust") update-rust;; + "npm") update-npm;; "dotfiles") update-dotfiles;; "check") _check_date_if_format;; diff --git a/zsh/path.zsh b/zsh/path.zsh index 2803d7d..da52844 100644 --- a/zsh/path.zsh +++ b/zsh/path.zsh @@ -12,13 +12,9 @@ if [ -d $HOME/.cargo ]; then export PATH=$HOME/.cargo/bin:$PATH fi -# Nvm path -if [ -d $HOME/.nvm ]; then - export NVM_DIR="$HOME/.nvm" - # Sourcing this is really slow - # source $NVM_DIR/nvm.sh - # So well just export the path - export PATH=$HOME/.nvm/versions/v11.4.0/bin:$PATH +# Node path +if [ -d $HOME/.npmbin ]; then + export PATH=$HOME/.npmbin/bin:$PATH fi # LD_LIBRARY_PATH: I don't know why there is this line here but I'm too scared