docs: separate API reference documentation from README customer section#5166
docs: separate API reference documentation from README customer section#5166Zelys-DFKH wants to merge 2 commits intoaws-powertools:mainfrom
Conversation
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
dreamorosi
left a comment
There was a problem hiding this comment.
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.
|
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 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. |
|
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.
|
Took the build-time generation approach. The script runs as an mkdocs 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.
|
|



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.pystrips the customer section and its TOC entry from each package'sREADME.mdand the rootREADME.md, writingAPI_README.mdfiles that TypeDoc references. The generated files are gitignored and never committed.The script runs as an mkdocs
on_pre_buildhook somkdocs buildhandles generation automatically with no CI workflow changes. Thedocs:local:apinpm script runs it before callingtypedocdirectly.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.