Home

Awesome

React Native Clean Project

npm version https://img.shields.io/github/license/pmadruga/react-native-clean-project.svg GitHub issues Build Status

Cleans your React Native project by purging caches and modules, and reinstalling them again.

Installing

yarn add -D react-native-clean-project

Running

React-Native CLI plugin

This module is automatically detected as a plugin by the standard react-native command, adding new sub-commands:

Direct execution

For complete control (including using command-line arguments to non-interactively fine-tune what state is cleaned):

npx react-native-clean-project

Or add it as a script to your package.json

"scripts": {
  "clean": "react-native-clean-project"
}

Content

This is a combination of the commands suggested in the React Native documentation plus others.

State TypeCommandIn clean-project-auto?Optional?Default?Option Flag
React-native cacherm -rf $TMPDIR/react-*YesNotrue
Metro bundler cacherm -rf $TMPDIR/metro-*YesNotrue
Watchman cachewatchman watch-del-allYesNotrue
NPM modulesrm -rf node_modulesYesYestrue--keep-node-modules
Yarn cacheyarn cache cleanYesYestrue--keep-node-modules
Yarn packagesyarn installNoYestrue--keep-node-modules
NPM cachenpm cache verifyYesYestrue--keep-node-modules
NPM Installnpm ciYesYestrue--keep-node-modules
iOS build folderrm -rf ios/buildYesYesfalse--remove-iOS-build
iOS pods folderrm -rf ios/PodsYesYesfalse--remove-iOS-pods
system iOS pods cachepod cache clean --allYesYestrue--keep-system-iOS-pods-cache
user iOS pods cacherm -rf ~/.cocoapodsYesYestrue--keep-user-iOS-pods-cache
Android build folderrm -rf android/buildYesYesfalse--remove-android-build
Android clean project(cd android && ./gradlew clean)YesYesfalse--clean-android-project
Brew packagebrew update && brew upgradeNoYestrue--keep-brew
Pod packagespod updateNoYestrue--keep-pods

Example: npx react-native-clean-project --remove-iOS-build

Other Tips

You can also reset the Metro bundler cache when starting with react-native start --reset-cache

Support

This library does not support windows. PR's are welcome.

Contributing

Please read CONTRIBUTING.md for details on our code of conduct, and the process for submitting pull requests to us.

Authors

See also the list of contributors who participated in this project.

License

This project is licensed under the MIT License - see the LICENSE.md file for details