Closed SamErde closed 3 months ago
Thanks for building this idea so quickly, @PrzemyslawKlys!
This is awesome.
It seems to be updating the version number in all the correct locations except Private/Invoke-Locksmith.ps1
. I'm not sure if that's a you thing or a PSPublishModule thing. We'll look into it tomorrow.
There isn't an Invoke-Locksmith.ps1 in Private.
New-Dictionary.ps1 is versioned separately from the module version. Maybe that's what you saw?
I meant Public
, but I see why it needs to remained as a placeholder. This is a me problem. :D
My typical testing process is to do:
> .\Build\Build-Module.ps1
> Import-Module .\Locksmith.psd1 -Force
> Invoke-Locksmith
<cool shtuff...>
but this loads Public\Invoke-Locksmith.ps1
Instead, I should be doing is:
> .\Build\Build-Module.ps1
> Import-Module .\Artefacts\Unpacked\Locksmith\Locksmith.psd1 -Force
> Invoke-Locksmith
<cool shtuff...>
I have updated my testing procedures!
I would say you need to run it as you were and just "ignore" placeholders knowing they will be fixed, unless you specifically test for the placeholder replacement. Building artefacts just for running your code adds seconds/minutes to your testing.
@PrzemyslawKlys that's fair, but I still build every time anyway as a check against me making stupid mistakes. It takes about 6 seconds to build, and I give myself a little sip of coffee when I test. 😄
The latest release of PSPublishModule adds supports for code placeholders that get replaced during the build process. Placeholders and their replacements can be defined in .\Build\Build-Module.ps1 and there are also a number of predefined placeholders.
This PR takes advantage of the predefined placeholder which gets automatically replaced with the ModuleVersion value from the manifest.
I also added a $CalVer parameter to Build-Module.ps1 so a version can be manually specified (uses
.\Build\Build-Module.ps1 -CalVer '2024.8.15'
). If this parameter is not used, the build will automatically be versioned by(Get-Date -format yyyy.M)
.