Created
December 28, 2018 17:23
-
-
Save ondrej-kvasnovsky/f0b666fe12e7e21f02b0891cc4d26644 to your computer and use it in GitHub Desktop.
Pull latest changes from all git repositories in a directory and call npm install for each project
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 | |
CUR_DIR=$(pwd) | |
echo "\n\033[1mPulling in latest changes for all repositories in $CUR_DIR directory\033[0m\n" | |
for i in $(find . -name ".git" | cut -c 3-); do | |
echo ""; | |
echo "\033[33m"+$i+"\033[0m"; | |
cd "$i"; | |
cd ..; | |
git pull origin master; | |
cd $CUR_DIR | |
done | |
for i in $(find . -name "package.json" | cut -c 3-); do | |
if [[ $i != *"node_modules"* ]]; then | |
echo ""; | |
echo "\033[33m"+$i+"\033[0m"; | |
parentDir="$(dirname "$i")" | |
cd "$parentDir"; | |
npm install; | |
fi | |
cd $CUR_DIR | |
done | |
echo "\n\033[32mComplete!\033[0m\n" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment