Skip to content

Commit a00d17a

Browse files
authored
chore: Don't list macro crates in top-level README (#220)
1 parent 4a5f86a commit a00d17a

2 files changed

Lines changed: 40 additions & 43 deletions

File tree

README.md

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
This repository contains a set of crates that help you build robust highly scalable services in Rust.
1313

1414
- [Crates](#crates)
15-
- [About this Repo](#about-this-repo)
15+
- [About This Repo](#about-this-repo)
1616
- [Adding New Crates](#adding-new-crates)
1717
- [Publishing Crates](#publishing-crates)
1818
- [Documenting Crates](#documenting-crates)
@@ -23,26 +23,19 @@ This repository contains a set of crates that help you build robust highly scala
2323

2424
## Crates
2525

26-
These are the crates built out of this repo:
26+
These are the primary crates built out of this repo:
2727

2828
- [`bytesbuf`](./crates/bytesbuf/README.md) - Types for creating and manipulating byte sequences.
2929
- [`bytesbuf_io`](./crates/bytesbuf_io/README.md) - Asynchronous I/O abstractions expressed via `bytesbuf` types.
3030
- [`data_privacy`](./crates/data_privacy/README.md) - Mechanisms to classify, manipulate, and redact sensitive data.
31-
- [`data_privacy_macros`](./crates/data_privacy_macros/README.md) - Macros for the `data_privacy` crate.
32-
- [`data_privacy_macros_impl`](./crates/data_privacy_macros_impl/README.md) - Macros for the `data_privacy` crate.
3331
- [`fundle`](./crates/fundle/README.md) - Compile-time safe dependency injection for Rust.
34-
- [`fundle_macros`](crates/fundle_macros/README.md) - Macros for the `fundle` crate.
35-
- [`fundle_macros_impl`](crates/fundle_macros_impl/README.md) - Macros for the `fundle` crate.
3632
- [`layered`](./crates/layered/README.md) - A foundational service abstraction for building composable, middleware-driven systems.
3733
- [`ohno`](./crates/ohno/README.md) - High-quality Rust error handling.
38-
- [`ohno_macros`](./crates/ohno_macros/README.md) - Macros for the `ohno` crate.
3934
- [`recoverable`](./crates/recoverable/README.md) - Recovery information and classification for resilience patterns.
4035
- [`thread_aware`](./crates/thread_aware/README.md) - Facilities to support thread-isolated state.
41-
- [`thread_aware_macros`](./crates/thread_aware_macros/README.md) - Macros for the `thread_aware` crate.
42-
- [`thread_aware_macros_impl`](./crates/thread_aware_macros_impl/README.md) - Macros for the `thread_aware` crate.
4336
- [`tick`](./crates/tick/README.md) - Provides primitives to interact with and manipulate machine time.
4437

45-
## About this Repo
38+
## About This Repo
4639

4740
The following sections explain the overall engineering process we use
4841
in this repo.

scripts/add-crate.ps1

Lines changed: 37 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -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

Comments
 (0)