-
-
Notifications
You must be signed in to change notification settings - Fork 54
Peer and Optional Dependencies Support #112
Conversation
I think npm used to install and / or enforce peerDependencies, if I remember correctly. If be curious what their rationale was for removing that functionality, and what makes ember-cli different such that it won't encounter the same issues. |
Indeed,
The only thing I can find (after only a few minutes of searching 😉 ) is this weekly update that says:
Which unfortunately, doesn't really give any rationale. I can only speculate based on anecdotal evidence that |
npm team official statement is here: npm/npm#11213 (comment) and yarn is debating peer deps too: yarnpkg/yarn#4689 and optional deps in npm are just weird lol: npm/npm#14185 (and i have questions, but i'll wait :) ) |
As I see it peerDependencies could be made to work with only the extra error message. While a peer dependency will be fulfilled by an I think the real problem here is that For optional deps I don't really know what to do, don't have much experience with them. And reading the links above gives me the impression that it is not all that straight forward. Although the reasoning that an optional dep is not used by ember-cli until you include it in your app package.json could be a nice consistent approach. --edit: As far as why npm doesn't install peer deps anymore, I think this is more due to problems people had with multiple installations of libraries. As described in the first link of @eriktrom (the hard error) and also here: https://github.com/npm/npm/releases/tag/v3.0.0 install-peerdeps also seems encouraging. Although I miss the option to install all peer deps recursively. |
Yep, thats exactly the idea here.
I agree. |
We discussed this at length in the ember-cli team meeting yesterday, the team is in favor of moving forward here (barring new info in comments / feedback / etc here) with the following changes to the RFC:
I'll work to get this RFC updated with these points this weekend... |
Good to hear there is some traction on this rfc.
How will this work with for example ember-cli-babel as a peer dependency? The existence of this in the addons is how ember-cli currently marks an addon for JS preprocessing as far as I could tell. I could not get the warning at https://github.com/ember-cli/ember-cli/blob/master/lib/models/addon.js#L1212 to go away without adding the So maybe still load the addon for preprocessing, but don't add it onto the |
Yep, definitely is. We have a few options in this case:
Though, I am generally working (mostly on the concept, no code yet) on removing the "transpile at each layer" concept and making it so that each layer is responsible for emitting "ES" code (e.g. no pending proposals, etc). This would mean that addons wanting stage X features would still need to handle transpilation of those specific features, but overall most addons would not need this. The result of this would be that we can do a single transpile (using the apps transpiler addon) and have the ability to do other nice things (e.g. tree shaking, auto-import of ES modules from packages in node_modules, etc). In summary, I think the primary concern that caused me to open this RFC is still addressed without setting up the peer dependency in |
That sounds perfect. |
We're looking at leveraging peerDependencies in our app, does this RFC imply we'll hit issues, or are we good to go there? |
Closed as part of the migration to emberjs/rfcs, will reopen over in emberjs/rfcs... |
rendered