Skip to content

[enhancement] Include prereleases (-beta.1) in peerDep semver ranges #2760

Description

@ide

Do you want to request a feature or report a bug?
This is a half-feature request, half-bug report.

What is the current behavior?
Currently yarn (and npm) does not include prerelease versions of packages to satisfy semver ranges, unless those ranges explicitly ask for a prerelease version. For example, react@16.0.0-alpha.2 does not satisfy the range react >= 15 even though 16-dot-anything is greater than 15.

If the current behavior is a bug, please provide the steps to reproduce.
Install react@16.0.0-alpha.2 and another package that has a peerDep on react >= 15 (react-helmet for example). Run yarn which prints:

warning "react-helmet@4.0.0" has incorrect peer dependency "react@>=15.0.0".

What is the expected behavior?
With this requested enhancement, when doing peerDep checks, Yarn would consider X.Y.Z-anything.N to be a semver string that is greater than X.Y.{Z-1} and less than X.Y.{Z+1} (and X.{Y+1}.0 and {X+1}.0.0).

I believe this also addresses an issue that Facebook has been having internally between react and other packages that have a peerDep on react.

The semver package doesn't implement this behavior so we'd likely want to write a small module that does a more inclusive version check for peerDeps.

Please mention your node.js, yarn and operating system version.

Node 7.6.0
Yarn 0.21.2
macOS 10.12

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions