Skip to content

Commit 07719d4

Browse files
committed
Update prepare-pages.ps1
1 parent ae17a04 commit 07719d4

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

Pipelines/Scripts/prepare-pages.ps1

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,15 @@ param(
1212

1313
$ProjectRoot = Resolve-Path -Path $ProjectRoot
1414
$docs = Join-Path $ProjectRoot "docs"
15+
$images = Join-Path $docs "images"
1516

17+
New-Item -Path $images -ItemType Directory -Force
1618
# Copy root README images to docs
17-
Copy-Item -Path (Join-Path $ProjectRoot "images" "*") -Destination (Join-Path $docs "images") -Recurse -Force
19+
Copy-Item -Path (Join-Path $ProjectRoot "images" "*") -Destination $images -Recurse -Force
1820

1921
$indexDestination = Join-Path $docs "index.md"
2022
# Create home page, add front matter, and copy content
21-
New-Item -Path $indexDestination -Value @"
23+
New-Item -Path $indexDestination -ItemType File -Force -Value @"
2224
---
2325
title: Home
2426
nav_order: 1
@@ -48,11 +50,11 @@ Get-ChildItem -Path (Join-Path $ProjectRoot "*" "package.json") | ForEach-Object
4850
$packagePath = $_.DirectoryName
4951
$packageDocsPath = Join-Path $docs $packageName
5052

51-
New-Item -Path $packageDocsPath -ItemType Directory
53+
New-Item -Path $packageDocsPath -ItemType Directory -Force
5254

5355
# Create README, add front matter, and copy content
5456
$packageReadmeDestination = Join-Path $packageDocsPath "index.md"
55-
New-Item -Path $packageReadmeDestination -ItemType File -Value @"
57+
New-Item -Path $packageReadmeDestination -ItemType File -Force -Value @"
5658
---
5759
title: $packageFriendlyName
5860
parent: Packages
@@ -66,7 +68,7 @@ parent: Packages
6668

6769
# Create CHANGELOG, add front matter, and copy content
6870
$packageChangelogDestination = Join-Path $packageDocsPath "CHANGELOG.md"
69-
New-Item -Path $packageChangelogDestination -ItemType File -Value @"
71+
New-Item -Path $packageChangelogDestination -ItemType File -Force -Value @"
7072
---
7173
title: Changelog
7274
parent: $packageFriendlyName
@@ -84,10 +86,10 @@ parent: $packageFriendlyName
8486
# Create file, add front matter, and copy content
8587
# Remove the ~ from the Documentation~ folder name
8688
$fileFolder = (Join-Path $packageDocsPath ($_.DirectoryName | Split-Path -Leaf)).Replace('~', '')
87-
New-Item -Path $fileFolder -ItemType Directory
89+
New-Item -Path $fileFolder -ItemType Directory -Force
8890
$fileDestination = Join-Path $fileFolder $_.Name
8991
$fileTitle = Select-String -Pattern "# (.+)" -Path $_ | Select-Object -First 1
90-
New-Item -Path $fileDestination -ItemType File -Value @"
92+
New-Item -Path $fileDestination -ItemType File -Force -Value @"
9193
---
9294
title: $($fileTitle.Matches ? $fileTitle.Matches[0].Groups[1] : $_.BaseName)
9395
parent: $packageFriendlyName

0 commit comments

Comments
 (0)