2018-07-19 15:01:23 +03:00
|
|
|
#!/bin/bash
|
2021-12-31 02:08:43 +03:00
|
|
|
# Copyright (c) Meta Platforms, Inc. and affiliates.
|
2015-10-22 20:11:28 +03:00
|
|
|
#
|
2018-02-17 05:24:55 +03:00
|
|
|
# This source code is licensed under the MIT license found in the
|
|
|
|
# LICENSE file in the root directory of this source tree.
|
2015-10-22 20:11:28 +03:00
|
|
|
|
2019-03-21 21:05:48 +03:00
|
|
|
# scripts directory
|
2022-07-20 17:06:18 +03:00
|
|
|
THIS_DIR=$(cd -P "$(dirname "$(readlink "${BASH_SOURCE[0]}" || echo "${BASH_SOURCE[0]}")")" && pwd)
|
2019-03-21 21:05:48 +03:00
|
|
|
REACT_NATIVE_ROOT="$THIS_DIR/.."
|
|
|
|
# Application root directory - General use case: react-native is a dependency
|
2022-11-18 01:18:09 +03:00
|
|
|
PROJECT_ROOT=${PROJECT_ROOT:-"$THIS_DIR/../../.."}
|
2018-12-19 02:55:26 +03:00
|
|
|
|
2019-04-10 17:35:59 +03:00
|
|
|
# check and assign NODE_BINARY env
|
2019-06-29 05:12:42 +03:00
|
|
|
# shellcheck disable=SC1090
|
2019-04-10 17:35:59 +03:00
|
|
|
source "${THIS_DIR}/node-binary.sh"
|
|
|
|
|
2019-03-21 21:05:48 +03:00
|
|
|
# When running react-native tests, react-native doesn't live in node_modules but in the PROJECT_ROOT
|
2022-11-18 01:18:09 +03:00
|
|
|
if [ ! -d "$THIS_DIR/../../../node_modules/react-native" ];
|
2019-03-21 21:05:48 +03:00
|
|
|
then
|
|
|
|
PROJECT_ROOT="$THIS_DIR/.."
|
|
|
|
fi
|
|
|
|
# Start packager from PROJECT_ROOT
|
|
|
|
cd "$PROJECT_ROOT" || exit
|
2021-11-11 10:59:54 +03:00
|
|
|
"$NODE_BINARY" "$REACT_NATIVE_ROOT/cli.js" start --custom-log-reporter-path "$THIS_DIR/packager-reporter.js" "$@"
|