From bd1412c3afa9418a973af44bbffa416db7b63910 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Carlos?= Date: Sat, 3 Sep 2022 21:11:03 +0200 Subject: [PATCH] Add Dev, Peer and Optional dependencies to npm PackageMetadataVersion (#21017) (#21044) Backport #21017 Set DevDependencies, PeerDependencies & OptionalDependencies in npm package metadatas Fix https://github.com/go-gitea/gitea/issues/21013 --- routers/api/packages/npm/api.go | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/routers/api/packages/npm/api.go b/routers/api/packages/npm/api.go index 4b6b80397..763c59515 100644 --- a/routers/api/packages/npm/api.go +++ b/routers/api/packages/npm/api.go @@ -55,15 +55,18 @@ func createPackageMetadataVersion(registryURL string, pd *packages_model.Package metadata := pd.Metadata.(*npm_module.Metadata) return &npm_module.PackageMetadataVersion{ - ID: fmt.Sprintf("%s@%s", pd.Package.Name, pd.Version.Version), - Name: pd.Package.Name, - Version: pd.Version.Version, - Description: metadata.Description, - Author: npm_module.User{Name: metadata.Author}, - Homepage: metadata.ProjectURL, - License: metadata.License, - Dependencies: metadata.Dependencies, - Readme: metadata.Readme, + ID: fmt.Sprintf("%s@%s", pd.Package.Name, pd.Version.Version), + Name: pd.Package.Name, + Version: pd.Version.Version, + Description: metadata.Description, + Author: npm_module.User{Name: metadata.Author}, + Homepage: metadata.ProjectURL, + License: metadata.License, + Dependencies: metadata.Dependencies, + DevDependencies: metadata.DevelopmentDependencies, + PeerDependencies: metadata.PeerDependencies, + OptionalDependencies: metadata.OptionalDependencies, + Readme: metadata.Readme, Dist: npm_module.PackageDistribution{ Shasum: pd.Files[0].Blob.HashSHA1, Integrity: "sha512-" + base64.StdEncoding.EncodeToString(hashBytes),