Skip to content

Instantly share code, notes, and snippets.

@pzatorski
Created May 7, 2022 20:03
Show Gist options
  • Star 12 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save pzatorski/849d8559f631676d423bcdac737db595 to your computer and use it in GitHub Desktop.
Save pzatorski/849d8559f631676d423bcdac737db595 to your computer and use it in GitHub Desktop.
Clean a React Native project (iOS)
#!/bin/bash
# exit when any command fails
set -e
COMMAND=$1
function clean() {
printf "🧹 Cleaning.. \n"
rm -rf ~/Library/Caches/CocoaPods Pods ~/Library/Developer/Xcode/DerivedData
rm -rf node_modules ios/build ios/Pods ios/Podfile.lock
yarn cache clean
printf "✅ Cleaning finished! \n"
}
function install_dependencies() {
printf "👨‍💻 Installing dependencies.. \n"
yarn
npx pod-install
printf "✅ All installed correctly"
}
function setup_environment() {
clean
install_dependencies
}
case $COMMAND in
clean) clean ;;
install) install_dependencies ;;
setup) setup_environment ;;
*) echo "❌ Command not found" ;;
esac
@pzatorski
Copy link
Author

  • To clean your project
./react-native-setup-ios.sh clean
  • To install dependencies
./react-native-setup-ios.sh install
  • To clean project and install dependencies
./react-native-setup-ios.sh setup

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment