packager.sh 866 B

123456789101112131415161718192021222324
  1. #!/bin/bash
  2. # Copyright (c) Facebook, Inc. and its affiliates.
  3. #
  4. # This source code is licensed under the MIT license found in the
  5. # LICENSE file in the root directory of this source tree.
  6. # scripts directory
  7. THIS_DIR=$(cd -P "$(dirname "$(readlink "${BASH_SOURCE[0]}" || echo "${BASH_SOURCE[0]}")")" && pwd)
  8. REACT_NATIVE_ROOT="$THIS_DIR/.."
  9. # Application root directory - General use case: react-native is a dependency
  10. PROJECT_ROOT="$THIS_DIR/../../.."
  11. # check and assign NODE_BINARY env
  12. # shellcheck disable=SC1090
  13. source "${THIS_DIR}/node-binary.sh"
  14. # When running react-native tests, react-native doesn't live in node_modules but in the PROJECT_ROOT
  15. if [ ! -d "$PROJECT_ROOT/node_modules/react-native" ];
  16. then
  17. PROJECT_ROOT="$THIS_DIR/.."
  18. fi
  19. # Start packager from PROJECT_ROOT
  20. cd "$PROJECT_ROOT" || exit
  21. "$NODE_BINARY" "$REACT_NATIVE_ROOT/cli.js" start "$@"