Skip to content

docs: separate API reference documentation from README customer section#5166

Open
Zelys-DFKH wants to merge 2 commits intoaws-powertools:mainfrom
Zelys-DFKH:docs/api-reference-customer-section-removal
Open

docs: separate API reference documentation from README customer section#5166
Zelys-DFKH wants to merge 2 commits intoaws-powertools:mainfrom
Zelys-DFKH:docs/api-reference-customer-section-removal

Conversation

@Zelys-DFKH
Copy link
Copy Markdown
Contributor

@Zelys-DFKH Zelys-DFKH commented Apr 6, 2026

Summary

The API reference includes a "Becoming a reference customer" section with company logos that shouldn't appear in the generated TypeDoc output. The original README.md (published to npm) keeps that section intact, so the fix has to happen at build time rather than by editing the source files.

docs/generate_api_readme.py strips the customer section and its TOC entry from each package's README.md and the root README.md, writing API_README.md files that TypeDoc references. The generated files are gitignored and never committed.

The script runs as an mkdocs on_pre_build hook so mkdocs build handles generation automatically with no CI workflow changes. The docs:local:api npm script runs it before calling typedoc directly.

Fixes #4594


By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

Creates dedicated API_README.md for each package without the 'Becoming a
reference customer' section. TypeDoc now references API_README.md while
README.md (published to npm) retains customer references, aligning with AWS
documentation guidelines and providing consistent API reference experience.

Fixes aws-powertools#4594
@powertools-for-aws-oss-automation powertools-for-aws-oss-automation bot added the size/XXL PRs with 1K+ LOC, largely documentation related label Apr 6, 2026
Copy link
Copy Markdown
Contributor

@dreamorosi dreamorosi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR - while this does resolve the issue, I am not sure I am in favor of duplicating the contents of each README in two files.

Doing this will introduce overhead to keep them updated which will most likely result in drift.

I don't have a good solution yet - which is also why the original issue was left unresolved - but this is where I stand now.

@dreamorosi dreamorosi added the do-not-merge This item should not be merged label Apr 7, 2026
@Zelys-DFKH
Copy link
Copy Markdown
Contributor Author

Thanks for the feedback—you're right about the maintenance burden. I want to propose something simpler.

Instead of keeping two files in sync, we could generate the API_README.md at build time. The script strips out the customer section from README.md and writes the cleaned version to a dist directory. TypeDoc references the generated file, not a committed one. This way there's only one source file to edit, filtering is automated, and zero risk of drift.

Here's the approach: add a script like scripts/generate-api-readme.sh that runs before the TypeDoc build. It removes the "How to support Powertools" section from each README and outputs API_README.md. Update each typedoc.json to point to the generated file instead of the source. The generated files don't get committed to git.

The result is clean API docs while npm packages keep the original README with customer logos intact. Does this direction work for the project? I can implement it if you want to go this route.

@dreamorosi
Copy link
Copy Markdown
Contributor

Hi @Zelys-DFKH - thanks for engaging with the review feedback.

I think that could be a reasonable approach as long as it's not too brittle and it doesn't introduce too much build complexity.

Could you update the PR to show this mechanism you proposed so we can talk about it and test it?

Replace committed API_README.md files with a build-time generator.
docs/generate_api_readme.py strips the customer reference section from
each package README.md and the root README.md, including the TOC entry,
then writes API_README.md files that TypeDoc references.

Registered as an mkdocs on_pre_build hook so mkdocs build handles
generation automatically. The docs:local:api npm script runs it before
calling typedoc directly. Generated files are gitignored.
@Zelys-DFKH
Copy link
Copy Markdown
Contributor Author

Took the build-time generation approach. docs/generate_api_readme.py strips the customer section from each package's README.md and the root README.md, writing API_README.md files for TypeDoc. Nothing is committed.

The script runs as an mkdocs on_pre_build hook, so mkdocs build picks it up automatically with no CI changes. The docs:local:api npm script now runs it before calling typedoc directly.

One thing I caught while building: the TOC in each README has an entry pointing to the customer section. The script strips that too, so there are no broken anchor links in the rendered output. If the section heading ever changes, the script skips silently rather than crashing. TypeDoc just renders whatever's there.

docs/generate_api_readme.py, mkdocs.yml, package.json, typedoc.json, and .gitignore are updated. The 12 committed API_README.md files are removed.

@powertools-for-aws-oss-automation powertools-for-aws-oss-automation bot added size/M PR between 30-99 LOC and removed size/XXL PRs with 1K+ LOC, largely documentation related labels Apr 8, 2026
@sonarqubecloud
Copy link
Copy Markdown

sonarqubecloud bot commented Apr 8, 2026

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

do-not-merge This item should not be merged size/M PR between 30-99 LOC

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Maintenance: Align API reference customer names section with user guide docs

2 participants