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
4 changes: 4 additions & 0 deletions .markdownlint.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,9 @@
"$schema": "https://raw.githubusercontent.com/DavidAnson/vscode-markdownlint/refs/heads/main/markdownlint-config-schema.json",
"MD024": {
"siblings_only": true
},
"MD013": {
"code_blocks": false,
"tables": false
}
}
6 changes: 5 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,13 @@ and this project adheres to [Semantic Versioning](http://semver.org/).

## Unreleased

### Breaking Changes

- [**#71**](https://github.com/psake/PowerShellBuild/pull/71) Compiled modules
are now explicitly created as UTF-8 files.

- [**#67**](https://github.com/psake/PowerShellBuild/pull/67) You can now
overwrite existing markdown files using `$PSBPreference.Docs.Overwrite` and
setting it to `$true`.

## [0.6.2] 2024-10-06

Expand Down
1 change: 1 addition & 0 deletions PowerShellBuild/IB.tasks.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@ task GenerateMarkdown -if (. $genMarkdownPreReqs) StageFiles,{
ModuleName = $PSBPreference.General.ModuleName
DocsPath = $PSBPreference.Docs.RootDir
Locale = $PSBPreference.Help.DefaultLocale
Overwrite = $PSBPreference.Docs.Overwrite
}
Build-PSBuildMarkdown @buildMDParams
}
Expand Down
24 changes: 18 additions & 6 deletions PowerShellBuild/Public/Build-PSBuildMarkdown.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ function Build-PSBuildMarkdown {
The path where PlatyPS markdown docs will be saved.
.PARAMETER Locale
The locale to save the markdown docs.
.PARAMETER Overwrite
Overwrite existing markdown files and use comment based help as the source of truth.
.EXAMPLE
PS> Build-PSBuildMarkdown -ModulePath ./output/MyModule/0.1.0 -ModuleName MyModule -DocsPath ./docs -Locale en-US

Expand All @@ -29,7 +31,10 @@ function Build-PSBuildMarkdown {
[string]$DocsPath,

[parameter(Mandatory)]
[string]$Locale
[string]$Locale,

[parameter(Mandatory)]
[bool]$Overwrite
)

$moduleInfo = Import-Module "$ModulePath/$ModuleName.psd1" -Global -Force -PassThru
Expand All @@ -52,13 +57,20 @@ function Build-PSBuildMarkdown {

# ErrorAction set to SilentlyContinue so this command will not overwrite an existing MD file.
$newMDParams = @{
Module = $ModuleName
Locale = $Locale
OutputFolder = [IO.Path]::Combine($DocsPath, $Locale)
ErrorAction = 'SilentlyContinue'
Verbose = $VerbosePreference
Module = $ModuleName
Locale = $Locale
OutputFolder = [IO.Path]::Combine($DocsPath, $Locale)
ErrorAction = 'SilentlyContinue'
Verbose = $VerbosePreference
Force = $Overwrite
}
if ($Overwrite) {
$newMDParams.Add('Force', $true)
$newMDParams.Remove('ErrorAction')
}
New-MarkdownHelp @newMDParams > $null
} catch {
Write-Error "Failed to generate markdown help. : $_"
} finally {
Remove-Module $moduleName
}
Expand Down
7 changes: 5 additions & 2 deletions PowerShellBuild/build.properties.ps1
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
BuildHelpers\Set-BuildEnvironment -Force

$outDir = [IO.Path]::Combine($env:BHProjectPath, 'Output')
$outDir = [IO.Path]::Combine($env:BHProjectPath, 'Output')
$moduleVersion = (Import-PowerShellDataFile -Path $env:BHPSModuleManifest).ModuleVersion

[ordered]@{
Expand Down Expand Up @@ -97,7 +97,7 @@ $moduleVersion = (Import-PowerShellDataFile -Path $env:BHPSModuleManifest).Modul
OutputFileFormat = 'JaCoCo'
}
}
Help = @{
Help = @{
# Path to updateable help CAB
UpdatableHelpOutDir = [IO.Path]::Combine($outDir, 'UpdatableHelp')

Expand All @@ -111,6 +111,9 @@ $moduleVersion = (Import-PowerShellDataFile -Path $env:BHPSModuleManifest).Modul
Docs = @{
# Directory PlatyPS markdown documentation will be saved to
RootDir = [IO.Path]::Combine($env:BHProjectPath, 'docs')

# Whether to overwrite existing markdown files and use comment based help as the source of truth
Overwrite = $false
}
Publish = @{
# PowerShell repository name to publish modules to
Expand Down
1 change: 1 addition & 0 deletions PowerShellBuild/psakeFile.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,7 @@ task GenerateMarkdown -depends StageFiles -precondition $genMarkdownPreReqs {
ModuleName = $PSBPreference.General.ModuleName
DocsPath = $PSBPreference.Docs.RootDir
Locale = $PSBPreference.Help.DefaultLocale
Overwrite = $PSBPreference.Docs.Overwrite
}
Build-PSBuildMarkdown @buildMDParams
} -description 'Generates PlatyPS markdown files from module help'
Expand Down
Loading