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

add [WingetVersion] Badge #10245

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open

Conversation

anatawa12
Copy link
Contributor

@anatawa12 anatawa12 commented Jun 11, 2024

Fixes #5548

Writing test in progress (might be tomorrow in JST) I wrote tests

This implementation fetches version information from https://github.com/microsoft/winget-pkgs/ with graphql api.
However, actual vrc-get command line interface retrieves package information from sqlite database file in https://cdn.winget.microsoft.com/cache/source.msix.

I don't know if this difference is acceptable for shelds.

Copy link
Contributor

github-actions bot commented Jun 11, 2024

Messages
📖 ✨ Thanks for your contribution to Shields, @anatawa12!

Generated by 🚫 dangerJS against d387631

@anatawa12 anatawa12 marked this pull request as ready for review June 12, 2024 03:43
Copy link
Member

@chris48s chris48s left a comment

Choose a reason for hiding this comment

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

thanks for having a look at this one

const version = latest(versions)

return renderVersionBadge({ version })
} catch (e) {
Copy link
Member

Choose a reason for hiding this comment

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

Are we expecting to catch a particular exception here?
If not, can we ditch the try/catch. Sentry will handle capturing the details of any unexpected runtime error for us in production.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

sorry I forgot to remove debug code.

const entries = json.data.repository.object.entries
const directories = entries.filter(file => file.type === 'tree')
const versions = directories.map(file => file.name)
const version = latest(versions)
Copy link
Member

Choose a reason for hiding this comment

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

Is there any way we could find out what the registry considers the "latest" version of a package? Do we have any info on how WinGet sorts versions?

I'm a bit worried that there doesn't really seem to be any constraint on what a version "number" can be. Here's some examples that have one or more odd ones:

Given it seems a version number can be basically any string, it seems like this we are going to get this wrong in some cases.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sorry for late response. I will investigate the update process in winget database

.required(),
}).required(),
}).required(),
}).required()
Copy link
Member

Choose a reason for hiding this comment

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

👍

@chris48s chris48s added the service-badge Accepted and actionable changes, features, and bugs label Jun 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
service-badge Accepted and actionable changes, features, and bugs
Projects
None yet
Development

Successfully merging this pull request may close these issues.

New service: winget
2 participants