Skip to content

Commit 98a55ba

Browse files
committed
feat(markdown): ✨ Add Overwrite parameter to markdown generation
* Introduced an `Overwrite` parameter to control the overwriting of existing markdown files. * Updated relevant functions and properties to utilize the new parameter.
1 parent 4baa749 commit 98a55ba

File tree

4 files changed

+12
-4
lines changed

4 files changed

+12
-4
lines changed

Diff for: PowerShellBuild/IB.tasks.ps1

+1
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,7 @@ task GenerateMarkdown -if (. $genMarkdownPreReqs) StageFiles,{
121121
ModuleName = $PSBPreference.General.ModuleName
122122
DocsPath = $PSBPreference.Docs.RootDir
123123
Locale = $PSBPreference.Help.DefaultLocale
124+
Overwrite = $PSBPreference.Docs.Overwrite
124125
}
125126
Build-PSBuildMarkdown @buildMDParams
126127
}

Diff for: PowerShellBuild/Public/Build-PSBuildMarkdown.ps1

+5-2
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,10 @@ function Build-PSBuildMarkdown {
2929
[string]$DocsPath,
3030

3131
[parameter(Mandatory)]
32-
[string]$Locale
32+
[string]$Locale,
33+
34+
[parameter(Mandatory)]
35+
[bool]$Overwrite
3336
)
3437

3538
$moduleInfo = Import-Module "$ModulePath/$ModuleName.psd1" -Global -Force -PassThru
@@ -57,7 +60,7 @@ function Build-PSBuildMarkdown {
5760
OutputFolder = [IO.Path]::Combine($DocsPath, $Locale)
5861
ErrorAction = 'SilentlyContinue'
5962
Verbose = $VerbosePreference
60-
Force = $true
63+
Force = $Overwrite
6164
}
6265
New-MarkdownHelp @newMDParams > $null
6366
} finally {

Diff for: PowerShellBuild/build.properties.ps1

+5-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
BuildHelpers\Set-BuildEnvironment -Force
22

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

66
[ordered]@{
@@ -97,7 +97,7 @@ $moduleVersion = (Import-PowerShellDataFile -Path $env:BHPSModuleManifest).Modul
9797
OutputFileFormat = 'JaCoCo'
9898
}
9999
}
100-
Help = @{
100+
Help = @{
101101
# Path to updateable help CAB
102102
UpdatableHelpOutDir = [IO.Path]::Combine($outDir, 'UpdatableHelp')
103103

@@ -111,6 +111,9 @@ $moduleVersion = (Import-PowerShellDataFile -Path $env:BHPSModuleManifest).Modul
111111
Docs = @{
112112
# Directory PlatyPS markdown documentation will be saved to
113113
RootDir = [IO.Path]::Combine($env:BHProjectPath, 'docs')
114+
115+
# Overwrite existing markdown files and use comment based help as the source of truth
116+
Overwrite = $true
114117
}
115118
Publish = @{
116119
# PowerShell repository name to publish modules to

Diff for: PowerShellBuild/psakeFile.ps1

+1
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,7 @@ task GenerateMarkdown -depends StageFiles -precondition $genMarkdownPreReqs {
128128
ModuleName = $PSBPreference.General.ModuleName
129129
DocsPath = $PSBPreference.Docs.RootDir
130130
Locale = $PSBPreference.Help.DefaultLocale
131+
Overwrite = $PSBPreference.Docs.Overwrite
131132
}
132133
Build-PSBuildMarkdown @buildMDParams
133134
} -description 'Generates PlatyPS markdown files from module help'

0 commit comments

Comments
 (0)