@@ -11,6 +11,21 @@ param(
1111)
1212
1313$ProjectRoot = Resolve-Path - Path $ProjectRoot
14+ $docs = Join-Path $ProjectRoot " docs"
15+
16+ # Copy root README images to docs
17+ Copy-Item - Path (Join-Path $ProjectRoot " images" ) - Destination $docs - Recurse
18+
19+ $indexDestination = Join-Path $docs " index.md"
20+ # Create home page, add front matter, and copy content
21+ New-Item - Path $indexDestination - Value @"
22+ ---
23+ title: Home
24+ ---
25+
26+
27+ "@
28+ Add-Content - Path $indexDestination - Value (Get-Content - Path (Join-Path $ProjectRoot " README.md" ))
1429
1530# Loop through package directories and copy documentation
1631Get-ChildItem - Path (Join-Path $ProjectRoot " *" " package.json" ) | ForEach-Object {
@@ -25,7 +40,8 @@ Get-ChildItem -Path (Join-Path $ProjectRoot "*" "package.json") | ForEach-Object
2540 $packagePath = $_.Directory
2641
2742 # Create README, add front matter, and copy content
28- New-Item - Path " ./$packageName .md" - Value @"
43+ $packageReadmeDestination = Join-Path $docs " $packageName .md"
44+ New-Item - Path $packageReadmeDestination - Value @"
2945---
3046title: $packageFriendlyName
3147parent: Packages
@@ -35,16 +51,17 @@ parent: Packages
3551"@
3652 $readmeContent = (Get-Content - Path (Join-Path $packagePath " README.md" ))
3753 $readmeContent = $readmeContent -replace " > \[!(\w+)\]" , { " {: .$ ( " $ ( $_.Groups [1 ]) " .ToLower()) }" } # Convert GitHub admonitions to just-the-docs syntax
38- Add-Content - Path " ./ $packageName .md " - Value $readmeContent
54+ Add-Content - Path $packageReadmeDestination - Value $readmeContent
3955
4056 # Create CHANGELOG, add front matter, and copy content
41- New-Item - Path " ./$packageName .CHANGELOG.md" - Value @"
57+ $packageChangelogDestination = Join-Path $docs " $packageName .CHANGELOG.md"
58+ New-Item - Path $packageChangelogDestination - Value @"
4259---
4360title: Changelog
4461parent: $packageFriendlyName
4562---
4663
4764
4865"@
49- Add-Content - Path " ./ $packageName .CHANGELOG.md " - Value (Get-Content - Path (Join-Path $packagePath " CHANGELOG.md" ))
66+ Add-Content - Path $packageChangelogDestination - Value (Get-Content - Path (Join-Path $packagePath " CHANGELOG.md" ))
5067}
0 commit comments