-
Notifications
You must be signed in to change notification settings - Fork 3k
Version comparators exclude rc releases #8854
Comments
This is intentional: https://github.com/npm/node-semver#prerelease-tags
The link has some of the further justification for the behavior. |
So looking at the related ticket, it looks to me that you want to have a fairly lenient limit on what peer deps you can depend on? That sounds pretty reasonable! When this semver behavior was being reasoned through it was regarding what behavior made sense for regular dependencies. I think we got those right, but peer deps are a different ball of wax, particularly now (now meaning w/ npm@3) that we aren't installing them. I would absolutely want to allow otherwise matching prerelease versions w/ my peer dependencies. |
On the plus side, w/ npm@3, having a non-matching peer dep is now just a warning. |
Exactly!
I believe even with npm 2 latest, peerDependencies are not being installed. It makes perfect sense to ignore the rc's in the context of actual direct dependencies, thanks for that explanation! If you don't have time to take this on for a bit, I could try to put together a pull request. I'm guessing a good starting point would be npm/deps.js on the 2.x branch? Thanks for the quick reply @iarna and for all of your work on npm! |
@brentvatne No, npm@2 warns that the current use of peer deps is deprecated, but it does still install them (although not always where you want). npm/install/deps.js exists only in master (w/ npm@3). Before you jump in with changes, I'd like to get a bit more consensus on the nature of the changes from the rest of our team: @othiym23, @zkat, how do you feel about the behavior described in #8854 (comment) ? |
This is what happens any time a new version is released :(
|
@isaacs - any comment on this? thanks :) |
I hope that npm can support this use case. It seems like React Native's use of this is the exact case that peer dependencies were designed for. The changes in npm 3 to peer dependencies are appreciated and align well with RN's expectations, but the fact that prerelease versions are excluded from ranges (especially You can see above on this issue that a large handful of projects are removing their peer dependencies to work around this issue, even though (to my understanding) this is exactly what peer dependencies are for. Thanks for considering. |
Our understanding here, based on experience and long discussions surrounding prereleases do probably have some usefulness left when it comes to individual packages, though. The practical response for the sake of solving the specific problem at hand here is to point you to the release process we developed during I hope this helps clarify it at all -- I'll close this issue now, since we consider this the best resolution we can provide. There is also some discussion about things such as release channels out in the issue tracker for semver that could be of interest! |
If I am reading the linked issue right, it sounds like The tag idea is a good one. I'll see if we can do that – thanks. |
… dependency. * Workaround since npm doesn't match -rc versions. See RN team's input here: npm/npm#8854.
… dependency. * Workaround since npm doesn't match -rc versions. See RN team's input here: npm/npm#8854.
… dependency. * Workaround since npm doesn't match -rc versions. See RN team's input here: npm/npm#8854.
Can we revisit this behavior? In practice people use prerelease versions (ex: react@15.0.3-alpha.1 is the version in question) and the fact that they don't match peerDependency versions like
These three packages work together fine in theory but npm considers Thinking about a practical solution, I believe peerDependencies should follow the semver convention that dependencies & devDependencies use. It's consistent and matches what people want to do in practice as far as I can tell from issues like hapijs/hapi#2208 and the other ones linked here. Edit: I learned that 15.0.3-alpha.1 doesn't satisfy "^15.0.0" even for dependencies and devDependencies, so I'd like to propose a small change to how semver works when validating dependencies, devDependencies, and peerDependencies between package.json and node_modules: Version strings of the form MAJOR.MINOR.PATCH-PRERELEASE should satisfy patterns of the form "^MAJOR.${MINOR that's less than or equal to the actual package's minor version}.${PATCH that's less than the actual package's patch version of the minor versions are equal}". These are some examples of matching patterns with 1.2.3-alpha.1:
|
As the publisher of When an app developer specifies However I as a plugin author don’t have the capacity to vet every single prerelease of the library I peer depend on, and promptly release updates that just bump the number. I want to specify that I trust the application developer to install prerelease versions of the package I peer depend on at their own risk, and the only restriction I care about is the major range. I'm considering removing peer dependencies from my projects because of this. Generally I find them very useful but I don't want to block people who just want to test early versions of my peer deps. |
Adds support for PureScript 0.9.1 and newer (purescript/purescript#2151) The `next` tag on NPM points to this pre-release. Also note that `peerDependencies` has been removed (npm/npm#8854). Resolves #54
The |
@pwfisher If you want to make that argument, |
@othiym23 One reason the npm repo could be the right place to open this issue is that I believe there's a good argument that semver semantics for peerDeps should be different than that for deps. My thinking comes from the fact that deps are implicitly installed while peerDeps are explicitly installed. It is understandable that npm does not install version 15.1.0-rc of a package when its dependent's package.json asks for ^15.0.0. However I believe that if version ^15.0.0 of this package is listed as a peerDep (instead of a dep) then 15.1.0-rc should satisfy the peerDep requirement. |
It is hard to use pre-release versions of mobx & mobx-react with this requirements. See also npm/npm#8854 (comment)
I believe if we specify
>=0.4
, then0.5
,0.5-rc
,0.5-rc.2
etc should all be considered valid.This might be intentional, curious to hear why that is if so. With React Native, there is a release candidate published every two weeks, so every library author needs to update their package's peerDependencies on that same interval. This is really messy and it would be best if updates were only required when breaking changes occur.
Related conversation on Twitter
cc @linclark
The text was updated successfully, but these errors were encountered: