Commit 3457281
authored
🩹 [Patch]: IsWindows PS 5.1 compatibility shim removed (#132)
Built modules no longer include the `$IsWindows = $true` shim or its
PSScriptAnalyzer suppression attributes. PSModule targets PowerShell LTS
(7.6+), where `$IsWindows` is a built-in automatic variable — the
Desktop edition fallback is unnecessary.
## Changed: Built module root files are smaller and cleaner
The generated `.psm1` files no longer contain the following block:
```powershell
[Diagnostics.CodeAnalysis.SuppressMessageAttribute(
'PSAvoidAssignmentToAutomaticVariable', 'IsWindows',
Justification = 'IsWindows does not exist in PS5.1'
)]
[Diagnostics.CodeAnalysis.SuppressMessageAttribute(
'PSUseDeclaredVarsMoreThanAssignments', 'IsWindows',
Justification = 'IsWindows does not exist in PS5.1'
)]
```
And the module post-header no longer includes:
```powershell
if ($PSEdition -eq 'Desktop') {
$IsWindows = $true
}
```
Modules built with this version require PowerShell 7.x+ (LTS). If you
need PS 5.1 support, pin Build-PSModule to v4.
## Technical Details
- `Build-PSModuleRootModule.ps1`: Removed the `Add-Content` call that
injected the two `SuppressMessageAttribute` entries and the empty
here-string left after their removal. Removed the `if ($PSEdition -eq
'Desktop')` block from the module post-header template.
- Companion PR in Test-PSModule removes the corresponding framework test
for this shim.1 parent 7a3ae1b commit 3457281
1 file changed
+0
-15
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
131 | 131 | | |
132 | 132 | | |
133 | 133 | | |
134 | | - | |
135 | | - | |
136 | | - | |
137 | | - | |
138 | | - | |
139 | | - | |
140 | | - | |
141 | | - | |
142 | | - | |
143 | | - | |
144 | | - | |
145 | 134 | | |
146 | 135 | | |
147 | 136 | | |
| |||
162 | 151 | | |
163 | 152 | | |
164 | 153 | | |
165 | | - | |
166 | | - | |
167 | | - | |
168 | | - | |
169 | 154 | | |
170 | 155 | | |
171 | 156 | | |
| |||
0 commit comments