Created
March 14, 2017 20:39
-
-
Save FredLackeyOfficial/47b732f3380a7ba2a217ff135bde6366 to your computer and use it in GitHub Desktop.
Use npm-check-updates recursively to update Node modules and Bower components.
This file contains 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
cmd_exists() { | |
command -v "$1" &> /dev/null | |
} | |
ncu-update-all(){ | |
if ! cmd_exists "ncu"; then | |
printf "ncu is required, please install it!\n" | |
exit 1 | |
fi | |
for file in $(find . -type f -name "package.json" -not \( -path "*/node_modules/*" \) -not \( -path "*/bower_components/*" \)); do | |
if [ -f "$file" ]; then | |
eval "ncu -a -u --packageFile $file" | |
fi | |
done | |
for file in $(find . -type f -name "bower.json" -not \( -path "*/node_modules/*" \) -not \( -path "*/bower_components/*" \)); do | |
if [ -f "$file" ]; then | |
eval "ncu -a -u -m bower --packageFile $file" | |
fi | |
done | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment