Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.

run-packager.sh 961B

1234567891011121314151617181920212223242526
  1. #!/bin/bash
  2. # This script is executed bt Gradle to start the React packager for Debug
  3. # targets.
  4. THIS_DIR=$(cd -P "$(dirname "$(readlink "${BASH_SOURCE[0]}" || echo "${BASH_SOURCE[0]}")")" && pwd)
  5. export RCT_METRO_PORT="${RCT_METRO_PORT:=8081}"
  6. echo "export RCT_METRO_PORT=${RCT_METRO_PORT}" > "${THIS_DIR}/../../node_modules/react-native/scripts/.packager.env"
  7. adb reverse tcp:8081 tcp:8081
  8. if nc -w 5 -z localhost ${RCT_METRO_PORT} ; then
  9. if ! curl -s "http://localhost:${RCT_METRO_PORT}/status" | grep -q "packager-status:running" ; then
  10. echo "Port ${RCT_METRO_PORT} already in use, packager is either not running or not running correctly"
  11. exit 2
  12. fi
  13. else
  14. CMD="${THIS_DIR}/../../node_modules/react-native/scripts/launchPackager.command"
  15. if [[ `uname` == "Darwin" ]]; then
  16. open -g "${CMD}" || echo "Can't start packager automatically"
  17. else
  18. xdg-open "${CMD}" || echo "Can't start packager automatically"
  19. fi
  20. fi