Skip to content

Instantly share code, notes, and snippets.

@badsyntax
Last active October 21, 2021 07:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save badsyntax/f007888dcd31651c39d9a721c7e0b481 to your computer and use it in GitHub Desktop.
Save badsyntax/f007888dcd31651c39d9a721c7e0b481 to your computer and use it in GitHub Desktop.
#!/usr/bin/env bash
# Clear watchman watches
watchman watch-del-all 2>/dev/null
# Delete metro cache
rm -rf "${TMPDIR:-/tmp}"/metro-*
# local xcodebuild cache
cd ios/
xcodebuild -alltargets clean 2>/dev/null
cd ..
# ensure all gradle daemons are stopped
cd android/
./gradlew --stop
cd ..
# project deps
find . -name node_modules -type d -exec rm -rf {} \; 2>/dev/null
find . -name Pods -type d -exec rm -rf {} \; 2>/dev/null
# project build files
find . -name build -type d -exec rm -rf {} \; 2>/dev/null
# local gradle
find . -name .gradle -type d -exec rm -rf {} \; 2>/dev/null
find . -name .idea -type d -exec rm -rf {} \; 2>/dev/null
# global gradle cache
rm -rf "$HOME/.gradle/caches/"
# global xcodebuild cache
rm -rf "$(getconf DARWIN_USER_CACHE_DIR)/org.llvm.clang/ModuleCache" 2>/dev/null
rm -rf "$(getconf DARWIN_USER_CACHE_DIR)/org.llvm.clang.$(whoami)/ModuleCache" 2>/dev/null
rm -rf ~/Library/Developer/Xcode/DerivedData/* 2>/dev/null
rm -rf ~/Library/Caches/com.apple.dt.Xcode/* 2>/dev/null
echo
echo "!! All project build cache and built files have been deleted. !!"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment