1#!/bin/bash
2# Copyright (c) Meta Platforms, Inc. and 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
7# Set terminal title
8echo -en "\\033]0;Metro\\a"
9clear
10
11THIS_DIR=$(cd -P "$(dirname "$(readlink "${BASH_SOURCE[0]}" || echo "${BASH_SOURCE[0]}")")" && pwd)
12
13export PODS_ROOT="$THIS_DIR/../../../ios/Pods"
14WITH_ENVIRONMENT="$THIS_DIR/xcode/with-environment.sh"
15source $WITH_ENVIRONMENT
16
17# export packager environment variables
18source "$THIS_DIR/.packager.env"
19
20if [ -n "${RCT_PACKAGER_LOGS_DIR}" ] ; then
21  echo "Writing logs to $RCT_PACKAGER_LOGS_DIR"
22  # shellcheck source=/dev/null
23  RCT_PACKAGER_LOG_PATH="$RCT_PACKAGER_LOGS_DIR/metro.log" \
24  . "$THIS_DIR/packager.sh" \
25    > "$RCT_PACKAGER_LOGS_DIR/packager.stdout.log" \
26    2> "$RCT_PACKAGER_LOGS_DIR/packager.stderr.log"
27else
28  # shellcheck source=/dev/null
29  . "$THIS_DIR/packager.sh"
30fi
31if [[ -z "$CI" ]]; then
32  echo "Process terminated. Press <enter> to close the window"
33  read -r
34fi
35