Skip to content

Instantly share code, notes, and snippets.

@jgonet
Created August 11, 2020 09:00
Show Gist options
  • Save jgonet/18d5ad4c011e13783f7a46c6417d7cfc to your computer and use it in GitHub Desktop.
Save jgonet/18d5ad4c011e13783f7a46c6417d7cfc to your computer and use it in GitHub Desktop.
Nuke RN project
#!/bin/bash
# Taken from https://github.com/react-native-community/discussions-and-proposals/issues/134#issuecomment-554330540 by @ifyapishore
# clean react-native
echo 'clean watchman'
watchman watch-del-all
echo 'clean node_modules'
rm -rf node_modules
echo 'clean caches'
rm -rf $TMPDIR/haste-map-react-native-packager-*
rm -rf $TMPDIR/react-native-packager-cache-*
rm -rf $TMPDIR/metro-bundler-cache-*
rm -rf $TMPDIR/react-*;
rm -rf $TMPDIR/haste-*;
rm -rf $TMPDIR/metro-*;
rm -rf ~/.rncache
rm yarn.lock
rm package-lock.json
# install
echo 'start'
yarn
# thrid party module can install old 2.*.* version of cli, produce build errors in gradle
rm -rf ./node_modules/react-native-cli
# clean xcode
xcodebuild -project ios/MyProject.xcodeproj -configuration Release clean
xcodebuild -project ios/MyProject.xcodeproj -configuration Debug clean
echo 'clean Xcode/DerivedData'
rm -rf ~/Library/Developer/Xcode/DerivedData
echo 'clean ios build'
rm -rf ./ios/build
rm -rf ./ios/Pods
cd ios
pod deintegrate
pod install
cd ..
# clean xcode
rm -rf ./android/app/build
# clean js build
rm -rf ./build
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment