Skip to content

Instantly share code, notes, and snippets.

@whoislewys
Created May 24, 2019 05:33
Show Gist options
  • Save whoislewys/18942ac40edb68460c709fe2ed74dee4 to your computer and use it in GitHub Desktop.
Save whoislewys/18942ac40edb68460c709fe2ed74dee4 to your computer and use it in GitHub Desktop.
react-native-clean: get a clean build from a react-native project
# Clean a react-native project
# usage: react-native-clean
# or: `react-native-clean deep`
# `deep` arg will clean yarn cache
function react-native-clean() {
echo "removing node modules..."
rm -rf node_modules
echo "clearing tmpdirs..."
rm -rf $TMPDIR/react-*
rm -rf $TMPDIR/npm-*
watchman watch-del-all
echo "removing ios & android build folders..."
rm -rf ios/build
rm -rf android/app/build
echo "reinstalling node modules"
yarn
echo "clearing yarn cache..."
echo "use ctrl+c to kill this server once it gives you the \"Done\" message"
yarn start --reset-cache
if [ "$1" = "deep" ]; then
yarn cache clean
fi
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment