@@ -93,45 +93,49 @@ Get-ChildItem -Path $destinationDir -Recurse | ForEach-Object {
9393 Set-Content - Path $filePath - Value $content - NoNewline
9494}
9595
96- # Update root README.md
97- $readmePath = Join-Path $repoRoot " README.md"
98- $readmeLines = Get-Content $readmePath
99- $cratesList = @ {}
100- $inCratesSection = $false
101- $readmeInsertionIndex = -1
102- $readmeEndIndex = -1
103-
104- for ($i = 0 ; $i -lt $readmeLines.Length ; $i ++ ) {
105- if ($readmeLines [$i ] -eq " ## Crates" ) {
106- $inCratesSection = $true
107- continue
108- }
109- if ($inCratesSection ) {
110- if ($readmeLines [$i ] -match ' ^- \[`(.*)`\](.*)' ) {
111- if ($readmeInsertionIndex -eq -1 ) {
112- $readmeInsertionIndex = $i
96+ # Update root README.md (skip for macro crates)
97+ if ($crateName -notlike " *_macros*" ) {
98+ $readmePath = Join-Path $repoRoot " README.md"
99+ $readmeLines = Get-Content $readmePath
100+ $cratesList = @ {}
101+ $inCratesSection = $false
102+ $readmeInsertionIndex = -1
103+ $readmeEndIndex = -1
104+
105+ for ($i = 0 ; $i -lt $readmeLines.Length ; $i ++ ) {
106+ if ($readmeLines [$i ] -eq " ## Crates" ) {
107+ $inCratesSection = $true
108+ continue
109+ }
110+ if ($inCratesSection ) {
111+ if ($readmeLines [$i ] -match ' ^- \[`(.*)`\](.*)' ) {
112+ if ($readmeInsertionIndex -eq -1 ) {
113+ $readmeInsertionIndex = $i
114+ }
115+ $cratesList [$Matches [1 ]] = $readmeLines [$i ]
116+ $readmeEndIndex = $i
117+ } elseif ($readmeLines [$i ].Trim() -ne " " -and $readmeInsertionIndex -ne -1 ) {
118+ break
113119 }
114- $cratesList [$Matches [1 ]] = $readmeLines [$i ]
115- $readmeEndIndex = $i
116- } elseif ($readmeLines [$i ].Trim() -ne " " -and $readmeInsertionIndex -ne -1 ) {
117- break
118120 }
119121 }
120- }
121122
122- $cratesList [$crateName ] = (' - [`{0}`](./crates/{0}/README.md) - {1}' -f $crateName , $crateDescription )
123- $sortedCrateNames = $cratesList.Keys | Sort-Object
123+ $cratesList [$crateName ] = (' - [`{0}`](./crates/{0}/README.md) - {1}' -f $crateName , $crateDescription )
124+ $sortedCrateNames = $cratesList.Keys | Sort-Object
124125
125- if ($readmeInsertionIndex -ne -1 ) {
126- $newLines = @ ()
127- foreach ($name in $sortedCrateNames ) {
128- $newLines += $cratesList [$name ]
126+ if ($readmeInsertionIndex -ne -1 ) {
127+ $newLines = @ ()
128+ foreach ($name in $sortedCrateNames ) {
129+ $newLines += $cratesList [$name ]
130+ }
131+ $pre = $readmeLines [0 .. ($readmeInsertionIndex - 1 )]
132+ $post = $readmeLines [($readmeEndIndex + 1 ).. $readmeLines.Length ]
133+ $newReadmeContent = ($pre + $newLines + $post ) -join [System.Environment ]::NewLine
134+ Set-Content - Path $readmePath - Value $newReadmeContent
135+ Write-Host " Updated root README.md"
129136 }
130- $pre = $readmeLines [0 .. ($readmeInsertionIndex - 1 )]
131- $post = $readmeLines [($readmeEndIndex + 1 ).. $readmeLines.Length ]
132- $newReadmeContent = ($pre + $newLines + $post ) -join [System.Environment ]::NewLine
133- Set-Content - Path $readmePath - Value $newReadmeContent
134- Write-Host " Updated root README.md"
137+ } else {
138+ Write-Host " Skipping README.md update for macro crate"
135139}
136140
137141
0 commit comments