Fix package.json dependency declaration #50
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 are two issues with the current structure of the package.json file that cause friction for consumers of this package.
dependencies
andpeerDependencies
objects. This causes confusion as to what packages are actually being installed, asdependencies
causes downstream consumers to download the requirements whilepeerDependencies
does not but rather causes package managers to throw warnings if the package requested does not appear as a top-level dependency of the consuming package itself. (Sorry that was the word "package" an awful lot in there - starting to hit semantic exhaustion.) The TLDR here is each package should either be declared as a dependency OR as a peer dependency, but not both. I've opted to fix this in my suggestion by removing the peer dependencies other than react, but I acknowledge that's a personal choice I made because my project does not use redux or lodash. If your intention would be that consuming apps should explicitly install those packages as well, then they also should be moved to peer dependencies and noted in the documentation.react
, which is known to cause annoying bugs due to name collisions. Instead, flexible packages like react should be declared with version ranges (here I've suggested using>
your specified version for react, and^
the specified version for redux).I'm aware that because this SDK is, unfortunately, closed source that it's unlikely you can apply this patch directly. However, since this is causing us active issues in our usage of the SDK, I'm hoping you can incorporate this to your closed source and then issue an update that uses it. I would really appreciate being able to loosen some of our overriding
resolutions
definitions to fix type conflicts between your dependencies and our own.