From 30d290c30df7be806373ead9fa4575e5efcd3211 Mon Sep 17 00:00:00 2001 From: Riccardo Cipolleschi Date: Thu, 23 Mar 2023 10:46:25 -0700 Subject: [PATCH] Fixed script for Packager.sh in RNTester (#36582) Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/36582 This change should fix the path to run packager.sh directly from Xcode, this was broken after the Monorepo work. ## Changelog: [internal] - update path to run packager.sh Reviewed By: huntie, hoxyq Differential Revision: D44292167 fbshipit-source-id: 90e0291aa7a15189c72cae99c5d38c84c7243a80 --- packages/react-native/scripts/packager.sh | 5 ----- packages/rn-tester/RNTesterPods.xcodeproj/project.pbxproj | 2 +- 2 files changed, 1 insertion(+), 6 deletions(-) diff --git a/packages/react-native/scripts/packager.sh b/packages/react-native/scripts/packager.sh index cb8b10109843b8..00d6ebc5d45e73 100755 --- a/packages/react-native/scripts/packager.sh +++ b/packages/react-native/scripts/packager.sh @@ -14,11 +14,6 @@ PROJECT_ROOT=${PROJECT_ROOT:-"$THIS_DIR/../../.."} # shellcheck disable=SC1090 source "${THIS_DIR}/node-binary.sh" -# When running react-native tests, react-native doesn't live in node_modules but in the PROJECT_ROOT -if [ ! -d "$THIS_DIR/../../../node_modules/react-native" ]; -then - PROJECT_ROOT="$THIS_DIR/../../.." -fi # Start packager from PROJECT_ROOT cd "$PROJECT_ROOT" || exit "$NODE_BINARY" "$REACT_NATIVE_ROOT/cli.js" start --custom-log-reporter-path "$THIS_DIR/packager-reporter.js" "$@" diff --git a/packages/rn-tester/RNTesterPods.xcodeproj/project.pbxproj b/packages/rn-tester/RNTesterPods.xcodeproj/project.pbxproj index f43cd892f01232..bc5dbd4d2477f1 100644 --- a/packages/rn-tester/RNTesterPods.xcodeproj/project.pbxproj +++ b/packages/rn-tester/RNTesterPods.xcodeproj/project.pbxproj @@ -644,7 +644,7 @@ ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; - shellScript = "set -x\n\nexport RCT_METRO_PORT=\"${RCT_METRO_PORT:=8081}\"\necho \"export RCT_METRO_PORT=${RCT_METRO_PORT}\" > \"${SRCROOT}/../react-native/scripts/.packager.env\"\nif [ -z \"${RCT_NO_LAUNCH_PACKAGER+xxx}\" ] ; then\n if nc -w 5 -z localhost ${RCT_METRO_PORT} ; then\n if ! curl -s \"http://localhost:${RCT_METRO_PORT}/status\" | grep -q \"packager-status:running\" ; then\n echo \"Port ${RCT_METRO_PORT} already in use, packager is either not running or not running correctly\"\n exit 2\n fi\n else\n open -n \"$SRCROOT/../react-native/scripts/launchPackager.command\" || echo \"Can't start packager automatically\"\n fi\nfi\n"; + shellScript = "set -x\n\n# RN-Tester does not have an iOS directory. The PROJECT_ROOT should \n# point to the folder where the `metro.config.js` file lives.\nexport PROJECT_ROOT=$(pwd)\nexport RCT_METRO_PORT=\"${RCT_METRO_PORT:=8081}\"\necho \"export RCT_METRO_PORT=${RCT_METRO_PORT}\" > \"${SRCROOT}/../react-native/scripts/.packager.env\"\nif [ -z \"${RCT_NO_LAUNCH_PACKAGER+xxx}\" ] ; then\n if nc -w 5 -z localhost ${RCT_METRO_PORT} ; then\n if ! curl -s \"http://localhost:${RCT_METRO_PORT}/status\" | grep -q \"packager-status:running\" ; then\n echo \"Port ${RCT_METRO_PORT} already in use, packager is either not running or not running correctly\"\n exit 2\n fi\n else\n open -n \"$SRCROOT/../react-native/scripts/launchPackager.command\" || echo \"Can't start packager automatically\"\n fi\nfi\n"; showEnvVarsInLog = 0; }; 68CD48B71D2BCB2C007E06A9 /* Build JS Bundle */ = {