-
Notifications
You must be signed in to change notification settings - Fork 24.5k
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
Add support for scoped npm package linking in local-cli #17000
Closed
+40
−0
Closed
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 don't think this is the right place for this change. First and foremost thing is that it mutates
dependency
object making this function no longer pure.Another thing is that I can't tell where the new value with
/
replaced to_
should be used. In your comment you said that it breaksinclude
statement in Gradle.Maybe you should do this replacement directly inside the function that puts
include
statement into Gradle 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.
E.g. here https://github.com/vekerdyb/react-native/blob/e9e841628fc77faa9bd271c86a031d0518d5e7e6/local-cli/link/android/patches/makeSettingsPatch.js#L22, make
const escapedName = name.replace()
and done :) (hopefully)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.
Mmm, that will only work if this
name
isn't re-used anywhere else. IIRC, we use it in many places, so we need to have a consistent name across different functions. As a compromise, we can introduce a new function, something likesanitizeName
or similar that only transforms a given dependency name into a version that will be understandable by Grade and other parts of thereact-native link
.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.
Yup, and that way it's explicit where we sanitize the name. Doing it globally on a
dependency
can have side effects as thename
field is supposed to be the name of the package.Function is a great idea that plays well with our design. I think I've seen it already in
generator
subfolder where they do the same forreact-native init
(sanitize the name when creating Android main application). We could potentially reuse that as well :)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.
Thanks for the feedback! Unfortunately I am quite busy at the moment, but will get back to this mid February, unless it is picked up by someone else by then.
I agree, I faintly remember seeing
init
working as expected now.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 published #18207 to fix the issue for Android and iOS.
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.
Thanks for the fix for android, but you also fixed iOS at the same time by importing the correct file ? Looks like it @rozele
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'll test your fix and make mine from your branch if this works
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.
Because your branch is being landed, i'll apply my fixes to it 💛
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.
There you go: #18275