Clean node

This commit is contained in:
Thomas Forgione 2019-03-15 15:32:54 +01:00
parent 3f38c0fb7e
commit 6812c639be
No known key found for this signature in database
GPG Key ID: 203DAEA747F48F41
2 changed files with 28 additions and 7 deletions

View File

@ -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;;

View File

@ -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