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

New versioning: same-major #27312

Closed
rarkins opened this issue Feb 15, 2024 · 3 comments · Fixed by #28418
Closed

New versioning: same-major #27312

rarkins opened this issue Feb 15, 2024 · 3 comments · Fixed by #28418
Labels
priority-3-medium Default priority, "should be done" but isn't prioritised ahead of others type:feature Feature (new functionality)

Comments

@rarkins
Copy link
Collaborator

rarkins commented Feb 15, 2024

Describe the proposed change(s).

We have a need in multiple areas to support the concept that a version like X.Y.Z means "Greater than or equal to X.Y.Z and less than X+1". e.g. "1.20.0" means the equivalent of "^1.20.0".

A recent example is #27296 (comment)

I think we can create a simple versioning based off semver-coerced where every version is a constraint, and satisfies() returns true if the two versions are the same major version.

@rarkins rarkins added type:feature Feature (new functionality) priority-3-medium Default priority, "should be done" but isn't prioritised ahead of others labels Feb 15, 2024
@rarkins
Copy link
Collaborator Author

rarkins commented Feb 15, 2024

Possible use cases:

  • Go.mod directive
  • dotnet rollForward
  • Cargo?

@RahulGautamSingh
Copy link
Collaborator

RahulGautamSingh commented Apr 10, 2024

Checking my understanding.

The new versioning will use existing methods from semver-coerced for functions like isValid, isStable and so on, which do not deal with ranges.
For the methods that deal with ranges such as : matches, isLessThanRange, etc.. we will need to treat non-range versions like 1.0.0 as ^1.0.0, and if the version is already a range no change needed.

ie.

function matches( versions, range ) {
     let newRange = range;
     if( rangeIsVersion(range) ) {
         newRange = `^${range}`
     };

     return semver-coerced.matches(versions, newRange);
}

@rarkins
Copy link
Collaborator Author

rarkins commented Apr 10, 2024

I think that "greater than" and "less than" will be simpler primitives than "matches"

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jul 27, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
priority-3-medium Default priority, "should be done" but isn't prioritised ahead of others type:feature Feature (new functionality)
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants