Skip to content

Instantly share code, notes, and snippets.

@mjmaix
Last active October 5, 2020 18:23
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save mjmaix/4f37e38ce8846ea02b931c9f9103c5f7 to your computer and use it in GitHub Desktop.
Save mjmaix/4f37e38ce8846ea02b931c9f9103c5f7 to your computer and use it in GitHub Desktop.
React Native cleanup scripts
{
"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"
}
}
#!/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
#!/bin/bash
echo "💣 Killing Packager on port 8081."
lsof -n -i4TCP:8081 | sed '1 d' | awk '{print $2}' | xargs kill -9
# chmod +x scripts/post.sh
#!/bin/bash
echo "Something to do here."
@mjmaix
Copy link
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