diff --git a/.github/workflows/Process-PSModule.yml b/.github/workflows/Process-PSModule.yml index 2ace30f..b81c41b 100644 --- a/.github/workflows/Process-PSModule.yml +++ b/.github/workflows/Process-PSModule.yml @@ -19,10 +19,9 @@ concurrency: permissions: contents: write pull-requests: write + statuses: write jobs: Process-PSModule: uses: PSModule/Process-PSModule/.github/workflows/workflow.yml@v1 secrets: inherit - with: - SkipTests: true diff --git a/.vscode/settings.json b/.vscode/settings.json index e732ea1..147e828 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -22,14 +22,17 @@ "[yaml]": { "editor.defaultFormatter": "github.vscode-github-actions", "editor.insertSpaces": true, - "editor.tabSize": 2, + "editor.tabSize": 2 }, "[github-actions-workflow]": { "editor.defaultFormatter": "github.vscode-github-actions", "editor.insertSpaces": true, "editor.tabSize": 2 }, - "editor.rulers": [0, 150], + "editor.rulers": [ + 0, + 150 + ], "powershell.codeFormatting.autoCorrectAliases": true, "powershell.codeFormatting.newLineAfterCloseBrace": false, "powershell.codeFormatting.pipelineIndentationStyle": "IncreaseIndentationForFirstPipeline", diff --git a/README.md b/README.md index 7a4c814..5d48836 100644 --- a/README.md +++ b/README.md @@ -26,7 +26,7 @@ This section should provide a good overview of the module's capabilities. $Version = New-PSSemVer -Version 1.0.0 ``` -### Create a new SemVer object with pre-release and build metadata +### Create a new SemVer object with prerelease and build metadata ```powershell $Version = New-PSSemVer -Version 1.0.0 -PreRelease 'alpha' -Build '2020-01-01' @@ -68,7 +68,7 @@ $Version = New-PSSemVer -Version 1.0.0 $Version.BumpPatch() ``` -### Set the pre-release +### Set the prerelease ```powershell $Version = New-PSSemVer -Version 1.0.0 diff --git a/src/PSSemVer/PSSemVer.ps1 b/src/PSSemVer/PSSemVer.ps1 index d0c1395..bceb68f 100644 --- a/src/PSSemVer/PSSemVer.ps1 +++ b/src/PSSemVer/PSSemVer.ps1 @@ -11,23 +11,12 @@ $TypeAcceleratorsClass = [psobject].Assembly.GetType( $ExistingTypeAccelerators = $TypeAcceleratorsClass::Get foreach ($Type in $ExportableTypes) { if ($Type.FullName -in $ExistingTypeAccelerators.Keys) { - $Message = @( - "Unable to register type accelerator '$($Type.FullName)'" - 'Accelerator already exists.' - ) -join ' - ' - - throw [System.Management.Automation.ErrorRecord]::new( - [System.InvalidOperationException]::new($Message), - 'TypeAcceleratorAlreadyExists', - [System.Management.Automation.ErrorCategory]::InvalidOperation, - $Type.FullName - ) + Write-Debug "Accelerator already exists [$($Type.FullName)]" + } else { + $TypeAcceleratorsClass::Add($Type.FullName, $Type) } } -# Add type accelerators for every exportable type. -foreach ($Type in $ExportableTypes) { - $TypeAcceleratorsClass::Add($Type.FullName, $Type) -} + # Remove type accelerators when the module is removed. $MyInvocation.MyCommand.ScriptBlock.Module.OnRemove = { foreach ($Type in $ExportableTypes) { diff --git a/src/PSSemVer/public/ConvertTo-PSSemVer.ps1 b/src/PSSemVer/public/ConvertTo-PSSemVer.ps1 index dce3084..f086ae4 100644 --- a/src/PSSemVer/public/ConvertTo-PSSemVer.ps1 +++ b/src/PSSemVer/public/ConvertTo-PSSemVer.ps1 @@ -16,7 +16,7 @@ BuildMetadata : 001 .NOTES - Compatible with [PSSemVer 2.0.0](https://PSSemVer.org/). + Compatible with SemVer 2.0.0. #> [OutputType([PSSemVer])] [CmdletBinding()] diff --git a/src/PSSemVer/public/New-PSSemVer.ps1 b/src/PSSemVer/public/New-PSSemVer.ps1 index d2a3199..af497e1 100644 --- a/src/PSSemVer/public/New-PSSemVer.ps1 +++ b/src/PSSemVer/public/New-PSSemVer.ps1 @@ -25,7 +25,7 @@ BuildMetadata : 001 .NOTES - Compatible with [PSSemVer 2.0.0](https://PSSemVer.org/). + Compatible with SemVer 2.0.0. #> [Diagnostics.CodeAnalysis.SuppressMessageAttribute( 'PSUseShouldProcessForStateChangingFunctions', '', diff --git a/tests/PSSemVer.Tests.ps1 b/tests/PSSemVer.Tests.ps1 index c052f1b..b2fb8ee 100644 --- a/tests/PSSemVer.Tests.ps1 +++ b/tests/PSSemVer.Tests.ps1 @@ -5,7 +5,7 @@ Write-Verbose (Get-Module -Name 'PSSemVer' -ListAvailable | Out-String) -Verbose } It 'The module should be importable' { - { Import-Module -Name 'PSSemVer' } | Should -Not -Throw + { Import-Module -Name 'PSSemVer' -Verbose -RequiredVersion 999.0.0 -Force } | Should -Not -Throw } } }