Skip to content
Closed
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
8 changes: 7 additions & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,10 @@ jobs:
- uses: actions/checkout@v4
- name: Test
shell: pwsh
run: ./build.ps1 -Task Test -Bootstrap
env:
DEBUG: ${{ runner.debug == '1' }}
run: |
if($env:DEBUG -eq 'true' -or $env:DEBUG -eq '1') {
$DebugPreference = 'Continue'
}
./build.ps1 -Task Test -Bootstrap
26 changes: 25 additions & 1 deletion .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,35 @@
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "Run Build and Debug (Temp Console)",
"type": "PowerShell",
"request": "launch",
"script": "${cwd}/build.ps1",
"args": [
"-Task Test",
"-Verbose"
],
"cwd": "${workspaceFolder}",
"createTemporaryIntegratedConsole": true
},
{
"name": "Run Build and Debug",
"type": "PowerShell",
"request": "launch",
"script": "${cwd}/build.ps1",
"args": [
"-Task Test",
"-Verbose"
],
"cwd": "${workspaceFolder}",
"createTemporaryIntegratedConsole": true
},
{
"name": "PowerShell: Interactive Session",
"type": "PowerShell",
"request": "launch",
"cwd": ""
}
]
}
}
11 changes: 10 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,14 @@
"powershell.codeFormatting.addWhitespaceAroundPipe": true,
"powershell.codeFormatting.useCorrectCasing": true,
"powershell.codeFormatting.newLineAfterOpenBrace": true,
"powershell.codeFormatting.alignPropertyValuePairs": true
"powershell.codeFormatting.alignPropertyValuePairs": true,
"powershell.scriptAnalysis.settingsPath": "tests/ScriptAnalyzerSettings.psd1",
"search.useIgnoreFiles": true,
"search.exclude": {
"**/node_modules": true,
"**/bower_components": true,
"**/*.code-search": true,
"**/.ruby-lsp": true,
"Output/**": true
}
}
27 changes: 21 additions & 6 deletions .vscode/tasks.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,33 +2,42 @@
// See https://go.microsoft.com/fwlink/?LinkId=733558
// for the documentation about the tasks.json format
"version": "2.0.0",

// Start PowerShell (pwsh on *nix)
"windows": {
"options": {
"shell": {
"executable": "powershell.exe",
"args": [ "-NoProfile", "-ExecutionPolicy", "Bypass", "-Command" ]
"executable": "pwsh.exe",
"args": [
"-NoProfile",
"-ExecutionPolicy",
"Bypass",
"-Command"
]
}
}
},
"linux": {
"options": {
"shell": {
"executable": "/usr/bin/pwsh",
"args": [ "-NoProfile", "-Command" ]
"args": [
"-NoProfile",
"-Command"
]
}
}
},
"osx": {
"options": {
"shell": {
"executable": "/usr/local/bin/pwsh",
"args": [ "-NoProfile", "-Command" ]
"args": [
"-NoProfile",
"-Command"
]
}
}
},

"tasks": [
{
"label": "Clean",
Expand Down Expand Up @@ -69,6 +78,12 @@
"label": "Publish",
"type": "shell",
"command": "${cwd}/build.ps1 -Task Publish -Verbose"
},
{
"label": "Bootstrap",
"type": "shell",
"command": "${cwd}/build.ps1 -Task Init -Bootstrap -Verbose",
"problemMatcher": []
}
]
}
15 changes: 12 additions & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,15 @@ and this project adheres to [Semantic Versioning](http://semver.org/).

## Unreleased

### Added

- Add new dependencies variables to allow end user to modify which tasks are
run.
- Add localization support.

### Fixes

- Fix a bug in `Build-PSBuildMarkdown` where a hashtable item was added twice.

## [0.7.2] 2025-05-21

Expand All @@ -26,11 +33,13 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
- `$PSBPreference.Test.OutputVerbosity` can be set to **None**, **Normal**,
**Detailed**, and **Diagnostic**. The default value is **Detailed**.

## [0.7.1] 2025-04-01
## [0.7.1] 2025-03-31 Bugfix

### Fixes
### Fixed

- Fix a bug in `Build-PSBuildMarkdown` where a hashtable item was added twice.
- Remove extra item from `New-MarkdownHelp` splat that would result in a failure
when using `$PSBPreference.Docs.Overwrite = $true`
- Clean up some failing Script Analyzer settings, including moving the file.

## [0.7.0] 2025-03-31

Expand Down
39 changes: 38 additions & 1 deletion PowerShellBuild/PowerShellBuild.psm1
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Dot source public functions
$private = @(Get-ChildItem -Path ([IO.Path]::Combine($PSScriptRoot, 'Private/*.ps1')) -Recurse)
$public = @(Get-ChildItem -Path ([IO.Path]::Combine($PSScriptRoot, 'Public/*.ps1')) -Recurse)
$public = @(Get-ChildItem -Path ([IO.Path]::Combine($PSScriptRoot, 'Public/*.ps1')) -Recurse)
foreach ($import in $public + $private) {
try {
. $import.FullName
Expand All @@ -9,6 +9,43 @@ foreach ($import in $public + $private) {
}
}

data LocalizedData {
# Load here in case Import-LocalizedData is not available
ConvertFrom-StringData @'
NoCommandsExported=No commands have been exported. Skipping markdown generation.
FailedToGenerateMarkdownHelp=Failed to generate markdown help. : {0}
AddingFileToPsm1=Adding [{0}] to PSM1
MakeCabNotAvailable=MakeCab.exe is not available. Cannot create help cab.
DirectoryAlreadyExists=Directory already exists [{0}].
PathLongerThan3Chars=`$Path [{0}] must be longer than 3 characters.
BuildSystemDetails=Build System Details:
BuildModule=Build Module: {0}`:{1}
PowerShellVersion=PowerShell Version: {0}
EnvironmentVariables={0}`Environment variables:
PublishingVersionToRepository=Publishing version [{0}] to repository [{1}]...
FolderDoesNotExist=Folder does not exist: {0}
PathArgumentMustBeAFolder=The Path argument must be a folder. File paths are not allowed.
UnableToFindModuleManifest=Unable to find module manifest [{0}]. Can't import module
PesterTestsFailed=One or more Pester tests failed
CodeCoverage=Code Coverage
Type=Type
CodeCoverageLessThanThreshold=Code coverage: [{0}] is [{1:p}], which is less than the threshold of [{2:p}]
CodeCoverageCodeCoverageFileNotFound=Code coverage file [{0}] not found.
SeverityThresholdSetTo=SeverityThreshold set to: {0}
PSScriptAnalyzerResults=PSScriptAnalyzer results:
ScriptAnalyzerErrors=One or more ScriptAnalyzer errors were found!
ScriptAnalyzerWarnings=One or more ScriptAnalyzer warnings were found!
ScriptAnalyzerIssues=One or more ScriptAnalyzer issues were found!
'@
}
$importLocalizedDataSplat = @{
BindingVariable = 'LocalizedData'
FileName = 'Messages.psd1'
ErrorAction = 'SilentlyContinue'
}
Import-LocalizedData @importLocalizedDataSplat


Export-ModuleMember -Function $public.Basename

# $psakeTaskAlias = 'PowerShellBuild.psake.tasks'
Expand Down
2 changes: 1 addition & 1 deletion PowerShellBuild/Public/Build-PSBuildMAMLHelp.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ function Build-PSBuildMAMLHelp {
Uses PlatyPS to generate MAML XML help from markdown files in ./docs
and saves the XML file to a directory under ./output/MyModule
#>
[cmdletbinding()]
[CmdletBinding()]
param(
[parameter(Mandatory)]
[string]$Path,
Expand Down
6 changes: 3 additions & 3 deletions PowerShellBuild/Public/Build-PSBuildMarkdown.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ function Build-PSBuildMarkdown {

Analysis the comment-based help of the MyModule module and create markdown documents under ./docs/en-US.
#>
[cmdletbinding()]
[CmdletBinding()]
param(
[parameter(Mandatory)]
[string]$ModulePath,
Expand Down Expand Up @@ -56,7 +56,7 @@ function Build-PSBuildMarkdown {

try {
if ($moduleInfo.ExportedCommands.Count -eq 0) {
Write-Warning 'No commands have been exported. Skipping markdown generation.'
Write-Warning $LocalizedData.NoCommandsExported
return
}

Expand Down Expand Up @@ -93,7 +93,7 @@ function Build-PSBuildMarkdown {
}
New-MarkdownHelp @newMDParams > $null
} catch {
Write-Error "Failed to generate markdown help. : $_"
Write-Error ($LocalizedData.FailedToGenerateMarkdownHelp -f $_)
} finally {
Remove-Module $moduleName
}
Expand Down
Loading
Loading