From 1a9541e3f7f67109618b9bc1815149a8d9b87663 Mon Sep 17 00:00:00 2001 From: Sam Erde <20478745+SamErde@users.noreply.github.com> Date: Mon, 14 Sep 2026 16:59:56 -0400 Subject: [PATCH 1/2] =?UTF-8?q?=F0=9F=94=96=20packaging(module):=20prepare?= =?UTF-8?q?=20v2.2.0=20release?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> --- .vscode/tasks.json | 10 ++-- CHANGELOG.md | 24 ++++++++++ docs/MKDOCS-NAVIGATION-AUTOMATION.md | 2 +- src/PSPreworkout.build.ps1 | 69 ++++++++++++++++------------ src/PSPreworkout/PSPreworkout.psd1 | 4 +- 5 files changed, 71 insertions(+), 38 deletions(-) diff --git a/.vscode/tasks.json b/.vscode/tasks.json index 8f68150c..9cd6b220 100644 --- a/.vscode/tasks.json +++ b/.vscode/tasks.json @@ -199,14 +199,14 @@ { "label": "PesterTest", "type": "shell", - "command": "Invoke-Pester '${workspaceFolder}/src/Tests/Unit' -Output Detailed", + "command": "Import-Module Pester -RequiredVersion 5.9.1;Invoke-Pester '${workspaceFolder}/src/Tests/Unit' -Output Detailed", "problemMatcher": "$pester", "group": "test" }, { "label": "Pester-Single-Coverage", "type": "shell", - "command": "Import-Module -Name '${workspaceFolder}/src/${workspaceFolderBasename}/${workspaceFolderBasename}.psm1';$pesterConfig = New-PesterConfiguration;$pesterConfig.run.Path = '${workspaceFolder}/src/Tests/Unit/*/${input:functionName}.Tests.ps1';$pesterConfig.CodeCoverage.Enabled = $true;$pesterConfig.CodeCoverage.Path = '${workspaceFolder}/src/${workspaceFolderBasename}/*/${input:functionName}.ps1';Invoke-Pester -Configuration $pesterConfig", + "command": "Import-Module Pester -RequiredVersion 5.9.1;Import-Module -Name '${workspaceFolder}/src/${workspaceFolderBasename}/${workspaceFolderBasename}.psm1';$pesterConfig = New-PesterConfiguration;$pesterConfig.run.Path = '${workspaceFolder}/src/Tests/Unit/*/${input:functionName}.Tests.ps1';$pesterConfig.CodeCoverage.Enabled = $true;$pesterConfig.CodeCoverage.Path = '${workspaceFolder}/src/${workspaceFolderBasename}/*/${input:functionName}.ps1';Invoke-Pester -Configuration $pesterConfig", "problemMatcher": "$pester", "presentation": { "echo": false, @@ -217,7 +217,7 @@ { "label": "Pester-Single-Detailed", "type": "shell", - "command": "Import-Module -Name '${workspaceFolder}/src/${workspaceFolderBasename}/${workspaceFolderBasename}.psm1';Invoke-Pester '${workspaceFolder}/src/Tests/Unit/*/${input:functionName}.Tests.ps1' -Output Detailed", + "command": "Import-Module Pester -RequiredVersion 5.9.1;Import-Module -Name '${workspaceFolder}/src/${workspaceFolderBasename}/${workspaceFolderBasename}.psm1';Invoke-Pester '${workspaceFolder}/src/Tests/Unit/*/${input:functionName}.Tests.ps1' -Output Detailed", "problemMatcher": "$pester", "presentation": { "echo": false, @@ -228,7 +228,7 @@ { "label": "DevCC-Single", "type": "shell", - "command": "Import-Module -Name '${workspaceFolder}/src/${workspaceFolderBasename}/${workspaceFolderBasename}.psm1';$pesterConfig = New-PesterConfiguration;$pesterConfig.run.Path = '${workspaceFolder}/src/Tests/Unit/*/${input:functionName}.Tests.ps1';$pesterConfig.CodeCoverage.Enabled = $true;$pesterConfig.CodeCoverage.Path = '${workspaceFolder}/src/${workspaceFolderBasename}/*/${input:functionName}.ps1';$pesterConfig.CodeCoverage.OutputPath = '${workspaceFolder}/cov.xml';$pesterConfig.CodeCoverage.OutputFormat = 'CoverageGutters';Invoke-Pester -Configuration $pesterConfig", + "command": "Import-Module Pester -RequiredVersion 5.9.1;Import-Module -Name '${workspaceFolder}/src/${workspaceFolderBasename}/${workspaceFolderBasename}.psm1';$pesterConfig = New-PesterConfiguration;$pesterConfig.run.Path = '${workspaceFolder}/src/Tests/Unit/*/${input:functionName}.Tests.ps1';$pesterConfig.CodeCoverage.Enabled = $true;$pesterConfig.CodeCoverage.Path = '${workspaceFolder}/src/${workspaceFolderBasename}/*/${input:functionName}.ps1';$pesterConfig.CodeCoverage.OutputPath = '${workspaceFolder}/cov.xml';$pesterConfig.CodeCoverage.OutputFormat = 'CoverageGutters';Invoke-Pester -Configuration $pesterConfig", "problemMatcher": "$pester", "presentation": { "echo": false, @@ -239,7 +239,7 @@ { "label": "Integration-Single-Detailed", "type": "shell", - "command": "Import-Module -Name '${workspaceFolder}/src/${workspaceFolderBasename}/${workspaceFolderBasename}.psm1';Invoke-Pester '${workspaceFolder}/src/Tests/Integration/*/${input:functionName}.Tests.ps1' -Output Detailed", + "command": "Import-Module Pester -RequiredVersion 5.9.1;Import-Module -Name '${workspaceFolder}/src/${workspaceFolderBasename}/${workspaceFolderBasename}.psm1';Invoke-Pester '${workspaceFolder}/src/Tests/Integration/*/${input:functionName}.Tests.ps1' -Output Detailed", "problemMatcher": "$pester", "presentation": { "echo": false, diff --git a/CHANGELOG.md b/CHANGELOG.md index cc050af7..c1a262de 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,6 +14,30 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), --- +## [2.2.0] - 2026-09-14 + +### Added + +- `Update-AllTheThings` - Add support for updating the GitHub CLI and GitHub Copilot CLI. + +### Changed + +- `Update-AllTheThings` - Refactor update orchestration into focused package-manager, native-command, and PowerShell update helpers. +- `Update-AllTheThings` - Improve cross-platform behavior, progress reporting, command detection, and generated script consistency. +- Expand unit and compatibility test coverage for update orchestration, package managers, CLI updates, and Windows PowerShell 5.1 behavior. + +### Fixed + +- `Update-AllTheThings` - Preserve later update stages when WinGet is skipped and avoid misleading or duplicate confirmation prompts. + +### Security + +- `Update-AllTheThings` - Add safeguards around WinGet server detection and server-side CLI updates, including safe fallbacks for legacy hosts. + +[*Full Changelog*](https://github.com/SamErde/PSPreworkout/compare/v2.1.1...v2.2.0) + +--- + ## [2.1.1] - 2026-05-11 ### Changed diff --git a/docs/MKDOCS-NAVIGATION-AUTOMATION.md b/docs/MKDOCS-NAVIGATION-AUTOMATION.md index ce4d69ee..15bdfeaf 100644 --- a/docs/MKDOCS-NAVIGATION-AUTOMATION.md +++ b/docs/MKDOCS-NAVIGATION-AUTOMATION.md @@ -136,7 +136,7 @@ To change which category a function belongs to: ```powershell # Run the Pester tests -Import-Module Pester +Import-Module Pester -RequiredVersion 5.9.1 Invoke-Pester -Path ./src/Tests/Unit/Update-MkDocsNavigation.Tests.ps1 ``` diff --git a/src/PSPreworkout.build.ps1 b/src/PSPreworkout.build.ps1 index 429bf0c4..bf5d89f8 100644 --- a/src/PSPreworkout.build.ps1 +++ b/src/PSPreworkout.build.ps1 @@ -92,11 +92,41 @@ Enter-Build { # Ensure our builds fail until if below a minimum defined code test coverage threshold $script:coverageThreshold = 30 - [version]$script:MinPesterVersion = '5.2.2' - [version]$script:MaxPesterVersion = '5.99.99' + [version]$script:PesterVersion = '5.9.1' $script:testOutputFormat = 'NUnitXML' } #Enter-Build +<# +.SYNOPSIS + Imports the exact Pester version required by the build. +.DESCRIPTION + Reuses a matching Pester module already loaded in the current process and + rejects other versions because PowerShell cannot unload Pester assemblies. +.OUTPUTS + System.Management.Automation.PSModuleInfo +#> +function Import-BuildPester { + [CmdletBinding()] + param() + + $loadedPester = Get-Module -Name Pester | + Sort-Object -Property Version -Descending | + Select-Object -First 1 + + if ($loadedPester) { + if ($loadedPester.Version -ne $script:PesterVersion) { + throw "Loaded Pester version $($loadedPester.Version) does not match the required version $script:PesterVersion." + } + + return $loadedPester + } + + Import-Module -Name Pester -RequiredVersion $script:PesterVersion -ErrorAction Stop + Get-Module -Name Pester | + Sort-Object -Property Version -Descending | + Select-Object -First 1 +} #Import-BuildPester + # Define headers as separator, task path, synopsis, and location, e.g. for Ctrl+Click in VSCode. # Also change the default color to Green. If you need task start times, use `$Task.Started`. Set-BuildHeader { @@ -311,18 +341,8 @@ Add-BuildTask FormattingCheck { #Synopsis: Invokes all Pester Unit Tests in the Tests\Unit folder (if it exists) Add-BuildTask Test { - Write-Build White " Importing desired Pester version. Min: $script:MinPesterVersion Max: $script:MaxPesterVersion" - $loadedPester = Get-Module -Name Pester | - Sort-Object -Property Version -Descending | - Select-Object -First 1 - if (-not $loadedPester) { - Import-Module -Name Pester -MinimumVersion $script:MinPesterVersion -MaximumVersion $script:MaxPesterVersion -ErrorAction 'Stop' - } elseif ( - $loadedPester.Version -lt $script:MinPesterVersion -or - $loadedPester.Version -gt $script:MaxPesterVersion - ) { - throw "Loaded Pester version $($loadedPester.Version) is outside the supported range." - } + Write-Build White " Importing required Pester version: $script:PesterVersion" + $null = Import-BuildPester $codeCovPath = "$script:ArtifactsPath\ccReport\" $testOutPutPath = "$script:ArtifactsPath\testOutput\" @@ -388,18 +408,8 @@ Add-BuildTask Test { #Synopsis: Used primarily during active development to generate xml file to graphically display code coverage in VSCode using Coverage Gutters Add-BuildTask DevCC { Write-Build White ' Generating code coverage report at root...' - Write-Build White " Importing desired Pester version. Min: $script:MinPesterVersion Max: $script:MaxPesterVersion" - $loadedPester = Get-Module -Name Pester | - Sort-Object -Property Version -Descending | - Select-Object -First 1 - if (-not $loadedPester) { - Import-Module -Name Pester -MinimumVersion $script:MinPesterVersion -MaximumVersion $script:MaxPesterVersion -ErrorAction 'Stop' - } elseif ( - $loadedPester.Version -lt $script:MinPesterVersion -or - $loadedPester.Version -gt $script:MaxPesterVersion - ) { - throw "Loaded Pester version $($loadedPester.Version) is outside the supported range." - } + Write-Build White " Importing required Pester version: $script:PesterVersion" + $null = Import-BuildPester $pesterConfiguration = New-PesterConfiguration $pesterConfiguration.run.Path = $script:UnitTestsPath $pesterConfiguration.CodeCoverage.Enabled = $true @@ -530,7 +540,7 @@ Add-BuildTask UpdateCBH -After AssetCopy { #> "@ - $CBHPattern = '(?ms)(\<#.*\.SYNOPSIS.*?#>)' + $CBHPattern = '(?ms)(\<#.*?\.SYNOPSIS.*?#>)' Get-ChildItem -Path "$script:ArtifactsPath\Public\*.ps1" -File | ForEach-Object { $FormattedOutFile = $_.FullName Write-Output " Replacing CBH in file: $($FormattedOutFile)" @@ -597,9 +607,8 @@ Add-BuildTask Build { #Synopsis: Invokes all Pester Integration Tests in the Tests\Integration folder (if it exists) Add-BuildTask IntegrationTest { if (Test-Path -Path $script:IntegrationTestsPath) { - Write-Build White " Importing desired Pester version. Min: $script:MinPesterVersion Max: $script:MaxPesterVersion" - Remove-Module -Name Pester -Force -ErrorAction SilentlyContinue # there are instances where some containers have Pester already in the session - Import-Module -Name Pester -MinimumVersion $script:MinPesterVersion -MaximumVersion $script:MaxPesterVersion -ErrorAction 'Stop' + Write-Build White " Importing required Pester version: $script:PesterVersion" + $null = Import-BuildPester Write-Build White " Performing Pester Integration Tests in $($invokePesterParams.path)" diff --git a/src/PSPreworkout/PSPreworkout.psd1 b/src/PSPreworkout/PSPreworkout.psd1 index 5ab14f97..d8bb6b8e 100644 --- a/src/PSPreworkout/PSPreworkout.psd1 +++ b/src/PSPreworkout/PSPreworkout.psd1 @@ -3,7 +3,7 @@ RootModule = 'PSPreworkout.psm1' # Version number of this module. - ModuleVersion = '2.1.1' + ModuleVersion = '2.2.0' # Supported PSEditions = @('Desktop', 'Core') CompatiblePSEditions = @('Core', 'Desktop') @@ -99,7 +99,7 @@ IconUri = 'https://raw.githubusercontent.com/SamErde/PSPreworkout/main/media/PSPreworkout-Animated-Logo-170.png' # ReleaseNotes of this module - ReleaseNotes = 'See for more information.' + ReleaseNotes = 'See https://github.com/SamErde/PSPreworkout/compare/v2.1.1...v2.2.0 for release notes.' # Prerelease string of this module # Prerelease = 'preview' From 277060cc628b3e038e54490301a5e41bee22b37a Mon Sep 17 00:00:00 2001 From: Sam Erde <20478745+SamErde@users.noreply.github.com> Date: Mon, 14 Sep 2026 22:46:39 -0400 Subject: [PATCH 2/2] =?UTF-8?q?=F0=9F=90=9B=20fix(build):=20resolve=20PR?= =?UTF-8?q?=20review=20feedback?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Add missing [2.2.0] changelog reference-link definition - Validate all loaded Pester modules, not just the highest version Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> --- CHANGELOG.md | 1 + src/PSPreworkout.build.ps1 | 13 +++++++------ 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c1a262de..6e086125 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -515,3 +515,4 @@ This release is focused on enhancements that make the existing functions more us [2.0.0]: https://github.com/SamErde/PSPreworkout/tag/v2.0.0 [2.1.0]: https://github.com/SamErde/PSPreworkout/tag/v2.1.0 [2.1.1]: https://github.com/SamErde/PSPreworkout/tag/v2.1.1 +[2.2.0]: https://github.com/SamErde/PSPreworkout/tag/v2.2.0 diff --git a/src/PSPreworkout.build.ps1 b/src/PSPreworkout.build.ps1 index bf5d89f8..78e9cf71 100644 --- a/src/PSPreworkout.build.ps1 +++ b/src/PSPreworkout.build.ps1 @@ -109,16 +109,17 @@ function Import-BuildPester { [CmdletBinding()] param() - $loadedPester = Get-Module -Name Pester | - Sort-Object -Property Version -Descending | - Select-Object -First 1 + $loadedPester = @(Get-Module -Name Pester) if ($loadedPester) { - if ($loadedPester.Version -ne $script:PesterVersion) { - throw "Loaded Pester version $($loadedPester.Version) does not match the required version $script:PesterVersion." + $mismatchedPester = @($loadedPester | Where-Object { $_.Version -ne $script:PesterVersion }) + if ($mismatchedPester) { + throw "Loaded Pester version(s) $($mismatchedPester.Version -join ', ') do not match the required version $script:PesterVersion." } - return $loadedPester + return $loadedPester | + Sort-Object -Property Version -Descending | + Select-Object -First 1 } Import-Module -Name Pester -RequiredVersion $script:PesterVersion -ErrorAction Stop