Created
January 2, 2018 08:15
-
-
Save buo/b04a9378ef136cdfbf56a7d45f6ef2c6 to your computer and use it in GitHub Desktop.
Update outdated NPM packages and commit the changes
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
npm install | |
for info in $(npm outdated --parseable --depth=0); | |
do | |
pkg=$(echo "$info" | cut -d: -f4 | cut -d@ -f1) | |
current=$(echo "$info" | cut -d: -f3 | cut -d@ -f2) | |
wanted=$(echo "$info" | cut -d: -f2 | cut -d@ -f2) | |
if [ "$current" != "$wanted" ]; then | |
echo "$pkg: $current -> $wanted" | |
npm update -S $pkg | |
git add package* | |
git commit -am "Update $pkg from $current to $wanted" | |
fi | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment