Skip to content
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

feat: Implement MinVersion() for Constraints. #227

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Commits on Dec 16, 2023

  1. feat: Implement MinVersion() for Constraints.

    MinVersion() returns return the lowest version that can possibly match the given constraint.
    
    For examples:
    
      *  `MinVersion("1.0.1") = "1.0.1"`
      *  `MinVersion("=1.0.1") = "1.0.1"`
      *  `MinVersion("~1.0.1") = "1.0.1"`
      *  `MinVersion(">1.0.1") = "1.0.2"`
      *  `MinVersion(">=1.0.1") = "1.0.1"`
      *  `MinVersion("<2.0.0 >1.0.1") = "1.0.2"`
    
    etc.
    
    The implementation is based on node-semver:
    
      https://github.com/npm/node-semver/blob/main/ranges/min-version.js
    
    One minor difference is how prerelease versions are treated given `>`:
    
      * In node-semver, `MinVersion(">1.0.0-beta') = "1.0.0-beta.0"`
      * In the proposed impl, `MinVersion(">1.0.0-beta') = "1.0.0"`
    
    This behavior made more sense to me given how Version("1.0.0-beta").IncPatch() behaves.
    taeold committed Dec 16, 2023
    Configuration menu
    Copy the full SHA
    4bf0515 View commit details
    Browse the repository at this point in the history