Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions .github/workflows/Process-PSModule.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
7 changes: 5 additions & 2 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down Expand Up @@ -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
Expand Down
19 changes: 4 additions & 15 deletions src/PSSemVer/PSSemVer.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
2 changes: 1 addition & 1 deletion src/PSSemVer/public/ConvertTo-PSSemVer.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -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()]
Expand Down
2 changes: 1 addition & 1 deletion src/PSSemVer/public/New-PSSemVer.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -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', '',
Expand Down
2 changes: 1 addition & 1 deletion tests/PSSemVer.Tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
}
}
Expand Down