Uh oh!
There was an error while loading. Please reload this page.
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-apito 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?
Uh oh!
There was an error while loading. Please reload this page.
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?
Uh oh!
There was an error while loading. Please reload this page.
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-plugindepends oncli-server-apibut that consumers need to satisfy this requirement. The only consumer of@react-native/community-cli-pluginisreact-native, but you don't wantreact-nativeto depend on CLI any longer. Soreact-nativeneeds to "forward" the dependency to its consumers, hence redeclare peer dependency. Without this, package managers won't correctly link the package.However, since
react-nativehascli-server-apias 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-nativedoesn't need to depend on@react-native/community-cli-pluginat 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:
peerDependencyhere betweenreact-nativeand@react-native-community/cli-server-api(so amend this line)@react-native/community-cli-plugindepends on@react-native-community/cli-server-apireact-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-apiin a place where@react-native/community-cli-pluginwill be able to find it.Longer answer: See #49325 (comment)