-
Notifications
You must be signed in to change notification settings - Fork 25k
Invoke node directly in generate-specs.sh
#30781
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
Conversation
Codegen script for Xcode invokes `yarn --silent node <...>`, which breaks both when Yarn is not installed (if NPM is used), or when Yarn v2 ("Berry") is active. This commit changes generate-specs.sh to use `node` set via a `NODE_BINARY` env var, or, if it is not defined, find it with `command -v node`.
|
Hi @ivanmoskalev! Thank you for your pull request and welcome to our community. Action RequiredIn order to merge any pull request (code, docs, etc.), we require contributors to sign our Contributor License Agreement, and we don't seem to have one on file for you. ProcessIn order for us to review and merge your suggested changes, please sign at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need to sign the corporate CLA. Once the CLA is signed, our tooling will perform checks and validations. Afterwards, the pull request will be tagged with If you have received this in error or have any questions, please contact us at [email protected]. Thanks! |
|
Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Facebook open source project. Thanks! |
Base commit: 505f9fc |
Base commit: 505f9fc |
|
Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Facebook open source project. Thanks! |
5 similar comments
|
Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Facebook open source project. Thanks! |
|
Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Facebook open source project. Thanks! |
|
Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Facebook open source project. Thanks! |
|
Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Facebook open source project. Thanks! |
|
Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Facebook open source project. Thanks! |
janicduplessis
left a comment
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.
LGTM
cc @hramos
|
@janicduplessis I actually would want to have some advice from the code owners on this before merging. Currently, we still need to work around that line, since it breaks Codegen for Yarn-less machines. I can either work in some fallback for that case, OR, instead, get rid of yarn invocations altogether, if the callsite is now intended to be unreachable. |
|
@ivanmoskalev The link doesn't work, but I assume you are talking about the last YARN_BINARY callsite. This one should only happen when building RN from source. Still a good idea to fix it I think. One possibility is just call this script instead https://github.com/facebook/react-native/blob/bec5e147cb0a84225f88b3dbc2f87c39c0ef0bc7/packages/react-native-codegen/scripts/oss/build.sh. It already handles npm and yarn. |
|
We're also in the process of landing #30792 which will make changes to this code. I think after this you will want to check for whether the NODE_BINARY exists and make sure to add |
|
Adding fixes in a couple hours, was on a sick leave for ~ last week. |
|
@janicduplessis @hramos I have updated the script, would you have a look, please? I've also got 2 questions:
|
facebook-github-bot
left a comment
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.
@hramos has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator.
|
I'll take care of the conflict. |
Summary
Currently, Codegen bash wrapper (
generate-specs.sh) for Xcode invokes JS-based Codegen tooling viayarn --silent node <...>. This breaks both:This PR changes the way
generate-specs.shlocatesnodeexecutable to the following algorithm:NODE_BINARYenv varNODE_BINARYenv var is not defined, findnodewithcommand -v nodeChangelog
[iOS] [Fixed] - Fix Codegen silently failing when Yarn is not installed, or when Yarn v2 is active.
Test Plan
Case 1 (no Yarn installed)
yarnis not present in PATHCase 2 (Yarn v2 is used)
yarnis running in the v2 ("Berry") mode