Created
April 29, 2019 09:00
-
-
Save whalemare/c58267400ae48ae172ba75f2409ea905 to your computer and use it in GitHub Desktop.
React Native doctor that can solve your problems
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
#!/usr/bin/env bash | |
# If you dont know what happened just start this script for automatically trying solve your problem. | |
# Clear all your build folders and dependencies. | |
# Install dependencies again | |
platform=$1 | |
platform=$(echo "$platform" | tr '[:upper:]' '[:lower:]') # to lower string | |
echo "Moving to the root project folder" | |
cd .. | |
echo "Remove npm dependencies" | |
rm -rf node_modules | |
echo "Clean watchman and npm cache" | |
watchman watch-del-all | |
npm cache clean | |
echo "Install npm dependencies" | |
npm install | |
if [[ "$platform" == "android" ]] | |
then | |
cd android | |
./gradlew clean | |
cd .. | |
elif [[ "$platform" == "ios" ]] | |
then | |
cd ios | |
echo "Start cleaning ios build" | |
rm -rf build | |
echo "Start cleaning ios pods" | |
rm -f Podfile.lock | |
rm -rf Pods | |
## | |
# Fix issue with precompile header errors caused by aggressive caching bug in XCode | |
# https://stackoverflow.com/questions/19391768/file-has-been-modified-since-the-precompiled-header-was-built | |
## | |
echo "Start cleaning XCode DerivedData" | |
rm -rf ~/Library/Developer/Xcode/DerivedData/* | |
pod cache clean --all | |
echo "Cleaning successfully" | |
echo "Install and update pods" | |
pod update | |
pod install --repo-update | |
cd .. | |
fi | |
# be careful with this option. This can cause errors | |
#react-native link |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Put this script inside root/scripts/{HERE}
Use this only inside script folder like:
cd scripts && ./doctor.sh ios