Skip to content

Commit b3a20a9

Browse files
🪲 [Fix]: Moving docs one level out (not in a $ModuleName folder) (#79)
## Description - Moving docs one level out (not in a `$ModuleName` folder) ## Type of change <!-- Use the check-boxes [x] on the options that are relevant. --> - [ ] 📖 [Docs] - [x] 🪲 [Fix] - [ ] 🩹 [Patch] - [ ] ⚠️ [Security fix] - [ ] 🚀 [Feature] - [ ] 🌟 [Breaking change] ## Checklist <!-- Use the check-boxes [x] on the options that are relevant. --> - [x] I have performed a self-review of my own code - [x] I have commented my code, particularly in hard-to-understand areas
1 parent 05b644c commit b3a20a9

File tree

2 files changed

+6
-9
lines changed

2 files changed

+6
-9
lines changed

scripts/helpers/Build-PSModule.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ function Build-PSModule {
4343
$moduleOutputFolder = New-Item -Path $ModulesOutputFolderPath -Name $ModuleName -ItemType Directory -Force
4444
Write-Verbose "Module output folder: [$moduleOutputFolder]"
4545

46-
$docsOutputFolder = New-Item -Path $DocsOutputFolderPath -Name $ModuleName -ItemType Directory -Force
46+
$docsOutputFolder = New-Item -Path $DocsOutputFolderPath -ItemType Directory -Force
4747
Write-Verbose "Docs output folder: [$docsOutputFolder]"
4848
}
4949

scripts/helpers/Build/Build-PSModuleDocumentation.ps1

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -71,29 +71,26 @@ function Build-PSModuleDocumentation {
7171
}
7272
}
7373

74-
# Markdown files are called the same as the source files, but with a .md extension.
75-
# They are all located flat in the docsoutputfolder.
76-
# I want the markdown files to be moved in the same folder structure as the source files.
7774
LogGroup 'Build docs - Structure markdown files to match source files' {
78-
$PublicFunctions = Join-Path $ModuleSourceFolder.FullName 'functions\public' | Get-Item
75+
$PublicFunctionsFolder = Join-Path $ModuleSourceFolder.FullName 'functions\public' | Get-Item
7976
Get-ChildItem -Path $DocsOutputFolder -Recurse -Force -Include '*.md' | ForEach-Object {
8077
$file = $_
8178
Write-Verbose "Processing: $file"
8279

8380
# find the source code file that matches the markdown file
84-
$scriptPath = Get-ChildItem -Path $PublicFunctions -Recurse -Force | Where-Object { $_.Name -eq ($file.BaseName + '.ps1') }
81+
$scriptPath = Get-ChildItem -Path $PublicFunctionsFolder -Recurse -Force | Where-Object { $_.Name -eq ($file.BaseName + '.ps1') }
8582
Write-Verbose "Found script path: $scriptPath"
86-
$docsFilePath = ($scriptPath.FullName).Replace($PublicFunctions.FullName, $DocsOutputFolder.FullName).Replace('.ps1', '.md')
83+
$docsFilePath = ($scriptPath.FullName).Replace($PublicFunctionsFolder.FullName, $DocsOutputFolder.FullName).Replace('.ps1', '.md')
8784
Write-Verbose "Doc file path: $docsFilePath"
8885
$docsFolderPath = Split-Path -Path $docsFilePath -Parent
8986
New-Item -Path $docsFolderPath -ItemType Directory -Force
9087
Move-Item -Path $file.FullName -Destination $docsFilePath -Force
9188
}
9289
# Get the MD files that are in the public functions folder and move them to the same place in the docs folder
93-
Get-ChildItem -Path $PublicFunctions -Recurse -Force -Include '*.md' | ForEach-Object {
90+
Get-ChildItem -Path $PublicFunctionsFolder -Recurse -Force -Include '*.md' | ForEach-Object {
9491
$file = $_
9592
Write-Verbose "Processing: $file"
96-
$docsFilePath = ($file.FullName).Replace($PublicFunctions.FullName, $DocsOutputFolder.FullName)
93+
$docsFilePath = ($file.FullName).Replace($PublicFunctionsFolder.FullName, $DocsOutputFolder.FullName)
9794
Write-Verbose "Doc file path: $docsFilePath"
9895
$docsFolderPath = Split-Path -Path $docsFilePath -Parent
9996
New-Item -Path $docsFolderPath -ItemType Directory -Force

0 commit comments

Comments
 (0)