Skip to content

Commit 98f0b8b

Browse files
Refactor Build-PSModuleDocumentation.ps1 to improve output clarity; replace Write-Host with formatted output for file paths and processing details.
1 parent 5df55a7 commit 98f0b8b

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

scripts/helpers/Build-PSModuleDocumentation.ps1

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -90,23 +90,28 @@
9090
$PublicFunctionsFolder = Join-Path $ModuleSourceFolder.FullName 'functions\public' | Get-Item
9191
Get-ChildItem -Path $DocsOutputFolder -Recurse -Force -Include '*.md' | ForEach-Object {
9292
$file = $_
93-
Write-Host "Processing: $file"
93+
$relPath = [System.IO.Path]::GetRelativePath($DocsOutputFolder.FullName, $file.FullName)
94+
Write-Host " - $relPath"
95+
Write-Host " Path: $file"
9496

9597
# find the source code file that matches the markdown file
9698
$scriptPath = Get-ChildItem -Path $PublicFunctionsFolder -Recurse -Force | Where-Object { $_.Name -eq ($file.BaseName + '.ps1') }
97-
Write-Host "Found script path: $scriptPath"
99+
Write-Host " PS1 path: $scriptPath"
98100
$docsFilePath = ($scriptPath.FullName).Replace($PublicFunctionsFolder.FullName, $DocsOutputFolder.FullName).Replace('.ps1', '.md')
99-
Write-Host "Doc file path: $docsFilePath"
101+
Write-Host " MD path: $docsFilePath"
100102
$docsFolderPath = Split-Path -Path $docsFilePath -Parent
101103
$null = New-Item -Path $docsFolderPath -ItemType Directory -Force
102104
Move-Item -Path $file.FullName -Destination $docsFilePath -Force
103105
}
104106
# Get the MD files that are in the public functions folder and move them to the same place in the docs folder
105107
Get-ChildItem -Path $PublicFunctionsFolder -Recurse -Force -Include '*.md' | ForEach-Object {
106108
$file = $_
107-
Write-Host "Processing: $file"
109+
$relPath = [System.IO.Path]::GetRelativePath($PublicFunctionsFolder.FullName, $file.FullName)
110+
Write-Host " - $relPath"
111+
Write-Host " Path: $file"
112+
108113
$docsFilePath = ($file.FullName).Replace($PublicFunctionsFolder.FullName, $DocsOutputFolder.FullName)
109-
Write-Host "Doc file path: $docsFilePath"
114+
Write-Host " MD path: $docsFilePath"
110115
$docsFolderPath = Split-Path -Path $docsFilePath -Parent
111116
$null = New-Item -Path $docsFolderPath -ItemType Directory -Force
112117
Move-Item -Path $file.FullName -Destination $docsFilePath -Force

0 commit comments

Comments
 (0)