Last active
November 21, 2018 08:59
-
-
Save PatrickHeneise/c008146661ebfa5ede499086252a2372 to your computer and use it in GitHub Desktop.
Update all packages in subfolders
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
#!/bin/bash | |
parse_git_branch() { | |
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/ (\1)/' | |
} | |
for i in * ; do | |
if [ -d "$i" ]; then | |
cd "$i" | |
printf '\n\n%s\n' "${PWD##*/}$(parse_git_branch):" | |
if [ -f package.json ]; then | |
git checkout package-lock.json | |
git checkout -B chore/package-updates | |
npm i -D updates -u --semver minor && npm audit fix && npm test && git commit package.json package-lock.json -m 'chore: pacakge updates' && git push | |
git checkout master | |
fi | |
cd .. | |
fi | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Works great in a Makefile for projects with multiple repos: