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

Support raw Gradle repository names in the UI repository snippet card #2169

Open
sylv256 opened this issue Jul 10, 2024 · 4 comments
Open

Support raw Gradle repository names in the UI repository snippet card #2169

sylv256 opened this issue Jul 10, 2024 · 4 comments
Labels
cosmetic Issue is not harmful and affects only cosmatic part of a project enhancement Improvement of existing feature request

Comments

@sylv256
Copy link

sylv256 commented Jul 10, 2024

What happened?

When setting the Reposilite Frontend's Maven ID, it automatically uncapitalizes the first character as seen below:

maven {
    name = "muonMC"
    url = uri("https://maven.muonmc.org/<repository>")
}

This is undesirable behavior for a professional setting as the capitalization denotes it is a proper noun.
Here is the Maven configuration for context:

<repository>
  <id>MuonMC</id>
  <name>MuonMC Maven Repository</name>
  <url>https://maven.muonmc.org/<repository></url>
</repository>

Another side-effect is that the copy feature does not include the Maven ID.

maven {
    url = uri("https://maven.muonmc.org/<repository>")
}

Finally, my biggest gripe with this feature is that it includes the repository name in the Maven ID.

maven {
    name = "muonMCReleases"
    url = uri("https://maven.muonmc.org/releases")
}

Reposilite version

3.x

Relevant log output

No response

@sylv256 sylv256 added the bug Bugs & errors found in Reposilite label Jul 10, 2024
@dzikoysk dzikoysk added question Questions about project and how to use it and removed bug Bugs & errors found in Reposilite labels Jul 11, 2024
@dzikoysk
Copy link
Owner

Hey, this is expected behaviour. Gradle does not have a concept of repository id, there's only a way to specify the name (that is optional, generated from URL by default). The name starts with lower case, because it's later on mapped to the command. Example:

So in this case, even if it doesn't look so good, we're following the offical approach.

@sylv256
Copy link
Author

sylv256 commented Jul 11, 2024

Hey, this is expected behaviour. Gradle does not have a concept of repository id, there's only a way to specify the name (that is optional, generated from URL by default). The name starts with lower case, because it's later on mapped to the command. Example:

* https://docs.gradle.org/current/userguide/declaring_repositories.html#sec:handling_credentials

So in this case, even if it doesn't look so good, we're following the offical approach.

That's quite unfortunate because that's not how Minecraft modders feel about this. All gradle repository examples in Minecraft modding capitalize the Maven ID, and that is the expected behavior in that context. Adding an option for an exception to disable the uncapitalization and repository appendix would be a good compromise.

@sylv256
Copy link
Author

sylv256 commented Jul 11, 2024

Sorry if I sound a little abrasive 😅; I'm not trying to be. I'll draft up a PR for this if that's okay. I don't suspect this would be a particularly hard feature to implement?

@dzikoysk
Copy link
Owner

As far as I know we have a decent number of mc related users, so I guess we could consider the alternative naming for Gradle repositories. Adding this should be fairly simple, but it involves conditional frontend changes, so we most likely need to introduce a new static variable:

export default function usePlaceholders() {
const available = !'{{REPOSILITE.BASE_PATH}}'.includes('REPOSILITE.BASE_PATH')
const basePath = available ? '{{REPOSILITE.BASE_PATH}}' : '/'
const id = available ? '{{REPOSILITE.ID}}' : 'reposilite-repository'
const title = available ? '{{REPOSILITE.TITLE}}' : 'Reposilite Repository'
const description = available ? '{{REPOSILITE.DESCRIPTION}}' : 'Public Maven repository hosted through the Reposilite'
const organizationWebsite = available ? '{{REPOSILITE.ORGANIZATION_WEBSITE}}' : location.protocol + '//' + location.host + basePath
const organizationLogo = available ? '{{REPOSILITE.ORGANIZATION_LOGO}}' : 'https://avatars.githubusercontent.com/u/75123628?s=200&v=4'
const icpLicense = available ? '{{REPOSILITE.ICP_LICENSE}}' : '国ICP备000000000号'

In frontend settings we'd put something like opt-in "Disable default name formatting in UI", so later on, you can just bypass this impl with it:

const gradleId = computed(() => {
const gradleIdUppercase = props.data.repoId
.split('-')
.map(it => it.charAt(0).toUpperCase() + it.slice(1))
.join('')
return gradleIdUppercase.charAt(0).toLowerCase() + gradleIdUppercase.slice(1)

@dzikoysk dzikoysk added enhancement Improvement of existing feature request cosmetic Issue is not harmful and affects only cosmatic part of a project and removed question Questions about project and how to use it labels Jul 11, 2024
@dzikoysk dzikoysk changed the title Capitalized Maven IDs are Uncapitalized Support raw Gradle repository names in the UI repository snippet card Jul 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cosmetic Issue is not harmful and affects only cosmatic part of a project enhancement Improvement of existing feature request
Projects
None yet
Development

No branches or pull requests

2 participants