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

Respect dependency ranges on Package page #117

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

boatbomber
Copy link
Contributor

@boatbomber boatbomber commented Mar 10, 2023

Relates to subissue mentioned in #115.

Currently, dependency links use the first version listed in the range. However, this can be a nonexistent version (while still being a valid range). For example, if something depends on evaera/promise >=3.0.0 <4.0.0 the package only has 3.1.0, 3.2.0, 3.2.1, & 4.0.0 versions published, so three of those versions match the range but the first version listed in the range itself actually does not exist, and was therefore leading to an invalid version page.

This PR remedies that problem by utilizing npm's node-semver package to actually parse and utilize the dependency range to find the best matching version from the existing versions. In the above example, it would give us 3.2.1. (Note: adding a new package, semver, requires me to update the package-lock file. Since it was very out of date and an old format, the diff is large but the only "real" change is adding semver as a dependency.)

Before:
image

After:
afterImg

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.

1 participant