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 invalid versions by skipping over them #16

Merged
merged 2 commits into from
Jan 12, 2024
Merged

Conversation

NullVoxPopuli
Copy link
Owner

Resolves: #15

Copy link

stackblitz bot commented Jan 12, 2024

Review PR in StackBlitz Codeflow Run & review this pull request in StackBlitz Codeflow.

Copy link

vercel bot commented Jan 12, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
package-majors ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jan 12, 2024 7:52pm

app/utils.ts Outdated
Comment on lines 61 to 70
try {
let major = getMajor(version);

groups[major] ||= 0;
groups[major] += downloadCount;
} catch (e) {
console.group(`An error occurred and ${version} will be omitted from the dataset`);
console.error(e);
console.groupEnd();
}
Copy link
Contributor

Choose a reason for hiding this comment

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

this works fine, but you could also use Semver.isValid() instead of try/catch.

Copy link
Owner Author

Choose a reason for hiding this comment

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

that's a good point -- would probably allow for less verbose output, too

@NullVoxPopuli NullVoxPopuli merged commit 3918bd1 into main Jan 12, 2024
5 checks passed
@NullVoxPopuli NullVoxPopuli deleted the fix-invalid-versions branch January 12, 2024 19:52
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.

Error with package with a prerelease version ("Invalid Version: 2.1.0pre")
2 participants