Clean node

This commit is contained in:
2019-03-15 15:32:54 +01:00
parent 3f38c0fb7e
commit 6812c639be
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;;