1
0
Fork 0
mirror of https://codeberg.org/forgejo/forgejo.git synced 2024-11-24 08:57:03 -05:00

Add support for npm bundleDependencies (#30751)

(cherry picked from commit ad4e902d5a1430c0c1df18bf404537df5ded1dba)
This commit is contained in:
Micash 2024-04-29 10:19:06 +02:00 committed by Earl Warren
parent 96fd8008cd
commit b8e7b3941a
No known key found for this signature in database
GPG key ID: 0579CB2928A78A00
5 changed files with 14 additions and 0 deletions

View file

@ -78,6 +78,7 @@ type PackageMetadataVersion struct {
Repository Repository `json:"repository,omitempty"` Repository Repository `json:"repository,omitempty"`
Keywords []string `json:"keywords,omitempty"` Keywords []string `json:"keywords,omitempty"`
Dependencies map[string]string `json:"dependencies,omitempty"` Dependencies map[string]string `json:"dependencies,omitempty"`
BundleDependencies []string `json:"bundleDependencies,omitempty"`
DevDependencies map[string]string `json:"devDependencies,omitempty"` DevDependencies map[string]string `json:"devDependencies,omitempty"`
PeerDependencies map[string]string `json:"peerDependencies,omitempty"` PeerDependencies map[string]string `json:"peerDependencies,omitempty"`
Bin map[string]string `json:"bin,omitempty"` Bin map[string]string `json:"bin,omitempty"`
@ -218,6 +219,7 @@ func ParsePackage(r io.Reader) (*Package, error) {
ProjectURL: meta.Homepage, ProjectURL: meta.Homepage,
Keywords: meta.Keywords, Keywords: meta.Keywords,
Dependencies: meta.Dependencies, Dependencies: meta.Dependencies,
BundleDependencies: meta.BundleDependencies,
DevelopmentDependencies: meta.DevDependencies, DevelopmentDependencies: meta.DevDependencies,
PeerDependencies: meta.PeerDependencies, PeerDependencies: meta.PeerDependencies,
OptionalDependencies: meta.OptionalDependencies, OptionalDependencies: meta.OptionalDependencies,

View file

@ -16,6 +16,7 @@ type Metadata struct {
ProjectURL string `json:"project_url,omitempty"` ProjectURL string `json:"project_url,omitempty"`
Keywords []string `json:"keywords,omitempty"` Keywords []string `json:"keywords,omitempty"`
Dependencies map[string]string `json:"dependencies,omitempty"` Dependencies map[string]string `json:"dependencies,omitempty"`
BundleDependencies []string `json:"bundleDependencies,omitempty"`
DevelopmentDependencies map[string]string `json:"development_dependencies,omitempty"` DevelopmentDependencies map[string]string `json:"development_dependencies,omitempty"`
PeerDependencies map[string]string `json:"peer_dependencies,omitempty"` PeerDependencies map[string]string `json:"peer_dependencies,omitempty"`
OptionalDependencies map[string]string `json:"optional_dependencies,omitempty"` OptionalDependencies map[string]string `json:"optional_dependencies,omitempty"`

View file

@ -3573,6 +3573,7 @@ npm.install = To install the package using npm, run the following command:
npm.install2 = or add it to the package.json file: npm.install2 = or add it to the package.json file:
npm.dependencies = Dependencies npm.dependencies = Dependencies
npm.dependencies.development = Development Dependencies npm.dependencies.development = Development Dependencies
npm.dependencies.bundle = Bundled Dependencies
npm.dependencies.peer = Peer Dependencies npm.dependencies.peer = Peer Dependencies
npm.dependencies.optional = Optional Dependencies npm.dependencies.optional = Optional Dependencies
npm.details.tag = Tag npm.details.tag = Tag

View file

@ -64,6 +64,7 @@ func createPackageMetadataVersion(registryURL string, pd *packages_model.Package
Homepage: metadata.ProjectURL, Homepage: metadata.ProjectURL,
License: metadata.License, License: metadata.License,
Dependencies: metadata.Dependencies, Dependencies: metadata.Dependencies,
BundleDependencies: metadata.BundleDependencies,
DevDependencies: metadata.DevelopmentDependencies, DevDependencies: metadata.DevelopmentDependencies,
PeerDependencies: metadata.PeerDependencies, PeerDependencies: metadata.PeerDependencies,
OptionalDependencies: metadata.OptionalDependencies, OptionalDependencies: metadata.OptionalDependencies,

View file

@ -45,6 +45,15 @@
</div> </div>
{{end}} {{end}}
{{if .PackageDescriptor.Metadata.BundleDependencies}}
<h4 class="ui top attached header">{{ctx.Locale.Tr "packages.npm.dependencies.bundle"}}</h4>
<div class="ui attached segment">
{{range .PackageDescriptor.Metadata.BundleDependencies}}
{{.}}
{{end}}
</div>
{{end}}
{{if .PackageDescriptor.Metadata.Keywords}} {{if .PackageDescriptor.Metadata.Keywords}}
<h4 class="ui top attached header">{{ctx.Locale.Tr "packages.keywords"}}</h4> <h4 class="ui top attached header">{{ctx.Locale.Tr "packages.keywords"}}</h4>
<div class="ui attached segment"> <div class="ui attached segment">