dzikoysk / reposilite

Lightweight and easy-to-use repository management software dedicated for the Maven based artifacts in the JVM ecosystem 📦
https://reposilite.com
Apache License 2.0
1.34k stars 178 forks source link

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

Open sylv256 opened 1 month ago

sylv256 commented 1 month ago

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

dzikoysk commented 1 month ago

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 commented 1 month ago

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 commented 1 month ago

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 commented 1 month ago

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:

https://github.com/dzikoysk/reposilite/blob/65dc935e908962375d34b7fbc83c491a059db8e7/reposilite-frontend/src/store/placeholders.js#L17-L25

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:

https://github.com/dzikoysk/reposilite/blob/65dc935e908962375d34b7fbc83c491a059db8e7/reposilite-frontend/src/components/card/RepositorySnippet.vue#L34-L40