-
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
fix: correctly forward dependency on @react-native-community/cli-server-api
#49325
Open
tido64
wants to merge
2
commits into
main
Choose a base branch
from
tido/forward-dependency-cli-server-api
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 1 commit
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
Next
Next commit
fix: correctly forward dependency on `@react-native-community/cli-ser…
…ver-api`
- Loading branch information
commit 95829a4d8f78bc73c4f440b588598d118110d14c
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
Oops, something went wrong.
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.
@tido64 @robhogan
mentioned that this will force
cli-server-api
to be installed (or at least result in a warning) also for expo users.Can't we add this as direct dependency inside the template 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.
We still need it here for it to be hoisted correctly. But we can make it optional and make it a direct dependency in the template.
Edit: I meant to submit a PR to the template but got distracted. Will try to get to it later tonight.
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.
Why do we need it here specifically?
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.
Basically, we declare that
@react-native/community-cli-plugin
depends oncli-server-api
but that consumers need to satisfy this requirement. The only consumer of@react-native/community-cli-plugin
isreact-native
, but you don't wantreact-native
to depend on CLI any longer. Soreact-native
needs to "forward" the dependency to its consumers, hence redeclare peer dependency. Without this, package managers won't correctly link the package.However, since
react-native
hascli-server-api
as peer dependency, it's probably fine to mark it as optional and add it in the template as a direct dependency to satisfy the requirement.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.
react-native-community/template#105
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 there is some cleanup to make sure
react-native
doesn't need to depend on@react-native/community-cli-plugin
at all so this change wont' be required at allThere 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.
Yes, that would be the proper solution in the long run.
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.
For the time being, can't we just have:
peerDependency
here betweenreact-native
and@react-native-community/cli-server-api
(so amend this line)@react-native/community-cli-plugin
depends on@react-native-community/cli-server-api
react-native-community/template#105?
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've replied to this offline but I'll post it here as well for transparency: The short answer is, if you do it this way, package managers won't put
@react-native-community/cli-server-api
in a place where@react-native/community-cli-plugin
will be able to find it.Longer answer: See #49325 (comment)