Last active
October 5, 2020 18:23
-
-
Save mjmaix/4f37e38ce8846ea02b931c9f9103c5f7 to your computer and use it in GitHub Desktop.
React Native cleanup scripts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"scripts": { | |
"cleanup:all": "npm run cleanup:android && npm run cleanup:react && npm run cleanup:metrobundler && npm run cleanup:hastecache && npm run cleanup:ios", | |
"cleanup:react": "./scripts/killpackager.sh && watchman watch-del-all && rm -rf node_modules/ && rm -rf $TMPDIR/react-* ~/.npm/ ~./rncache", | |
"postcleanup:react": "echo 'run `npm install` or `yarn install`'", | |
"cleanup:ios": "rm -rf ~/Library/Developer/Xcode/DerivedData/* ios/build ios/Pods", | |
"cleanup:android": "./scripts/cleanandroid.sh", | |
"cleanup:metrobundler": "rm -rf /tmp/metro-bundler-cache-*", | |
"cleanup:hastecache": "rm -rf /tmp/haste-map-react-native-packager-*", | |
"start": "node node_modules/react-native/local-cli/cli.js start -- --reset-cache", | |
"postinstall": "./scripts/post.sh && npm run ios:pod:install", | |
"ios:pod:install": "cd ios && pod install" | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
DIRECTORY="node_modules/react-native" | |
if [ -d "$DIRECTORY" ]; then | |
echo "Running gradle clean" | |
cd ./android/ | |
./gradlew clean | |
echo "Finished cleaning up android" | |
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
echo "💣 Killing Packager on port 8081." | |
lsof -n -i4TCP:8081 | sed '1 d' | awk '{print $2}' | xargs kill -9 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# chmod +x scripts/post.sh | |
#!/bin/bash | |
echo "Something to do here." |
Author
mjmaix
commented
Apr 24, 2019
•
- add kill package before cleanup:react
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment