-
Notifications
You must be signed in to change notification settings - Fork 86
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use placeholder for version in script source #154
Use placeholder for version in script source #154
Conversation
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 |
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 My typical testing process is to do: > .\Build\Build-Module.ps1
> Import-Module .\Locksmith.psd1 -Force
> Invoke-Locksmith
<cool shtuff...> but this loads 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. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tested! Works as expected!
@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)
.