From 4956f12ed5c06d5d1b954f4f132eeb802ad79a25 Mon Sep 17 00:00:00 2001 From: Martin Taillefer Date: Wed, 21 Jan 2026 20:59:09 -0800 Subject: [PATCH] chore: Don't list macro crates in top-level README --- README.md | 13 ++------ scripts/add-crate.ps1 | 70 +++++++++++++++++++++++-------------------- 2 files changed, 40 insertions(+), 43 deletions(-) diff --git a/README.md b/README.md index 34d406c8..0085af2e 100644 --- a/README.md +++ b/README.md @@ -12,7 +12,7 @@ This repository contains a set of crates that help you build robust highly scalable services in Rust. - [Crates](#crates) -- [About this Repo](#about-this-repo) +- [About This Repo](#about-this-repo) - [Adding New Crates](#adding-new-crates) - [Publishing Crates](#publishing-crates) - [Documenting Crates](#documenting-crates) @@ -23,26 +23,19 @@ This repository contains a set of crates that help you build robust highly scala ## Crates -These are the crates built out of this repo: +These are the primary crates built out of this repo: - [`bytesbuf`](./crates/bytesbuf/README.md) - Types for creating and manipulating byte sequences. - [`bytesbuf_io`](./crates/bytesbuf_io/README.md) - Asynchronous I/O abstractions expressed via `bytesbuf` types. - [`data_privacy`](./crates/data_privacy/README.md) - Mechanisms to classify, manipulate, and redact sensitive data. -- [`data_privacy_macros`](./crates/data_privacy_macros/README.md) - Macros for the `data_privacy` crate. -- [`data_privacy_macros_impl`](./crates/data_privacy_macros_impl/README.md) - Macros for the `data_privacy` crate. - [`fundle`](./crates/fundle/README.md) - Compile-time safe dependency injection for Rust. -- [`fundle_macros`](crates/fundle_macros/README.md) - Macros for the `fundle` crate. -- [`fundle_macros_impl`](crates/fundle_macros_impl/README.md) - Macros for the `fundle` crate. - [`layered`](./crates/layered/README.md) - A foundational service abstraction for building composable, middleware-driven systems. - [`ohno`](./crates/ohno/README.md) - High-quality Rust error handling. -- [`ohno_macros`](./crates/ohno_macros/README.md) - Macros for the `ohno` crate. - [`recoverable`](./crates/recoverable/README.md) - Recovery information and classification for resilience patterns. - [`thread_aware`](./crates/thread_aware/README.md) - Facilities to support thread-isolated state. -- [`thread_aware_macros`](./crates/thread_aware_macros/README.md) - Macros for the `thread_aware` crate. -- [`thread_aware_macros_impl`](./crates/thread_aware_macros_impl/README.md) - Macros for the `thread_aware` crate. - [`tick`](./crates/tick/README.md) - Provides primitives to interact with and manipulate machine time. -## About this Repo +## About This Repo The following sections explain the overall engineering process we use in this repo. diff --git a/scripts/add-crate.ps1 b/scripts/add-crate.ps1 index 389b2bbf..a4187b93 100644 --- a/scripts/add-crate.ps1 +++ b/scripts/add-crate.ps1 @@ -93,45 +93,49 @@ Get-ChildItem -Path $destinationDir -Recurse | ForEach-Object { Set-Content -Path $filePath -Value $content -NoNewline } -# Update root README.md -$readmePath = Join-Path $repoRoot "README.md" -$readmeLines = Get-Content $readmePath -$cratesList = @{} -$inCratesSection = $false -$readmeInsertionIndex = -1 -$readmeEndIndex = -1 - -for ($i = 0; $i -lt $readmeLines.Length; $i++) { - if ($readmeLines[$i] -eq "## Crates") { - $inCratesSection = $true - continue - } - if ($inCratesSection) { - if ($readmeLines[$i] -match '^- \[`(.*)`\](.*)') { - if($readmeInsertionIndex -eq -1) { - $readmeInsertionIndex = $i +# Update root README.md (skip for macro crates) +if ($crateName -notlike "*_macros*") { + $readmePath = Join-Path $repoRoot "README.md" + $readmeLines = Get-Content $readmePath + $cratesList = @{} + $inCratesSection = $false + $readmeInsertionIndex = -1 + $readmeEndIndex = -1 + + for ($i = 0; $i -lt $readmeLines.Length; $i++) { + if ($readmeLines[$i] -eq "## Crates") { + $inCratesSection = $true + continue + } + if ($inCratesSection) { + if ($readmeLines[$i] -match '^- \[`(.*)`\](.*)') { + if($readmeInsertionIndex -eq -1) { + $readmeInsertionIndex = $i + } + $cratesList[$Matches[1]] = $readmeLines[$i] + $readmeEndIndex = $i + } elseif ($readmeLines[$i].Trim() -ne "" -and $readmeInsertionIndex -ne -1) { + break } - $cratesList[$Matches[1]] = $readmeLines[$i] - $readmeEndIndex = $i - } elseif ($readmeLines[$i].Trim() -ne "" -and $readmeInsertionIndex -ne -1) { - break } } -} -$cratesList[$crateName] = ('- [`{0}`](./crates/{0}/README.md) - {1}' -f $crateName, $crateDescription) -$sortedCrateNames = $cratesList.Keys | Sort-Object + $cratesList[$crateName] = ('- [`{0}`](./crates/{0}/README.md) - {1}' -f $crateName, $crateDescription) + $sortedCrateNames = $cratesList.Keys | Sort-Object -if ($readmeInsertionIndex -ne -1) { - $newLines = @() - foreach ($name in $sortedCrateNames) { - $newLines += $cratesList[$name] + if ($readmeInsertionIndex -ne -1) { + $newLines = @() + foreach ($name in $sortedCrateNames) { + $newLines += $cratesList[$name] + } + $pre = $readmeLines[0..($readmeInsertionIndex-1)] + $post = $readmeLines[($readmeEndIndex+1)..$readmeLines.Length] + $newReadmeContent = ($pre + $newLines + $post) -join [System.Environment]::NewLine + Set-Content -Path $readmePath -Value $newReadmeContent + Write-Host "Updated root README.md" } - $pre = $readmeLines[0..($readmeInsertionIndex-1)] - $post = $readmeLines[($readmeEndIndex+1)..$readmeLines.Length] - $newReadmeContent = ($pre + $newLines + $post) -join [System.Environment]::NewLine - Set-Content -Path $readmePath -Value $newReadmeContent - Write-Host "Updated root README.md" +} else { + Write-Host "Skipping README.md update for macro crate" }