PSResourceGet icon indicating copy to clipboard operation
PSResourceGet copied to clipboard

Allow Update-PSModuleManifest to remove pre-release tag

Open fourpastmidnight opened this issue 2 years ago • 1 comments

Summary of the new feature / enhancement

I am a module author. Until recently, I have been using the BuildHeplers module from GitHub user RamblingCookieMonster. One thing that module has is the ability to update the module manifest, though, it has limitations.

So I was perusing the code of this project and came across the UpdateModuleManifest.cs class. And lo and behold, it's a cmdlet! Awesome, I can remove my projects' dependency on BuildHelpers, which is all but abandonware at this point.

But then I came across these lines of code in UpdateModuleManifest.cs:

https://github.com/PowerShell/PSResourceGet/blob/e71e500d3aa964d39fb29598a1f3427ccabb75c1/src/code/UpdateModuleManifest.cs#L233-L234

So now I'm left wondering, as a module author, how would I go about, in an automated fashion—during a build, for example—removing a pre-release tag when my module goes GA?

Proposed technical implementation details (optional)

Since this cmdlet is meant to update a module's manifest, I would expect that I could execute the following to effectively move to a GA status, using this project as an example:

Update-PSModuleManifest -Path './src/MIcrosoft.PowerShell.PSResourceGet.psd1' -Version 0.5.25 -PreRelease ''

This bumps the version of the module to the next patch version and removes the pre-release tag in the metadata section of the module manifest.

So the proposed change is the removal of the [ValidateNotNullOrEmpty] attribute from this parameter property of the cmdlet.

fourpastmidnight avatar Sep 07 '23 16:09 fourpastmidnight

Lol, I see that this attribute was just recently added to the 0.5.24-beta24 release! However, the commit for this change is lacking any context: why was the change made? What was the issue being resolved? I think I have demonstrated a case for why an empty string for the -PreRelease parameter may be valid. But obviously, some other course of action would need to be taken in the face of an empty string: if Prerelease is already non-existent, or empty, do nothing, otherwise, make it empty or remove it altogether.

fourpastmidnight avatar Sep 07 '23 17:09 fourpastmidnight