longbill / jquery-date-range-picker

A jQuery plugin that allows user to select a date range
MIT License
1.12k stars 579 forks source link

Add dependencies as peer-dependencies #359

Open derwaldgeist opened 7 years ago

derwaldgeist commented 7 years ago

I am using the date range picker in combination with MeteorJS and other packages that are incompatible with jQuery 3.x. In older versions of Meteor, I was able to suppress that the date-range-picker includes its own jQuery version, using bower, and this just worked fine. But as Meteor has moved to full npm compatibility, the dependency on jQuery 3 causes Meteor to overwrite its standard jQuery version 1.1 with jQuery 3, which breaks my other packages. Would it be possible to define the dependency as a peer dependency instead?

holtkamp commented 7 years ago

How would you suggest to do that? Personally I am not very familiar with "peer dependencies"...

derwaldgeist commented 7 years ago

AFAIK, it is enough if you define the dependency in the "peerDependencies" section. In this case, npm will not install jquery automatically along with your plugin, but instead require the user to do so. And in some circumstances, like the scenario mentioned above, this will avoid that jquery will be installed twice. As it is now, the only chance I had was to copy your code to a private repository to avoid duplicate jquery installations.

Here's a description with more details: https://nodejs.org/en/blog/npm/peer-dependencies/

holtkamp commented 7 years ago

Aah, ok, that seems ok to me, please provide a Pull Request with this suggestion 👍