Skip to content

Commit

Permalink
fix: Start Metro packager from $PROJECT_DIR
Browse files Browse the repository at this point in the history
  • Loading branch information
MatthieuLemoine committed Mar 21, 2019
1 parent e3f9d7e commit 423fee6
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions scripts/packager.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,20 @@
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.

# scripts directory
THIS_DIR=$(cd -P "$(dirname "$(readlink "${BASH_SOURCE[0]}" || echo "${BASH_SOURCE[0]}")")" && pwd)
REACT_NATIVE_ROOT="$THIS_DIR/.."
# Application root directory - General use case: react-native is a dependency
PROJECT_ROOT="$THIS_DIR/../../.."

# shellcheck source=/dev/null
source "${THIS_DIR}/.packager.env"
cd "$THIS_DIR/.." || exit
node "./cli.js" start "$@"

# When running react-native tests, react-native doesn't live in node_modules but in the PROJECT_ROOT
if [ ! -d "$PROJECT_ROOT/node_modules/react-native" ];
then
PROJECT_ROOT="$THIS_DIR/.."
fi
# Start packager from PROJECT_ROOT
cd "$PROJECT_ROOT" || exit
node "$REACT_NATIVE_ROOT/cli.js" start "$@"

0 comments on commit 423fee6

Please sign in to comment.