Skip to content

Commit ab29008

Browse files
🩹 [Patch]: Update Build-PSModuleDocumentation to use New-MarkdownCommandHelp and improve markdown file handling
🩹 [Patch]: Change module name reference in main.ps1 to full module name for clarity
1 parent 51b6643 commit ab29008

File tree

2 files changed

+10
-7
lines changed

2 files changed

+10
-7
lines changed

scripts/helpers/Build-PSModuleDocumentation.ps1

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,9 @@
4747

4848
Write-Host '::group::Build docs - Generate markdown help - Raw'
4949
Install-PSModule -Path $ModuleOutputFolder
50-
Write-Host ($ModuleName | Get-Module)
51-
$null = New-MarkdownHelp -Module $ModuleName -OutputFolder $DocsOutputFolder -Force -Verbose
50+
$moduleInfo = Get-Module $ModuleName
51+
Write-Host $moduleInfo
52+
$null = New-MarkdownCommandHelp -ModuleInfo $moduleInfo -OutputFolder $DocsOutputFolder -Force -Verbose
5253
Get-ChildItem -Path $DocsOutputFolder -Recurse -Force -Include '*.md' | ForEach-Object {
5354
$fileName = $_.Name
5455
Write-Host "::group:: - [$fileName]"
@@ -88,30 +89,32 @@
8889

8990
Write-Host '::group::Build docs - Structure markdown files to match source files'
9091
$PublicFunctionsFolder = Join-Path $ModuleSourceFolder.FullName 'functions\public' | Get-Item
91-
Get-ChildItem -Path $DocsOutputFolder -Recurse -Force -Include '*.md' | ForEach-Object {
92+
$moduleDocsFolder = Join-Path $DocsOutputFolder.FullName $ModuleName
93+
Get-ChildItem -Path $moduleDocsFolder -Recurse -Force -Include '*.md' | ForEach-Object {
9294
$file = $_
93-
$relPath = [System.IO.Path]::GetRelativePath($DocsOutputFolder.FullName, $file.FullName)
95+
$relPath = [System.IO.Path]::GetRelativePath($moduleDocsFolder, $file.FullName)
9496
Write-Host " - $relPath"
9597
Write-Host " Path: $file"
9698

9799
# find the source code file that matches the markdown file
98100
$scriptPath = Get-ChildItem -Path $PublicFunctionsFolder -Recurse -Force | Where-Object { $_.Name -eq ($file.BaseName + '.ps1') }
99101
Write-Host " PS1 path: $scriptPath"
100-
$docsFilePath = ($scriptPath.FullName).Replace($PublicFunctionsFolder.FullName, $DocsOutputFolder.FullName).Replace('.ps1', '.md')
102+
$docsFilePath = ($scriptPath.FullName).Replace($PublicFunctionsFolder.FullName, $moduleDocsFolder).Replace('.ps1', '.md')
101103
Write-Host " MD path: $docsFilePath"
102104
$docsFolderPath = Split-Path -Path $docsFilePath -Parent
103105
$null = New-Item -Path $docsFolderPath -ItemType Directory -Force
104106
Move-Item -Path $file.FullName -Destination $docsFilePath -Force
105107
}
106108

107109
Write-Host '::group::Build docs - Move markdown files from source files to docs'
110+
$moduleDocsFolder = Join-Path $DocsOutputFolder.FullName $ModuleName
108111
Get-ChildItem -Path $PublicFunctionsFolder -Recurse -Force -Include '*.md' | ForEach-Object {
109112
$file = $_
110113
$relPath = [System.IO.Path]::GetRelativePath($PublicFunctionsFolder.FullName, $file.FullName)
111114
Write-Host " - $relPath"
112115
Write-Host " Path: $file"
113116

114-
$docsFilePath = ($file.FullName).Replace($PublicFunctionsFolder.FullName, $DocsOutputFolder.FullName)
117+
$docsFilePath = ($file.FullName).Replace($PublicFunctionsFolder.FullName, $moduleDocsFolder)
115118
Write-Host " MD path: $docsFilePath"
116119
$docsFolderPath = Split-Path -Path $docsFilePath -Parent
117120
$null = New-Item -Path $docsFolderPath -ItemType Directory -Force

scripts/main.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ param()
77

88
$PSStyle.OutputRendering = 'Ansi'
99

10-
'platyPS' | ForEach-Object {
10+
'Microsoft.PowerShell.PlatyPS' | ForEach-Object {
1111
$name = $_
1212
Write-Output "Installing module: $name"
1313
$retryCount = 5

0 commit comments

Comments
 (0)