PowerShell / PSResourceGet

PSResourceGet is the package manager for PowerShell
https://www.powershellgallery.com/packages/Microsoft.PowerShell.PSResourceGet
MIT License
483 stars 92 forks source link

Find-PSResource cannot be used instead of Find-Package as it returns less NuGet package metadata #1547

Open denis-komarov opened 7 months ago

denis-komarov commented 7 months ago

Summary of the new feature / enhancement

It says here that "With this module, you no longer need to use PowerShellGet and PackageManagement", but this is impossible, because Find-PSResource returns less NuGet package metadata than Find-Package. Find-PSResource needs an option to control the required level of detail of a package's NuGet metadata so that it can provide the same level of detail that Find-Package currently provides.

Proposed technical implementation details (optional)

Find-PSResource vs. Find-Package - less NuGet package metadata is returned:

Find-PSResource -Type 'Module' -Name 'Newtonsoft.Json' -Repository 'NuGetGallery' -IncludeDependencies | Format-List -Property '*'

The result will be like this:

AdditionalMetadata       : {[NormalizedVersion, 13.0.3]}
Author                   : James Newton-King
CompanyName              : James Newton-King
Copyright                :
Dependencies             : {}
Description              : Json.NET is a popular high-performance JSON framework for .NET
IconUri                  :
Includes                 : Microsoft.PowerShell.PSResourceGet.UtilClasses.ResourceIncludes
InstalledDate            :
InstalledLocation        :
IsPrerelease             : False
LicenseUri               : https://www.nuget.org/packages/Newtonsoft.Json/13.0.3/license
Name                     : Newtonsoft.Json
Prerelease               :
ProjectUri               : https://www.newtonsoft.com/json
PublishedDate            : 08.03.2023 10:42:54
ReleaseNotes             :
Repository               : NuGetGallery
RepositorySourceLocation : https://api.nuget.org/v3/index.json
Tags                     : {json}
Type                     : None
UpdatedDate              :
Version                  : 13.0.3

WARNING: Installing dependencies is not currently supported for V3 server protocol repositories. The package will be installed without installing dependencies.
Find-Package -Name 'Newtonsoft.Json' -ProviderName 'NuGet' -Source 'https://api.nuget.org/v3/index.json' | Format-List -Property '*'

The result will be like this:

PropertyOfSoftwareIdentity : PropertyOfSoftwareIdentity
FastPackageReference       : $aHR0cHM6Ly9hcGkubnVnZXQub3JnL3YzL2luZGV4Lmpzb24=\TmV3dG9uc29mdC5Kc29u\MTMuMC4z\aHR0cHM6Ly
                             9hcGkubnVnZXQub3JnL3YzL2luZGV4Lmpzb24=
ProviderName               : NuGet
Source                     : https://api.nuget.org/v3/index.json
Status                     : Available
SearchKey                  : Newtonsoft.Json
FullPath                   :
PackageFilename            : Newtonsoft.Json.13.0.3.nupkg
FromTrustedSource          : False
Summary                    : Json.NET is a popular high-performance JSON framework for .NET
SwidTags                   : {Newtonsoft.Json}
CanonicalId                : nuget:Newtonsoft.Json/13.0.3#https://api.nuget.org/v3/index.json
Metadata                   : {copyright,description,requireLicenseAcceptance,isLatestVersion,isAbsoluteLatestVersion,mi
                             nClientVersion,packageSize,published,created,lastEdited,tags,title,developmentDependency}
SwidTagText                : <?xml version="1.0" encoding="utf-16" standalone="yes"?>
                             <SoftwareIdentity
                               name="Newtonsoft.Json"
                               version="13.0.3"
                               versionScheme="semver"
                               tagId="Newtonsoft.Json#13.0.3"
                               xmlns="http://standards.iso.org/iso/19770/-2/2015/schema.xsd">
                               <Meta
                                 copyright="Copyright © James Newton-King 2008"
                                 description="Json.NET is a popular high-performance JSON framework for .NET"
                                 requireLicenseAcceptance="False"
                                 isLatestVersion="True"
                                 isAbsoluteLatestVersion="True"
                                 minClientVersion="2.12"
                                 packageSize="2441966"
                                 published="08.03.2023 7:42:54 +00:00"
                                 created="08.03.2023 7:42:54 +00:00"
                                 lastEdited="08.03.2023 7:46:03 +00:00"
                                 tags="json"
                                 title="Json.NET"
                                 developmentDependency="False" />
                               <Link
                                 href="nuget:Microsoft.CSharp/4.3.0"
                                 rel="requires" />
                               <Link
                                 href="nuget:NETStandard.Library/1.6.1"
                                 rel="requires" />
                               <Link
                                 href="nuget:System.ComponentModel.TypeConverter/4.3.0"
                                 rel="requires" />
                               <Link
                                 href="nuget:System.Runtime.Serialization.Primitives/4.3.0"
                                 rel="requires" />
                               <Link
                                 href="nuget:Microsoft.CSharp/4.3.0"
                                 rel="requires" />
                               <Link
                                 href="nuget:NETStandard.Library/1.6.1"
                                 rel="requires" />
                               <Link
                                 href="nuget:System.ComponentModel.TypeConverter/4.3.0"
                                 rel="requires" />
                               <Link
                                 href="nuget:System.Runtime.Serialization.Formatters/4.3.0"
                                 rel="requires" />
                               <Link
                                 href="nuget:System.Runtime.Serialization.Primitives/4.3.0"
                                 rel="requires" />
                               <Link
                                 href="nuget:System.Xml.XmlDocument/4.3.0"
                                 rel="requires" />
                               <Link
                                 href="https://licenses.nuget.org/MIT"
                                 rel="license" />
                               <Link
                                 href="https://www.newtonsoft.com/json"
                                 rel="project" />
                               <Link
                                 href="https://www.nuget.org/packages/newtonsoft.json/13.0.3/ReportAbuse"
                                 rel="abuse" />
                               <Link
                                 href="https://www.newtonsoft.com/content/images/nugeticon.png"
                                 rel="icon" />
                               <Link
                                 href="https://www.nuget.org/packages/newtonsoft.json/13.0.3"
                                 rel="galleryDetails" />
                               <Entity
                                 name="James Newton-King"
                                 regId="James Newton-King"
                                 role="author" />
                             </SoftwareIdentity>
Dependencies               : {nuget:Microsoft.CSharp/4.3.0, nuget:NETStandard.Library/1.6.1, nuget:System.ComponentMode
                             l.TypeConverter/4.3.0, nuget:System.Runtime.Serialization.Primitives/4.3.0…}
IsCorpus                   :
Name                       : Newtonsoft.Json
Version                    : 13.0.3
VersionScheme              : semver
TagVersion                 :
TagId                      : Newtonsoft.Json#13.0.3
IsPatch                    :
IsSupplemental             :
AppliesToMedia             :
Meta                       : {{copyright,description,requireLicenseAcceptance,isLatestVersion,isAbsoluteLatestVersion,m
                             inClientVersion,packageSize,published,created,lastEdited,tags,title,developmentDependency}
                             }
Links                      : {requires:nuget:Microsoft.CSharp/4.3.0, requires:nuget:NETStandard.Library/1.6.1, requires
                             :nuget:System.ComponentModel.TypeConverter/4.3.0, requires:nuget:System.Runtime.Serializat
                             ion.Primitives/4.3.0…}
Entities                   : {James Newton-King}
Payload                    :
Evidence                   :
Culture                    :
Attributes                 : {name,version,versionScheme,tagId}
SydneyhSmith commented 7 months ago

Thanks @denis-komarov is there a specific package detail that you are missing/need? or are you just looking for 1:1 parity?

denis-komarov commented 7 months ago

@SydneyhSmith thanks, in my case backwards compatibility was broken due to the missing PackageFilename field. It would be great if there was a way to get all the package metadata available through the NuGet V3 API.