Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add favicon to TypeDoc generated output via plugin script (#132)
## Problem Currently, our generated documentation for the Typescript client doesn't have a favicon, which would be nice. TypeDoc doesn't provide a straightforward way of providing a favicon asset, but they do provide the ability to write custom plugin scripts to modify the generated output. TypeDoc custom theme documentation: https://github.com/TypeStrong/typedoc/blob/master/internal-docs/custom-themes.md ## Solution - Add an `/assets/` folder to the top level of the repo. - Add the `favicon-32x32.png` image (generated from: https://www.figma.com/file/4tZhnN7BbFM6yWqPGjjVbf/Favicon?type=design&node-id=0-1&mode=design&t=nNcepCxWYRcJWwWx-0) - Add a new `docs-theme.mjs` script to be provided to TypeDoc at build time. The `docs-theme.mjs` script does two things: - `onPageRendered` takes the `page` output from typedoc and injects a `<link .../>` into `head`. - Copies `favicon-32x32.png` from `./assets` to the new `/docs` folder. **Note:** I was having issues writing a plain `.js` file for the script (no imports warning, etc), but `.mjs` seems to work well given our current TS setup. Would definitely love feedback here around improving things though, I didn't play around with our configs much. |Before|After| |-----|-----| |![Screenshot 2023-10-03 at 5 45 39 PM](https://github.com/pinecone-io/pinecone-ts-client/assets/119623786/f1bbacf1-8d75-45db-b9aa-7bf3515bdd80)|![Screenshot 2023-10-03 at 5 45 44 PM](https://github.com/pinecone-io/pinecone-ts-client/assets/119623786/b6fd603f-3bc9-4a16-8f61-38bdd35d55c7)| ## Type of Change - [ ] Bug fix (non-breaking change which fixes an issue) - [ ] New feature (non-breaking change which adds functionality) - [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected) - [ ] This change requires a documentation update - [X] Infrastructure change (CI configs, etc) - [ ] Non-code change (docs, etc) - [ ] None of the above: (explain here) ## Test Plan You should be able to test locally by pulling this branch down, and running `npm run docs:build`. Make sure the generated output includes the Pinecone logo in the tab. Inspect the page source to confirm the presence of `favicon-32x32.png`. Confirm the docs build step of the PR workflow run completes as expected.
- Loading branch information