Skip to content

Instantly share code, notes, and snippets.

@pavelglebov
Last active August 17, 2023 08:34
Show Gist options
  • Save pavelglebov/05898726f13159a6f1b663b00b05f16c to your computer and use it in GitHub Desktop.
Save pavelglebov/05898726f13159a6f1b663b00b05f16c to your computer and use it in GitHub Desktop.
React Native refresh packages util script
CYAN='\033[0;36m'
NOCOLOR='\033[0m'
refresh_node_modules() {
echo -e "${CYAN}Refreshing node_modules${NOCOLOR}"
rm -rf ./node_modules && yarn install
}
refresh_ios() {
echo -e "${CYAN}Refreshing iOS packages${NOCOLOR}"
rm -rf ./ios/Pods
cd ios && pod install
}
refresh_android() {
echo -e "${CYAN}Refreshing Android packages${NOCOLOR}"
cd android && ./gradlew clean
}
refresh_watchman() {
watchman watch-del-all && watchman watch-del-all
}
refresh_all() {
refresh_node_modules
refresh_ios
cd ..
refresh_android
refresh_watchman
}
if [ "$1" = "ios" ]; then
refresh_node_modules
refresh_ios
refresh_watchman
exit 0
elif [ "$1" = "android" ]; then
refresh_node_modules
refresh_android
refresh_watchman
exit 0
elif [ "$1" = "npm" ]; then
refresh_node_modules
refresh_watchman
exit 0
else
refresh_all
exit 0
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment