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

fix(outdated): ensure "Latest" version is greater than "Update" version #27390

Merged
merged 5 commits into from
Dec 17, 2024

Conversation

nathanwhit
Copy link
Member

Fixes #27038.

Previously, for NPM packages the latest version was the version with the "latest" tag. For JSR packages, the latest version was the greatest version that matched a * version requirement. Unfortunately, that doesn't work well with pre-release versions.

This PR changes it so that the latest version is always > the currently requested version.
For NPM: if "latest" tag > current then "latest" tag; otherwise the greatest version that is >= current
For JSR: greatest version >= current

This is the most reasonable behavior I could come up with. For example,

versions:
2.0.0-beta.2
2.0.0-beta.1
1.0.0 => "latest" tag

with a version req `^2.0.0-beta.1`

previously:
"Update" column => 2.0.0-beta.2
"Latest" column => 1.0.0

now:
"Update" column => 2.0.0-beta.2
"Latest" column => 2.0.0-beta.2

Copy link
Member

@dsherret dsherret left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good!

cli/tools/registry/pm/deps.rs Outdated Show resolved Hide resolved
cli/tools/registry/pm/deps.rs Outdated Show resolved Hide resolved
cli/tools/registry/pm/deps.rs Outdated Show resolved Hide resolved
@nathanwhit nathanwhit enabled auto-merge (squash) December 17, 2024 22:58
@nathanwhit nathanwhit merged commit 9d7174e into denoland:main Dec 17, 2024
17 checks passed
dsherret pushed a commit that referenced this pull request Jan 9, 2025
…on (#27390)

Fixes #27038.

Previously, for NPM packages the latest version was the version with the
"latest" tag. For JSR packages, the latest version was the greatest
version that matched a `*` version requirement. Unfortunately, that
doesn't work well with pre-release versions.

This PR changes it so that the latest version is always > the currently
requested version.
For NPM: if "latest" tag > current then "latest" tag; otherwise the
greatest version that is >= current
For JSR: greatest version >= current

This is the most reasonable behavior I could come up with. For example,

```
versions:
2.0.0-beta.2
2.0.0-beta.1
1.0.0 => "latest" tag

with a version req `^2.0.0-beta.1`

previously:
"Update" column => 2.0.0-beta.2
"Latest" column => 1.0.0

now:
"Update" column => 2.0.0-beta.2
"Latest" column => 2.0.0-beta.2
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

deno outdated doesn't support pre-releases
2 participants