@@ -38,12 +38,13 @@ Get-ChildItem -Path (Join-Path $ProjectRoot "*" "package.json") | ForEach-Object
3838
3939 $packageName = $packageName.Matches [0 ].Value
4040 $packageFriendlyName = (Select-String - Pattern " `" displayName`" : `" (.+)`" " - Path $_ | Select-Object - First 1 ).Matches.Groups[1 ].Value
41- $packagePath = $_.Directory
41+ $packagePath = $_.DirectoryName
42+ $packageDocsPath = Join-Path $docs $packageName
4243
43- New-Item - Path ( Join-Path $docs $packageName ) - ItemType Directory
44+ New-Item - Path $packageDocsPath - ItemType Directory
4445
4546 # Create README, add front matter, and copy content
46- $packageReadmeDestination = Join-Path $docs $packageName " index.md"
47+ $packageReadmeDestination = Join-Path $packageDocsPath " index.md"
4748 New-Item - Path $packageReadmeDestination - ItemType File - Value @"
4849---
4950title: $packageFriendlyName
@@ -57,7 +58,7 @@ parent: Packages
5758 Add-Content - Path $packageReadmeDestination - Value $readmeContent
5859
5960 # Create CHANGELOG, add front matter, and copy content
60- $packageChangelogDestination = Join-Path $docs $packageName " CHANGELOG.md"
61+ $packageChangelogDestination = Join-Path $packageDocsPath " CHANGELOG.md"
6162 New-Item - Path $packageChangelogDestination - ItemType File - Value @"
6263---
6364title: Changelog
@@ -67,4 +68,20 @@ parent: $packageFriendlyName
6768
6869"@
6970 Add-Content - Path $packageChangelogDestination - Value (Get-Content - Path (Join-Path $packagePath " CHANGELOG.md" ))
71+
72+ Get-ChildItem - Path (Get-ChildItem - Path $packagePath - Directory) - Recurse - File - Include " *.md" | ForEach-Object {
73+ # Create file, add front matter, and copy content
74+ $fileFolder = Join-Path $packageDocsPath ($_.DirectoryName | Split-Path - Leaf)
75+ New-Item - Path $fileFolder - ItemType Directory
76+ $fileDestination = Join-Path $fileFolder $_.Name
77+ New-Item - Path $fileDestination - ItemType File - Value @"
78+ ---
79+ title: $ ( $_.Name )
80+ parent: $packageFriendlyName
81+ ---
82+
83+
84+ "@
85+ Add-Content - Path $fileDestination - Value (Get-Content - Path $_ )
86+ }
7087}
0 commit comments