Files
react-native/scripts/launchPackager.command
T
enniel b399c2e3d1 CLI: export packager environment variables (#32666)
Summary:
Custom metro port not working without exporting variables from `.packager.env`

## Changelog

[General] [Fixed] - Fix support for custom port

Pull Request resolved: https://github.com/facebook/react-native/pull/32666

Test Plan: run `react-native run-android --port=8082` and `react-native run-ios --port=8082`

Reviewed By: yungsters

Differential Revision: D32694233

Pulled By: cortinico

fbshipit-source-id: 42e803d56b83608024b901d2a3024733ed7099b7
2021-11-29 08:31:27 -08:00

31 lines
909 B
Bash
Executable File

#!/bin/bash
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
# Set terminal title
echo -en "\\033]0;Metro\\a"
clear
THIS_DIR=$(cd -P "$(dirname "$(readlink "${BASH_SOURCE[0]}" || echo "${BASH_SOURCE[0]}")")" && pwd)
# export packager environment variables
source "$THIS_DIR/.packager.env"
if [ -n "${RCT_PACKAGER_LOGS_DIR}" ] ; then
echo "Writing logs to $RCT_PACKAGER_LOGS_DIR"
# shellcheck source=/dev/null
RCT_PACKAGER_LOG_PATH="$RCT_PACKAGER_LOGS_DIR/metro.log" \
. "$THIS_DIR/packager.sh" \
> "$RCT_PACKAGER_LOGS_DIR/packager.stdout.log" \
2> "$RCT_PACKAGER_LOGS_DIR/packager.stderr.log"
else
# shellcheck source=/dev/null
. "$THIS_DIR/packager.sh"
fi
if [[ -z "$CI" ]]; then
echo "Process terminated. Press <enter> to close the window"
read -r
fi