@@ -11,6 +11,18 @@ param(
1111)
1212
1313$ProjectRoot = Resolve-Path - Path $ProjectRoot
14+ $docs = Join-Path $ProjectRoot " docs"
15+
16+ $indexDestination = Join-Path $docs " index.md"
17+ # Create home page, add front matter, and copy content
18+ New-Item - Path $indexDestination - Value @"
19+ ---
20+ title: Home
21+ ---
22+
23+
24+ "@
25+ Add-Content - Path $indexDestination - Value (Get-Content - Path (Join-Path $ProjectRoot " README.md" ))
1426
1527# Loop through package directories and copy documentation
1628Get-ChildItem - Path (Join-Path $ProjectRoot " *" " package.json" ) | ForEach-Object {
@@ -25,7 +37,8 @@ Get-ChildItem -Path (Join-Path $ProjectRoot "*" "package.json") | ForEach-Object
2537 $packagePath = $_.Directory
2638
2739 # Create README, add front matter, and copy content
28- New-Item - Path " ./$packageName .md" - Value @"
40+ $packageReadmeDestination = Join-Path $docs " $packageName .md"
41+ New-Item - Path $packageReadmeDestination - Value @"
2942---
3043title: $packageFriendlyName
3144parent: Packages
@@ -35,16 +48,17 @@ parent: Packages
3548"@
3649 $readmeContent = (Get-Content - Path (Join-Path $packagePath " README.md" ))
3750 $readmeContent = $readmeContent -replace " > \[!(\w+)\]" , { " {: .$ ( " $ ( $_.Groups [1 ]) " .ToLower()) }" } # Convert GitHub admonitions to just-the-docs syntax
38- Add-Content - Path " ./ $packageName .md " - Value $readmeContent
51+ Add-Content - Path $packageReadmeDestination - Value $readmeContent
3952
4053 # Create CHANGELOG, add front matter, and copy content
41- New-Item - Path " ./$packageName .CHANGELOG.md" - Value @"
54+ $packageChangelogDestination = Join-Path $docs " $packageName .CHANGELOG.md"
55+ New-Item - Path $packageChangelogDestination - Value @"
4256---
4357title: Changelog
4458parent: $packageFriendlyName
4559---
4660
4761
4862"@
49- Add-Content - Path " ./ $packageName .CHANGELOG.md " - Value (Get-Content - Path (Join-Path $packagePath " CHANGELOG.md" ))
63+ Add-Content - Path $packageChangelogDestination - Value (Get-Content - Path (Join-Path $packagePath " CHANGELOG.md" ))
5064}
0 commit comments