Automatically generate and publish API docs to GitHub Pages for each package once again
Currently, we do not publish generated API documentation to GitHub Pages for any of the packages in this monorepo. The workflow to do this was functional for a while, at least locally, but it broke when we switched over to ts-bridge. To be specific, typedoc now throws when run as it does not know what to do when there are type declaration files that do not end in .d.ts (ours end in d.cts and .d.mjs).
To fix this, we need to fix the docs publishing workflow so that it clears out any existing built files, then re-builds the monorepo using tsc instead of ts-bridge. This will generate the .d.ts that typedoc expects. In addition, we need to configure typedoc at the package level so that it uses the build-specific TypeScript config file (tsconfig.build.json).
Finally, we need to update the docs publishing workflows to retain versions for deployments at the monorepo package level. We know that the URL must start with https://metamask.github.io/core, as that's how GitHub Pages works. However, each time we make a new release of a package, we don't want to blow away existing documentation for that package. So we need to determine which versions of packages are being released and assign them to the correct subdirectory. For instance, if a new release includes version 12.0.0 of keyring-controller and version 9.0.0 of base-controller, we would need to deploy the new documentation under https://metamask.github.io/core/keyring-controller/v12.0.0 and https://metamask.github.io/core/base-controller/v9.0.0, respectively.
Acceptance Criteria
- When a release PR is merged, a GitHub workflow runs that uses
typedocto generate documentation for all packages included in the release, copies each package's documentation to<package-name>/<version>in thegh-pagesbranch, and pushes that branch - Visiting
https://metamask.github.io/core/<package>/<version>should display the published documentation - Visiting
https://metamask.github.io/core/<package>should redirect to the documentation for the latest version of the package in question - Visiting
https://metamask.github.io/coreshould display a home page that allows navigating to the documentation for the latest version of each package in the monorepo
I've made some progress on this ticket in this branch: https://github.com/MetaMask/core/tree/get-typedoc-working-again. I only have a few packages enabled for documentation, but they seem to work. You can generate the documentation by running yarn build:docs and then yarn typedoc.
Probably deserves its own ticket, but we should also make the API docs prettier. Here are some existing docsites that look great: