-
Notifications
You must be signed in to change notification settings - Fork 24.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Better error message when missing entry file #29012
Conversation
If the entry file has been renamed (e.g., to `index.ts`), the script currently fails silently and prints out that the bundle file does not exist. This change will print the correct error message instead.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
The failing tests seem to be unrelated... Is there anything I need to do about them? |
You can rebase to latest master and see if that helps. But anyway, now is the moment we wait for a Facebook employee to import it and verify |
fi | ||
|
||
if [[ $DEV != true && ! -f "$ENTRY_FILE" ]]; then | ||
echo "error: Entry file $ENTRY_FILE does not exist. If you use another file as your entry point, pass ENTRY_FILE=myindex.js" >&2 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it's a typo.
It should have been: "Error: entry file...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure what should be correct but error: File ...
case is already used towards the end of this file so I followed the same pattern.
I think you don't need to capitalize the word after colon(:)
Kiran JD
…On Tue, Jun 16, 2020 at 7:47 AM Petr Bela ***@***.***> wrote:
***@***.**** commented on this pull request.
------------------------------
In scripts/react-native-xcode.sh
<#29012 (comment)>
:
> @@ -67,9 +67,14 @@ if [[ "$ENTRY_FILE" ]]; then
# Use ENTRY_FILE defined by user
:
elif [[ -s "index.ios.js" ]]; then
- ENTRY_FILE=${1:-index.ios.js}
- else
- ENTRY_FILE=${1:-index.js}
+ ENTRY_FILE=${1:-index.ios.js}
+else
+ ENTRY_FILE=${1:-index.js}
+fi
+
+if [[ $DEV != true && ! -f "$ENTRY_FILE" ]]; then
+ echo "error: Entry file $ENTRY_FILE does not exist. If you use another file as your entry point, pass ENTRY_FILE=myindex.js" >&2
Not sure what should be correct but error: File ... case is already used
towards the end of this file so I followed the same pattern.
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#29012 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AGFANA2RLOIWQI77UQ4UPM3RW3I23ANCNFSM4NO6GICQ>
.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@TheSavior has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator.
@TheSavior merged this pull request in e73208e. |
This reverts commit e73208e.
This reverts commit e73208e.
This reverts commit e73208e.
This reverts commit e73208e.
This reverts commit e73208e.
This reverts commit e73208e.
This reverts commit e73208e.
This reverts commit e73208e.
This reverts commit e73208e.
This reverts commit e73208e.
This reverts commit e73208e.
This reverts commit e73208e.
This reverts commit e73208e.
This reverts commit e73208e.
This reverts commit e73208e.
This reverts commit e73208e.
This reverts commit e73208e.
This reverts commit e73208e.
This reverts commit e73208e.
This reverts commit e73208e.
Summary: The original $ENTRY_FILE check was added in #29012 to help catch misconfiguration for the entry JS file. That turned out breaking some RNTester builds/tests, so #29263 was added to accommodate the fact that RNTester .xcodeproj file has its own directory hierarchy. The 2nd PR had multiple issues: * It is incorrect to assume that the $ENTRY_FILE always exists in the parent dir of the .xcodeproj location. This caused an issue in RC 0.66: react-native-community/releases#249 (comment) * RNTester has since moved to packages/rn-tester/ (from RNTester/), hence breaking that assumption It turns out RNTester .xcodeproj has incorrectly misconfigured this JS bundling step (not sure since when). The original script invocation passed in the correct path for `RNTesterApp.ios.js`, but as an arg to the `react-native-xcode.sh` instead of by setting `ENTRY_FILE` env var. So this diff does 2 things: * Undid #29263 * Fix RNTester JS bundling invocation to set the ENTRY_FILE correctly {F659123377} Changelog: [iOS][Fixed] Unbreak $ENTRY_FILE handling for JS bundling Reviewed By: lunaleaps Differential Revision: D30690900 fbshipit-source-id: 7c5802b3eac56c0456edcd4b7478bfa4af48fc27
Summary: The original $ENTRY_FILE check was added in #29012 to help catch misconfiguration for the entry JS file. That turned out breaking some RNTester builds/tests, so #29263 was added to accommodate the fact that RNTester .xcodeproj file has its own directory hierarchy. The 2nd PR had multiple issues: * It is incorrect to assume that the $ENTRY_FILE always exists in the parent dir of the .xcodeproj location. This caused an issue in RC 0.66: react-native-community/releases#249 (comment) * RNTester has since moved to packages/rn-tester/ (from RNTester/), hence breaking that assumption It turns out RNTester .xcodeproj has incorrectly misconfigured this JS bundling step (not sure since when). The original script invocation passed in the correct path for `RNTesterApp.ios.js`, but as an arg to the `react-native-xcode.sh` instead of by setting `ENTRY_FILE` env var. So this diff does 2 things: * Undid #29263 * Fix RNTester JS bundling invocation to set the ENTRY_FILE correctly {F659123377} Changelog: [iOS][Fixed] Unbreak $ENTRY_FILE handling for JS bundling Reviewed By: lunaleaps Differential Revision: D30690900 fbshipit-source-id: 7c5802b3eac56c0456edcd4b7478bfa4af48fc27
This reverts commit e73208e.
This reverts commit e73208e.
This reverts commit e73208e.
This reverts commit e73208e.
This reverts commit e73208e.
This reverts commit e73208e.
This reverts commit e73208e.
This reverts commit e73208e.
This reverts commit e73208e.
Summary: Reverts #29012 It is not really possible to properly validate if ENTRY_FILE exists since it is resolved by metro, and the server is not always running from the app root, like in a monorepo with multiple RN apps running on the same metro server. In my case I run metro on the repo root and entry file will be something like `apps/app/index.js`. `-f "$ENTRY_FILE"` will fail since the script is run from the project folder (`PROJECT_ROOT`, in my case the `apps/app` folder, so it tries to resolve `apps/app/apps/app/index.js`). I don't think this check is actually useful since metro will report the error if the entry file is invalid (fixed in #30150). The error is not as user friendly, but I think it is still fine. Maybe it could be improved in metro. ## Changelog [iOS] [Fixed] - Don't validate ENTRY_FILE in react-native-xcode.sh Pull Request resolved: #32762 Test Plan: Before <img width="854" alt="image" src="https://user-images.githubusercontent.com/2677334/146100834-39310c9f-1767-496a-8698-1026726a1120.png"> After if file is actually missing <img width="987" alt="image" src="https://user-images.githubusercontent.com/2677334/146100893-d01e2247-c787-4174-ac60-2f308c338c8f.png"> After if file exists, builds successfully. Reviewed By: cortinico Differential Revision: D37066073 Pulled By: cipolleschi fbshipit-source-id: 8f6b149099a39d9179996bb965daa6cd9e06feac
Summary
If the entry file has been renamed (e.g., to
index.ts
), the script currently fails silently and prints out that the bundle file does not exist.This change will print the correct error message instead.
Changelog
[iOS] [Fixed] - Better error message when missing entry file
Test Plan
N/A