-
Notifications
You must be signed in to change notification settings - Fork 172
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
Change dependencies to peerDependencies #127
Conversation
If I try required Proj4Leaflet and have local version leaflet, then I have two version - your and my.
Nice of you to contribute! According to Leaflet plugin guide you should define it as a dependency. Also see the comment on this PR #117 on why it might be so. Maybe having it as a devdependency would be better than peerdependency? |
Done, in leaflet plugin guide now peerDependencies |
Hmm I still think having it in the peerDependencies is wrong, and it should be in the devDependencies if anything. I also found this issue which kind of says don't use peerDependencies since it is removed from all official leaflet plugins. |
My current view is that it should be a Having it as an explicit dependency causes the problems @Ralf8686 mentions, and it's particularly bad if you try to use plugins written for 0.7 with Leaflet 1.0. We should still have Proj4 as a dependency, though. Peer dependencies are typically used when you write a plugin, like Proj4Leaflet is a plugin to Leaflet, but Proj4Leaflet consumes Proj4, it isn't a plugin for Proj4. |
Okey maybe I should admit myself defeated! But I still don't see the difference between an official plugin and this plugin? |
@semone hmm, maybe I wrote it in a confusing way. What I meant to say was that @Ralf8686's patch turns both Leaflet and Proj4 (note: Proj4.js, not Proj4Lealfet itself) into peer dependencies. I think Leaflet should be a peer dependency, or not a dependency at all, but Proj4 should remain a dependency. |
@perliedman I don't sure about Proj4 too. Because , example, in my project i use Proj4 too. I think, all plugins should use peer dependencies, to not have conflicts with local dependencies. Or am I wrong? |
@Ralf8686 for most libs, having two instances of it is no problem, npm and CommonJS is built on that prinicple. It becomes a problem with libs like Leaflet, that use a |
I am confused now - so this was a wrong thing to do? Leaflet/Leaflet#4534 |
That is what confuses me too @theashyster |
I'm not sure when or why the recommendation in Leaflet's plugin guide changed to peer deps. I'm guessing since normal deps cause problems for plugins that would otherwise work with both Leaflet 0.7 and 1.0. But if you use Browserify or similar and need a plugin to be compatible with multiple versions of Leaflet, standard dependencies will make things break. As mentioned above, I'm fine with just dropping the dependency as well, but you could argue that a peer dependency is nice since it's a machine readable recommendation. |
The reason the plugin guide changed to peer is because @Ralf8686 made a PR to the plugin guide for it to change today. Leaflet/Leaflet#5142 |
@semone @perliedman Looks like there is not a clear solid position of what is the correct way of doing this. The problem here is that before I see that having it as I agree that standard dependencies can make things break and Yeah, so @Ralf8686 what do you say about it being inside |
I fully agree with you @theashyster that is how I have understood it as well. |
So, is consensus that we should list Leaflet inside |
@pthorin I still think that |
I think the situation with My view is that putting it in |
Okay, I see, good point. Okay, I just thought that putting it in So I say we can try to go both the |
Ok, will remove Leaflet from |
* Switched from jasmine to mocha * Removed Leaflet from dependencies in package.json (#127) * Use mocha-phantomjs for npm testing * Added travis.yml
If I try required Proj4Leaflet and have local version leaflet, then I have two version - your and my.