This issue tracks the necessary work to create a command that regenerates the API documentation upon Public API changes.
By adding some code to the top-level README file of a package they get automatically updated. See instructions. There are some packages that may be more involved or need work in the tool that generates the docs (docgen), in which case they have some notes added.
Progress:
Misc:
npm run docs:build https://github.com/WordPress/gutenberg/pull/14216docgen. https://github.com/WordPress/gutenberg/pull/15421Packages:
@class/@memberof support to auto-document methods, etc. See also token-list. https://github.com/WordPress/gutenberg/issues/15178compose. To be considered after edit-post docs are merged, so we can extrapolate what we learned there.@name tag?compose. Complex README.withSelect.@class/@memberof support to auto-document methods, etc. See also api-fetch.Not supported (CommonJS module).
In the majority of cases, there is nothing to auto-generate for CLI based modules so I wouldn't consider it as an issue :)
For those subscribed to this master issue: most packages are ready for review.
Only 4 reviews left! Props to @mkaz for crushing them all.
plugins merged and wordcount is ready to go. This leaves data and edit-post. I hope to review the latter on Monday if @mkaz doesn't beat me to it :)
@nosolosw - I don't think it's a good candidate for Good First Issue in the current form :)
Should we close this issue and open follow-up issues for the remaining work?
Agree to remove the "Good first issue". I still think it has value as a _master issue_, otherwise, things will become too scattered and will be difficult to understand where things stand.
Some thoughts about how to deal with current "undocumented symbols" that may or may not have a README file:
@see tag to the README file (not @link, though). Note that we should use an URL to GitHub, so it's reachable from other places where this is published (handbook, npm).cc @aduth
- add the JSDoc to the component, and then adapt the script to include the component's README in the auto-generation process.
By "include", do you mean _output to_ in a similar way to the demarcations present in the top-level README files?
- add the JSDoc to the component, and then adapt the script to include the component's README in the auto-generation process.
By "include", do you mean _output to_ in a similar way to the demarcations present in the top-level README files?
To answer my own question, I assume that yes, it would be simple enough to add additional entry points for each of the components to output to their respective README.md files. I think the main challenge we'll face here is how to properly document Component classes in such a way which provides useful information; specifically prop types. There may be overlap with #15178, treating prop types as arguments to the constructor. It may be the sort of thing we'd want a "custom formatter" for as well.
There's https://github.com/WordPress/gutenberg/pull/15421 to teach the handbook to use docgen for doc generation.
Updated the list of packages. There's some new ones that are easy wins, in case anyone is interested.