feat!: prepare version 5.0.0 with a valid module manifest
- Require Windows PowerShell 5.1 or PowerShell 7 (PowerShellVersion
5.1, which CompatiblePSEditions needs) and .NET Framework 4.5.2, and
use RootModule instead of the deprecated ModuleToProcess. Before,
Test-ModuleManifest, and with it Publish-Module, failed.
- Export exactly the 36 cmdlets: remove Show-NTFSSimpleAccess, which no
longer exists, and the duplicate inheritance cmdlets.
- Keep -PassThur, the name in 4.2.6 and earlier, as an alias of
Remove-Item2 -PassThru, deprecated in the changelog.
- Set version 5.0.0 in the manifest, in NTFSSecurity, Security2, and
PrivilegeControl, and in a new 5.0.0 section of CHANGELOG.md.
- Tests/Manifest.Tests.ps1 and Tests/Remove-Item2.Tests.ps1 guard the
manifest, the versions, and the alias.
BREAKING CHANGE: the module requires Windows PowerShell 5.1 or
PowerShell 7; the manifest no longer claims PowerShell 2.0.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: AI Assistant <ai@example.com>
4 weeks ago
<#
Tests the module manifest of the module built in NTFSSecurity \ bin \ Release : it passes Test-ModuleManifest ,
ci: publish releases from CI on a version tag, starting with 5.0.0-rc1
Pushing a tag such as 5.0.0 or 5.0.0-rc1 on master now publishes the
package that the build job built and tested to the PowerShell Gallery
and creates the GitHub release with NTFSSecurity.zip.
- New-ModulePackage.ps1 copies only the FileList files of the Release
build, so no debug symbols, XML documentation, or copy of
System.Management.Automation.dll ship. It builds the nupkg with
Compress-PSResource and adds the command tags (PSIncludes_Cmdlet,
PSCmdlet_*, PSCommand_*) that PSResourceGet leaves out and that the
Gallery uses to list cmdlets and that Find-Command searches. Every CI
run builds and uploads the packages.
- Get-ReleaseInfo.ps1 returns the version and release notes: a dated
CHANGELOG section for a release, the [Unreleased] section for a
prerelease.
- The release job checks that the tag matches the manifest version and
points to a commit on master, reads the API key from the environment
powershell-gallery, and skips steps already done, so a rerun is safe.
- The manifest gets the prerelease label rc1 and a release notes link;
the 5.0.0 changelog entries move back to [Unreleased] until the final
release.
- Tests/Release.Tests.ps1 covers both scripts and the packages; the
changelog check moves there from Manifest.Tests.ps1.
- Docs/Contributing/05-Releasing.md describes the one-time setup and the
release steps; Docs/README.md explains -AllowPrerelease.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: AI Assistant <ai@example.com>
4 weeks ago
exports exactly the cmdlets of the module , and carries the same version as the assemblies . Release . Tests . ps1
checks that CHANGELOG . md describes that version .
feat!: prepare version 5.0.0 with a valid module manifest
- Require Windows PowerShell 5.1 or PowerShell 7 (PowerShellVersion
5.1, which CompatiblePSEditions needs) and .NET Framework 4.5.2, and
use RootModule instead of the deprecated ModuleToProcess. Before,
Test-ModuleManifest, and with it Publish-Module, failed.
- Export exactly the 36 cmdlets: remove Show-NTFSSimpleAccess, which no
longer exists, and the duplicate inheritance cmdlets.
- Keep -PassThur, the name in 4.2.6 and earlier, as an alias of
Remove-Item2 -PassThru, deprecated in the changelog.
- Set version 5.0.0 in the manifest, in NTFSSecurity, Security2, and
PrivilegeControl, and in a new 5.0.0 section of CHANGELOG.md.
- Tests/Manifest.Tests.ps1 and Tests/Remove-Item2.Tests.ps1 guard the
manifest, the versions, and the alias.
BREAKING CHANGE: the module requires Windows PowerShell 5.1 or
PowerShell 7; the manifest no longer claims PowerShell 2.0.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: AI Assistant <ai@example.com>
4 weeks ago
#>
[ Diagnostics . CodeAnalysis . SuppressMessageAttribute (
'PSUseDeclaredVarsMoreThanAssignments' , '' , Justification = 'Pester shares variables between blocks.'
) ]
param ( )
BeforeDiscovery {
# The first-party assemblies of the module carry the module version; ProcessPrivileges is a vendored library.
$versionedAssemblies = 'NTFSSecurity' , 'Security2' , 'PrivilegeControl'
}
Describe 'Module manifest of NTFSSecurity' {
BeforeAll {
$manifestPath = Join-Path -Path $PSScriptRoot -ChildPath '..\NTFSSecurity\bin\Release\NTFSSecurity.psd1'
$manifest = Import-PowerShellDataFile -Path $manifestPath
$module = Import-Module -Name $manifestPath -Force -PassThru -ErrorAction Stop |
Where-Object -Property Name -EQ -Value 'NTFSSecurity'
}
AfterAll {
Remove-Module -Name NTFSSecurity -Force -ErrorAction SilentlyContinue
}
It 'Should pass Test-ModuleManifest without errors or warnings' {
$testParameters = @ {
Path = $manifestPath
ErrorVariable = 'manifestErrors'
WarningVariable = 'manifestWarnings'
ErrorAction = 'SilentlyContinue'
WarningAction = 'SilentlyContinue'
}
$null = Test-ModuleManifest @testParameters
@ ( $manifestErrors ) + @ ( $manifestWarnings ) | ForEach-Object -Process { " $ _ " } | Should -BeNullOrEmpty
}
It 'Should list each cmdlet only once in CmdletsToExport' {
$duplicates = $manifest . CmdletsToExport | Group-Object | Where-Object -Property Count -GT -Value 1
$duplicates . Name | Should -BeNullOrEmpty
}
It 'Should list only cmdlets of the module in CmdletsToExport' {
$manifest . CmdletsToExport | Where-Object -FilterScript { -not $module . ExportedCmdlets . ContainsKey ( $_ ) } |
Should -BeNullOrEmpty
}
It 'Should export exactly 36 cmdlets' {
@ ( $manifest . CmdletsToExport ) | Should -HaveCount 36
$module . ExportedCmdlets . Keys | Should -HaveCount 36
}
Context 'Version' {
It 'Should give <_>.dll the module version' -ForEach $versionedAssemblies {
$assemblyPath = Join-Path -Path $module . ModuleBase -ChildPath " $ _.dll "
$assemblyVersion = [Reflection.AssemblyName] :: GetAssemblyName ( $assemblyPath ) . Version
$fileVersion = [version] ( Get-Item -LiteralPath $assemblyPath ) . VersionInfo . FileVersion
$assemblyVersion . ToString ( 3 ) | Should -BeExactly $manifest . ModuleVersion
$fileVersion . ToString ( 3 ) | Should -BeExactly $manifest . ModuleVersion
}
}
}
Describe 'Type data of NTFSSecurity' {
BeforeDiscovery {
# Only Windows PowerShell fails to import type data that conflicts with an existing member, so both CI legs
# start it.
$windowsPowerShell = Join-Path -Path $env:SystemRoot -ChildPath 'System32\WindowsPowerShell\v1.0\powershell.exe'
}
BeforeAll {
$windowsPowerShell = Join-Path -Path $env:SystemRoot -ChildPath 'System32\WindowsPowerShell\v1.0\powershell.exe'
}
# Before 5.0.0, the types file added the alias Size to System.IO.FileInfo, so the import failed when another module
# had added a member with that name (#82). The module is imported in a child process, because type data stays in a
# session.
It 'Should import in Windows PowerShell after another module added a Size member to System.IO.FileInfo' -Skip : ( -not ( Test-Path -LiteralPath $windowsPowerShell ) ) {
$manifestPath = Join-Path -Path $PSScriptRoot -ChildPath '..\NTFSSecurity\bin\Release\NTFSSecurity.psd1'
$manifestPath | Should -Exist
$quotedPath = $manifestPath . Replace ( " ' " , " '' " )
$command = 'Update-TypeData -TypeName System.IO.FileInfo -MemberType AliasProperty -MemberName Size -Value Length -Force; ' +
( " Import-Module -Name '{0}' -ErrorAction Stop; " -f $quotedPath ) +
( " if ((Get-Item -LiteralPath '{0}').PSObject.Properties['LengthOnDisk']) {{ 'IMPORTED' }} " -f $quotedPath )
$output = & $windowsPowerShell -NoProfile -NonInteractive -Command $command 2 > & 1
$output | Select-Object -Last 1 | Should -Be 'IMPORTED'
}
}