Skip to content

Commit b66b15e

Browse files
refactor: remove IsWindows PS 5.1 compatibility shim
PSModule targets PowerShell LTS (7.6+) where $IsWindows is a built-in automatic variable. The Desktop edition shim and its PSScriptAnalyzer suppressions are no longer needed.
1 parent 7a3ae1b commit b66b15e

File tree

1 file changed

+0
-15
lines changed

1 file changed

+0
-15
lines changed

src/helpers/Build/Build-PSModuleRootModule.ps1

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -131,17 +131,6 @@ $MyInvocation.MyCommand.ScriptBlock.Module.OnRemove = {
131131
#endregion - Analyze source files
132132

133133
#region - Module header
134-
Add-Content -Path $rootModuleFile -Force -Value @'
135-
[Diagnostics.CodeAnalysis.SuppressMessageAttribute(
136-
'PSAvoidAssignmentToAutomaticVariable', 'IsWindows',
137-
Justification = 'IsWindows does not exist in PS5.1'
138-
)]
139-
[Diagnostics.CodeAnalysis.SuppressMessageAttribute(
140-
'PSUseDeclaredVarsMoreThanAssignments', 'IsWindows',
141-
Justification = 'IsWindows does not exist in PS5.1'
142-
)]
143-
'@
144-
145134
$headerFilePath = Join-Path -Path $ModuleOutputFolder -ChildPath 'header.ps1'
146135
if (Test-Path -Path $headerFilePath) {
147136
Get-Content -Path $headerFilePath -Raw | Add-Content -Path $rootModuleFile -Force
@@ -162,10 +151,6 @@ $script:PSModuleInfo | Format-List | Out-String -Stream | ForEach-Object { Write
162151
$scriptName = $script:PSModuleInfo.Name
163152
Write-Debug "[$scriptName] - Importing module"
164153
165-
if ($PSEdition -eq 'Desktop') {
166-
$IsWindows = $true
167-
}
168-
169154
'@
170155
#endregion - Module post-header
171156

0 commit comments

Comments
 (0)