Advertisement
Guest User

Untitled

a guest
Jun 17th, 2019
108
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.53 KB | None | 0 0
  1. #!/bin/bash
  2. # Do clean rebuilds of both platforms after reinstalling fresh dependencies
  3. # Useful during (eg) periodic upgrades of dependencies, to make sure everything
  4. # still works at each step. Run one iOS and one Android simulator first.
  5. # Keep this script outside your source tree (eg, /usr/local/bin/rn_rebuild)
  6.  
  7. set -x # echo each command
  8. set -e # die on error (except when we "|| set exit 0")
  9.  
  10. # Extract our app's bundle ID.
  11. BUNDLE_ID=`perl <android/app/build.gradle -n -e '/^\s+applicationId "(.*)"$/ && print $1'`
  12.  
  13. # Uninstall the iOS app
  14. xcrun simctl terminate booted $BUNDLE_ID || set exit 0
  15. xcrun simctl uninstall booted $BUNDLE_ID || set exit 0
  16.  
  17. # Uninstall the Android app
  18. adb uninstall $BUNDLE_ID || set exit 0
  19.  
  20. # Kill the Metro bundler.
  21. pkill -f "$(pwd)/node_modules/react-native/scripts/../cli.js start" || set exit 0
  22.  
  23. # Remove all installed dependencies and previous build results.
  24. # (Might be better not to remove the two lockfiles here, to avoid seeing
  25. # indirect soft-dependency version bumps because of new released, but :shrug:)
  26. /bin/rm -rf node_modules ios/Pods ios/build android/build android/app/build \
  27. ios/Podfile.lock yarn.lock
  28.  
  29. # Install all our dependencies afresh.
  30. yarn
  31. (cd ios; pod install)
  32.  
  33. # Build and test
  34. react-native run-android
  35. react-native run-ios
  36. npm t
  37. ./node_modules/.bin/tsc --noEmit
  38. ./node_modules/.bin/tslint -p . --type-check
  39.  
  40. # Show any changed files (usually lockfiles if a soft dependency changed.)
  41. CHANGES=`git status -s`
  42. [[ -n $CHANGES ]] &&
  43. (echo -e "\033[0;31mUh-oh, files changed!\033[0m\n$CHANGES"; exit 1)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement