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

feat: link to nuget dependencies #26554

Merged
merged 4 commits into from
Jan 1, 2025
Merged

Conversation

lonix1
Copy link
Contributor

@lonix1 lonix1 commented Aug 17, 2023

Add links to dependencies and their versions, as done in nuget site. Makes it easier to use.

cc @KN4CK3R

@pull-request-size pull-request-size bot added the size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. label Aug 17, 2023
@GiteaBot GiteaBot added the lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. label Aug 17, 2023
@KN4CK3R
Copy link
Member

KN4CK3R commented Aug 17, 2023

Not every dependecy is hosted on nuget.org

@lonix1
Copy link
Contributor Author

lonix1 commented Aug 17, 2023

Good point!

Do you think there's a way to detect that?

@silverwind
Copy link
Member

silverwind commented Aug 19, 2023

Looking at a nuspec file, dependencies do not list their URL there, so I'm afraid it's not possible to know where a package is hosted. Question is thought if we could accept potentially being wrong with these URLs.

<dependency id="Microsoft.CSharp" version="4.3.0" exclude="Build,Analyzers" />

@silverwind
Copy link
Member

On the other hand, how do private dependencies look in the nuspec file? I assume there must be some kind of URL so the package is able to be retrieved. If that is so, you can distinguish private packages.

@lonix1
Copy link
Contributor Author

lonix1 commented Aug 19, 2023

I suspect you are right there is no way to extract the URL (but I don't know for sure!). So I can delete this PR if you agree.

However, if that is the case, how does nuget do it? Each package on nuget links to other packages. So they just assume everything is on nuget? I guess when you are as big as Microsoft you can make those assumptions and get away with it! :-)

@silverwind
Copy link
Member

So they just assume everything is on nuget

I think that must be the case, yes. So until the package metadata gains a field to specify registry, there can only be guessing.

I still think a bad guess is better than no link, so I can accept this nonetheless.

@GiteaBot GiteaBot added lgtm/need 1 This PR needs approval from one additional maintainer to be merged. and removed lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. labels Aug 20, 2023
@lafriks
Copy link
Member

lafriks commented Aug 20, 2023

Maybe we can check first if it is local dependency in this instance and link to it and only use nuget.org as fallback?

@silverwind
Copy link
Member

silverwind commented Aug 20, 2023

Maybe we can check first if it is local dependency in this instance and link to it and only use nuget.org as fallback?

Great idea. That would be ideal, yes.

@lonix1
Copy link
Contributor Author

lonix1 commented Aug 21, 2023

Maybe we can check first if it is local dependency in this instance and link to it and only use nuget.org as fallback?

So that I understand, let's say you have package MyOrg.Server with dependencies:

  • Microsoft.Foo
  • Microsoft.Bar
  • ThirdParty.Foo
  • MyOrg.Utils
  • MyOrg.Common

Then MyOrg.* would be found in the gitea instance and so links would be created as I noted above. But the rest would not be found, so one would create links to nuget instead?

(If that's the case, I'm not a go dev, so I don't know how to improve this PR... sorry!)

@silverwind
Copy link
Member

silverwind commented Aug 21, 2023

Yes, correct. I estimate that the majority of use cases of private packages are with a single local registry with fallback to an official one. Multiple private registries could only be supported with additional metadata in the package's dependencies.

@silverwind
Copy link
Member

silverwind commented Aug 21, 2023

@KN4CK3R I think such a linkification would be nice for all package registries. Check if dependency exists in local registry, link there if it exists, otherwise link to official registry.

@wxiaoguang
Copy link
Contributor

I agree with some options above: such link for all packages is not ideal. Especially it might confuse and scare users who are using private packages and care about privacy a lot.

Maybe a better (but still not ideal) solution is to add a separate link "Search it in NuGet Gallery"

@silverwind
Copy link
Member

silverwind commented Sep 4, 2023

A link won't hurt anyone, I suppose.

We could decorate it with link-external to reinforce that it's external.

@github-actions github-actions bot added the modifies/templates This PR modifies the template files label Jan 1, 2025
@wxiaoguang
Copy link
Contributor

image

@GiteaBot GiteaBot added lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore. and removed lgtm/need 1 This PR needs approval from one additional maintainer to be merged. labels Jan 1, 2025
@wxiaoguang wxiaoguang added this to the 1.24.0 milestone Jan 1, 2025
@wxiaoguang wxiaoguang merged commit d030cac into go-gitea:main Jan 1, 2025
26 checks passed
@wxiaoguang wxiaoguang added the type/enhancement An improvement of existing functionality label Jan 1, 2025
@lonix1 lonix1 deleted the lonix1-patch-2 branch January 1, 2025 14:58
zjjhot added a commit to zjjhot/gitea that referenced this pull request Jan 2, 2025
* giteaofficial/main:
  [skip ci] Updated translations via Crowdin
  unset XDG_HOME_CONFIG as gitea manages configuration locations (go-gitea#33067)
  Refactor repo-new.ts (go-gitea#33070)
  Refactor pull-request compare&create page (go-gitea#33071)
  feat: link to nuget dependencies (go-gitea#26554)
  Remove some unnecessary template helpers (go-gitea#33069)
  Inherit submodules from template repository content (go-gitea#16237)
  [skip ci] Updated translations via Crowdin
  feat(action): issue change title notifications (go-gitea#33050)
  Use project's redirect url instead of composing url (go-gitea#33058)
  Fix unittest and repo create bug (go-gitea#33061)
  Fix locale type (go-gitea#33059)
  Refactor maven package registry (go-gitea#33049)
  Optimize the installation page (go-gitea#32994)
  [Feature] Private README.md for organization (go-gitea#32872)
  Make issue suggestion work for new PR page (go-gitea#33035)
  Add IntelliJ Gateway's .uuid to gitignore (go-gitea#33052)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore. modifies/templates This PR modifies the template files modifies/translation size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. type/enhancement An improvement of existing functionality
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants