move jquery
to peerDependencies
from dependencies
#2163
Merged
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.
After this patch
jquery
is removed from thedependencies
section ofpackage.json
and grantedpeerDependencies
status instead of it.Rationale:
bootstrap-datepicker
andjquery
) are quite likely to be defined as dependencies of their common parent application (which is, most likely, a web site; could also be an application built on Electron, NW.js, JXcore for Cordova, etc.) and thus to become peers in that sense. Currently, if some version mismatch happens on that level (under that common parent),npm
would install another version ofjquery
underbootstrap-datepicker
(and that would be the version required bybootstrap-datepicker
in itsdependencies
). However,bootstrap-datepicker
does not rely on Node.jsrequire()
unless a CommonJS environment is encountered by UMD, in any other environment that npm's behaviour does not really help anything, and thusnpm
should rather warn on version mismatch (like it does withpeerDependencies
) and refrain from trying to fix things.npm install jquery
(for example, that user might prefer to use a<script src="…">
tag referencing jQuery CDN instead of a local npm-installed jQuery), thennpm
should not decide to install jQuery as a dependency (which won't be used anyway); a warning about a missing peerDependency would be enough.