您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

run-packager.sh 930B

123456789101112131415161718192021222324
  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. if nc -w 5 -z localhost ${RCT_METRO_PORT} ; then
  8. if ! curl -s "http://localhost:${RCT_METRO_PORT}/status" | grep -q "packager-status:running" ; then
  9. echo "Port ${RCT_METRO_PORT} already in use, packager is either not running or not running correctly"
  10. exit 2
  11. fi
  12. else
  13. CMD="${THIS_DIR}/../../node_modules/react-native/scripts/launchPackager.command"
  14. if [[ `uname` == "Darwin" ]]; then
  15. open -g "${CMD}" || echo "Can't start packager automatically"
  16. else
  17. xdg-open "${CMD}" || echo "Can't start packager automatically"
  18. fi
  19. fi