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 [VpmVersion] badge #8755

Merged
merged 8 commits into from
Dec 31, 2022
Merged

add [VpmVersion] badge #8755

merged 8 commits into from
Dec 31, 2022

Conversation

anatawa12
Copy link
Contributor

Closes #8752

packageId: 'com.vrchat.udonsharp',
},
queryParams: {
repositoryUrl: 'https://packages.vrchat.com/curated?download',
Copy link
Member

Choose a reason for hiding this comment

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

I realise that this is a user-supplied parameter so the user can pass in whatever they want, but for a version badge it seems like you could pass in https://packages.vrchat.com/curated (without ?download) here and works just the same. For the purposes of the example/test, do we need this?

Copy link
Contributor Author

@anatawa12 anatawa12 Dec 29, 2022

Choose a reason for hiding this comment

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

The reason why I use url with ?download is it's the actual url vpm uses.

Comment on lines 73 to 77
if (sort === 'defined') {
version = versions.reverse()[0]
} else if (sort === 'semver') {
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.

Can you expand a bit on the reason for allowing multiple sort methods here? I don't really know the norms of this community, but for package registries we generally want the concept of 'latest' to align with that of the upstream registry (What version would I get if I run vpm install, or whatever?). We do have this for some badges like github tags/releases where the platform is unaware of the language ecosystem norms or version schema (a github release could be anything - an NPM package, an android app, whatever..). For package registries (NPM, Ruby gems, Rust crates, PyPI, etc) we don't generally do this.

Copy link
Member

Choose a reason for hiding this comment

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

Also, normally for version badges, /v would be the latest version (excluding pre-releases) and we'd have an include_prereleases flag for latest version (including pre-releases). Does VPM have any concept of stable/pre-releases?

Copy link
Contributor Author

@anatawa12 anatawa12 Dec 29, 2022

Choose a reason for hiding this comment

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

Because official repository template is made based on GitHub releases, in most case, its ordered by release date. however, it's not documented & not a rule for the repository so we can remove this sort.

I think this sort of useful in case of releasing multiple major releases but it may not be a enough reason.

Does VPM have any concept of stable/pre-releases?

Yes. VPM is based on semver. I forget to check prereleases in defined sort.

import { BaseJsonService, NotFound } from '../index.js'

const queryParamSchema = Joi.object({
repositoryUrl: optionalUrl.required(),
Copy link
Member

Choose a reason for hiding this comment

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

Can we make the query param repository_url. To make the variable name repositoryUrl internally, you can change the function signature for handle() to

async handle({ packageId }, { repository_url: repositoryUrl, sort }) {

(you'll need to update the examples to use repository_url)

.pattern(
/./,
Joi.object({
versions: Joi.object().pattern(/./, Joi.object()).required(),
Copy link
Member

@chris48s chris48s Dec 29, 2022

Choose a reason for hiding this comment

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

We should make this

versions: Joi.object().pattern(/./, Joi.object()).min(1).required(),

This will require the versions object to have at least one key. At the moment, Object.keys(pkg.versions) could be [].

@@ -0,0 +1,45 @@
import { isSemver } from '../test-validators.js'
import { createServiceTester } from '../tester.js'
export const t = await createServiceTester()
Copy link
Member

Choose a reason for hiding this comment

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

The service tests didn't run in CI. This is a known issue - we're working on it, but we still have one foot in GitHub actions and one foot in Circle CI. Lets not get too bogged down in that, but I ran the service tests locally and they all failed. Can you have a look at getting the tests passing. You'll need to run them locally.

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 did ran npm run test but not ran npn run test:services. I fixed tests.

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.

Nice. This latest round of changes looks great. One more thing and we are good to go.

repository_url: 'https://packages.vrchat.com/curated?download',
},
staticPreview: renderVersionBadge({ version: '1.1.6' }),
},
Copy link
Member

@chris48s chris48s Dec 30, 2022

Choose a reason for hiding this comment

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

Can we add a second example with the include_prereleases flag?

repository_url: 'https://packages.vrchat.com/curated?download',
include_prereleases: null,
},
staticPreview: renderVersionBadge({ version: '1.1.6' }),
Copy link
Contributor Author

Choose a reason for hiding this comment

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

should I use fake prerelease version like 1.1.7-beta.1 for static preview?

Copy link
Member

Choose a reason for hiding this comment

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

I think it is fine as it stands

@chris48s chris48s added the service-badge New or updated service badge label Dec 31, 2022
@shields-ci
Copy link

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

Generated by 🚫 dangerJS against 29b06f3

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.

great work on this 👍

@repo-ranger repo-ranger bot merged commit ac2ae0c into badges:master Dec 31, 2022
@anatawa12 anatawa12 deleted the add-vpm branch June 12, 2024 04:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
service-badge New or updated service badge
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add version badge for VPM Repository
3 participants