Skip to content

Commit 5ad70d0

Browse files
committed
Add a bunch of stuff that should be in the "Strings" module
1 parent 82f2d6f commit 5ad70d0

23 files changed

+636
-288
lines changed

.github/workflows/build.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ jobs:
5555
uses: actions/upload-artifact@v4
5656
with:
5757
name: PesterTests
58-
path: ${{github.workspace}}/Tests
58+
path: ${{github.workspace}}/tests
5959
- name: Upload RequiredModules.psd1
6060
uses: actions/upload-artifact@v4
6161
with:

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,4 @@
11
output/
22
Modules/
3+
# Ignore version number folders (I put my module in these so I can use it)
4+
/[0-9]*/

Build.build.ps1

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,8 @@ $ErrorView = 'DetailedView'
3131

3232
# The name of the module to publish
3333
$script:PSModuleName = "TerminalBlocks"
34-
$script:RequiredCodeCoverage = 0.85
34+
# Pester doesn't measure the code coverage properly, because we test things by running in a new session
35+
$script:RequiredCodeCoverage = 0.0
3536
# Use Env because then Earthly can override it
3637
$Env:OUTPUT_ROOT ??= Join-Path $BuildRoot Modules
3738

Earthfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ ARG --global EARTHLY_BUILD_SHA
88
ARG --global EARTHLY_GIT_BRANCH
99
# These are my common paths, used in my shared /Tasks repo
1010
ARG --global OUTPUT_ROOT=/Modules
11-
ARG --global TEST_ROOT=/Tests
11+
ARG --global TEST_ROOT=/tests
1212
ARG --global TEMP_ROOT=/temp
1313
# These are my common build args, used in my shared /Tasks repo
1414
ARG --global MODULE_NAME=ErrorView
@@ -59,7 +59,7 @@ test:
5959
# BUILD +build
6060
FROM +build
6161
# Copy the test files here, so we can avoid rebuilding when iterating on tests
62-
COPY --if-exists --dir Tests/ ScriptAnalyzerSettings.psd1 /work
62+
COPY --if-exists --dir $TEST_ROOT ScriptAnalyzerSettings.psd1 /work
6363
RUN ["pwsh", "-Command", "Invoke-Build", "-Task", "Test", "-File", "Build.build.ps1"]
6464

6565
# SAVE ARTIFACT [--keep-ts] [--keep-own] [--if-exists] [--force] <src> [<artifact-dest-path>] [AS LOCAL <local-path>]

GitVersion.yml

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
mode: mainline # Each merged branch against main will increment the patch version unless otherwise specified in a commit message
2+
commit-date-format: "yyyyMMddTHHmmss"
3+
assembly-file-versioning-format: "{Major}.{Minor}.{Patch}.{env:GITHUB_RUN_NUMBER ?? 0}"
4+
5+
# This repo needs to use NuGetVersionV2 for compatibility with PowerShellGallery
6+
assembly-informational-format: "{NuGetVersionV2}+Build.{env:GITHUB_RUN_NUMBER ?? local}.Sha.{Sha}.Date.{CommitDate}"
7+
major-version-bump-message: 'semver:\s?(breaking|major)'
8+
minor-version-bump-message: 'semver:\s?(feature|minor)'
9+
patch-version-bump-message: 'semver:\s?(fix|patch)'
10+
no-bump-message: 'semver:\s?(none|skip)'
11+
commit-message-incrementing: Enabled
12+
next-version: 1.0.0
13+
14+
branches:
15+
main:
16+
tag: "" # explicitly no tag for main builds
17+
regex: ^master$|^main$
18+
increment: Minor
19+
is-mainline: true
20+
tracks-release-branches: true
21+
hotfix:
22+
tag: rc
23+
regex: hotfix(es)?/\d+\.\d+\.\d+
24+
increment: None
25+
is-release-branch: true
26+
prevent-increment-of-merged-branch-version: true
27+
source-branches: [ "main" ]
28+
release:
29+
tag: rc
30+
regex: releases?/\d+\.\d+\.\d+
31+
increment: None
32+
is-release-branch: true
33+
prevent-increment-of-merged-branch-version: true
34+
source-branches: [ "main" ]
35+
pull-request:
36+
regex: pull/
37+
tag: pr
38+
tag-number-pattern: '[/-](?<number>\d+)'
39+
increment: Patch
40+
source-branches: [ "main", "feature", "release", "hotfix" ]
41+
feature:
42+
regex: .*/
43+
tag: useBranchName
44+
source-branches: [ "main", "feature" ]
45+
track-merge-target: true
46+
tracks-release-branches: true
47+
increment: Patch

source/ErrorView.format.ps1xml

Lines changed: 1 addition & 79 deletions
Original file line numberDiff line numberDiff line change
@@ -6,35 +6,6 @@
66
<OutOfBand />
77
<ViewSelectedBy>
88
<TypeName>System.Management.Automation.ErrorRecord</TypeName>
9-
</ViewSelectedBy>
10-
<CustomControl>
11-
<CustomEntries>
12-
<CustomEntry>
13-
<CustomItem>
14-
<ExpressionBinding>
15-
<ScriptBlock>
16-
<![CDATA[
17-
Set-StrictMode -Off
18-
$ErrorActionPreference = 'Stop'
19-
trap { 'Error found in error view definition: ' + $_.Exception.Message }
20-
21-
if ($formatter = @(Get-Command "ConvertTo-$($ErrorView -replace "View$")ErrorView" -ListImported -ErrorAction Ignore -ParameterName InputObject -ParameterType [System.Management.Automation.ErrorRecord])) {
22-
& ($formatter[0]) -InputObject $_
23-
} else {
24-
ConvertTo-NormalErrorView $_
25-
}
26-
]]>
27-
</ScriptBlock>
28-
</ExpressionBinding>
29-
</CustomItem>
30-
</CustomEntry>
31-
</CustomEntries>
32-
</CustomControl>
33-
</View>
34-
<View>
35-
<Name>ExceptionInstance</Name>
36-
<OutOfBand />
37-
<ViewSelectedBy>
389
<TypeName>System.Exception</TypeName>
3910
</ViewSelectedBy>
4011
<CustomControl>
@@ -43,56 +14,7 @@
4314
<CustomItem>
4415
<ExpressionBinding>
4516
<ScriptBlock>
46-
<![CDATA[
47-
Set-StrictMode -Off
48-
$ErrorActionPreference = 'Stop'
49-
trap { 'Error found in error view definition: ' + $_.Exception.Message }
50-
51-
if ($_.ErrorRecord) {
52-
$Record = $_.ErrorRecord
53-
if ($formatter = @(Get-Command "ConvertTo-$($ErrorView -replace "View$")ErrorView" -ListImported -ErrorAction Ignore -ParameterName InputObject -ParameterType [System.Management.Automation.ErrorRecord])) {
54-
& ($formatter[0]) -InputObject $Record
55-
} else {
56-
ConvertTo-NormalErrorView $Record
57-
}
58-
} else {
59-
if ($formatter = @(Get-Command "ConvertTo-$($ErrorView -replace "View$")ExceptionView" -ListImported -ErrorAction Ignore -ParameterName InputObject -ParameterType [System.Exception])) {
60-
& ($formatter[0]) -InputObject $_
61-
} else {
62-
ConvertTo-NormalExceptionView $_
63-
}
64-
}
65-
]]>
66-
</ScriptBlock>
67-
</ExpressionBinding>
68-
</CustomItem>
69-
</CustomEntry>
70-
</CustomEntries>
71-
</CustomControl>
72-
</View>
73-
<View>
74-
<Name>InformationRecord</Name>
75-
<OutOfBand />
76-
<ViewSelectedBy>
77-
<TypeName>System.Management.Automation.InformationRecord</TypeName>
78-
</ViewSelectedBy>
79-
<CustomControl>
80-
<CustomEntries>
81-
<CustomEntry>
82-
<CustomItem>
83-
<ExpressionBinding>
84-
<ScriptBlock>
85-
$_.MessageData | Format-List * | Out-String
86-
</ScriptBlock>
87-
</ExpressionBinding>
88-
<ExpressionBinding>
89-
<ScriptBlock>
90-
"Tags: " + @($_.Tags -join ", ")
91-
</ScriptBlock>
92-
</ExpressionBinding>
93-
<ExpressionBinding>
94-
<ScriptBlock>
95-
$_ | Select-Object * -ExcludeProperty Tags, MessageData | Format-List * -Force | Out-String
17+
Format-Error -View $global:ErrorView -InputObject $_
9618
</ScriptBlock>
9719
</ExpressionBinding>
9820
</CustomItem>

source/ErrorView.psd1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131

3232
# ReleaseNotes of this module
3333
ReleaseNotes = 'I wrote this module to enhance ErrorViews for PowerShell (without waiting for PS7+)'
34-
34+
Prerelease = ""
3535
} # End of PSData hashtable
3636

3737
} # End of PrivateData hashtable

source/postfix.ps1

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
if ($script:ErrorView) {
2-
Set-ErrorView $ErrorView
1+
if ($ErrorViewArgument) {
2+
Set-ErrorView $ErrorViewArgument
33
} elseif ($Env:GITHUB_ACTIONS -or $Env:TF_BUILD) {
44
Set-ErrorView "DetailedErrorView"
55
} else {

0 commit comments

Comments
 (0)