potatoqualitee / psmodulecache

This action makes caching PowerShell modules from the PowerShell Gallery easy for Linux, Windows and macOS runners.
MIT License
31 stars 12 forks source link

'Prerelease Modules' parameter can returns a stable module version. #52

Closed LaurentDardenne closed 1 year ago

LaurentDardenne commented 1 year ago

The contents of the repositories used for the tests: image

In this case (module duplication) the result is false, we get a version that is not a prerelease: image

A bug in PowershellGet forces you to specify the -AllowPrerelease -AllVersions parameters when calling Find-Module, then to filter on the AdditionalMetadata.IsPrerelease property (of type string).

Who will encounter this problem? Nobody or very few people, but even if it means coding as much as doing it correctly ( as much as possible :-) )
Edit : this is by design,we must filter the result on the AdditionalMetadata.IsPrerelease property

LaurentDardenne commented 1 year ago

This bug and the default behavior involves fixing both types of research (stable version and prerelease version).

LaurentDardenne commented 1 year ago

In fact during the development of the next version (6.0) I intended to limit the result of the parameter 'modules-to-cache' to stable versions (which is already the case) and to limit the result of the parameter 'modules-to-cache-prerelease' to the prerelease version ONLY. Find-Module -AllowPrerelease returns the latest stable version OR the latest prerelease, this query returns the latest published version. To know the latest prerelease version, you must retrieve all versions (-AllVersions) then filter on the AdditionalMetadata.IsPrerelease property. As this can be penalizing I leave the default behavior, namely that of Find-Module.

In addition for a local repository (Share) property management, isLatestVersion, IsPrerelease, isAbsoluteLatestVersion is wrong.