From a76043838041e898a120dd6517b240ed44d860a3 Mon Sep 17 00:00:00 2001 From: Mike Grabowski Date: Fri, 23 Oct 2020 11:15:04 +0200 Subject: [PATCH] Revert "Revert "feat: improve monorepo support by removing redundant PROJECT_ROOT (#28354)"" This reverts commit 6afacda2fdf16dafb2ea652d7064dfcd7f09258c. --- scripts/react-native-xcode.sh | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/scripts/react-native-xcode.sh b/scripts/react-native-xcode.sh index ee4aef09f5ebef..699fa5651d16f6 100755 --- a/scripts/react-native-xcode.sh +++ b/scripts/react-native-xcode.sh @@ -56,11 +56,17 @@ case "$CONFIGURATION" in ;; esac -# Path to react-native folder inside node_modules -REACT_NATIVE_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)" -# The project should be located next to where react-native is installed -# in node_modules. -PROJECT_ROOT=${PROJECT_ROOT:-"$REACT_NATIVE_DIR/../.."} +# Setting up a project root was a workaround to enable support for non-standard +# structures, including monorepos. Today, CLI supports that out of the box +# and setting custom `PROJECT_ROOT` only makes it confusing. +# +# As a backwards-compatible change, I am leaving "PROJECT_ROOT" support for those +# who already use it - it is likely a non-breaking removal. +# +# For new users, we default to $PWD - not changing things all. +# +# For context: https://github.com/facebook/react-native/commit/9ccde378b6e6379df61f9d968be6346ca6be7ead#commitcomment-37914902 +PROJECT_ROOT=${PROJECT_ROOT:-$PWD} cd "$PROJECT_ROOT" || exit @@ -103,6 +109,9 @@ if [[ ! -x node && -d ${HOME}/.anyenv/bin ]]; then fi fi +# Path to react-native folder inside node_modules +REACT_NATIVE_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)" + # check and assign NODE_BINARY env # shellcheck source=/dev/null source "$REACT_NATIVE_DIR/scripts/node-binary.sh"