Commit 93bd4ec
authored
[docs] fix docusaurus due to previous upgrade being incompatible (#2710)
## Summary
Docusaurus was failing to start due to an incompatible upgrade in #2684:
`Module not found: Error: Can't resolve '@theme/ResponseSamples'`
Also updated README to reflect new tooling.
Finally, I tried to fix the local `pnpm start` opening to
`localhost:3000/docs/devbox` but didn't succeed for now. Left a note in
the README to alert developers about it.
**Upgrade Fix**
- The component name changed from ResponseSamples to ResponseExamples,
but more importantly, the component API also changed:
- Old (v4.4.0):
```
import ResponseSamples from "@theme/ResponseSamples";
<ResponseSamples
responseExample={"{\n \"query\": \"string\", ...}"}
language={"json"}
/>
```
- New (v4.5.1):
The new version uses a completely different component structure - it no
longer uses ResponseSamples or ResponseExamples directly in the
generated MDX. Instead, it uses a different set of components like
StatusCodes, RequestSchema, etc.
```
# Regenerate the API docs from the OpenAPI spec
pnpm docusaurus gen-api-docs nixhub
# Move the regenerated files to the correct location
cp docs/nixhub/*.api.mdx nixhub/
# Clean up the temporary directory
rm -rf docs/nixhub
```
Files Updated
- nixhub/search-packages.api.mdx
- nixhub/resolve-a-package-version.api.mdx
- nixhub/get-a-package.api.mdx
These files now use the updated component structure compatible with
docusaurus-theme-openapi-docs v4.5.1.
## How was it tested?
`devbox run start` and opened devbox docs as well as the Nixhub docs.
`devbox run build` and `devbox run serve` and opened the docs again in
localhost, just to be safe and ensure the production environment will
work in Vercel.
## Community Contribution License
All community contributions in this pull request are licensed to the
project
maintainers under the terms of the
[Apache 2 License](https://www.apache.org/licenses/LICENSE-2.0).
By creating this pull request, I represent that I have the right to
license the
contributions to the project maintainers under the Apache 2 License as
stated in
the
[Community Contribution
License](https://github.com/jetify-com/opensource/blob/main/CONTRIBUTING.md#community-contribution-license).1 parent c87e8f7 commit 93bd4ec
File tree
4 files changed
+79
-1860
lines changed- docs
- app/nixhub
4 files changed
+79
-1860
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
11 | | - | |
| 11 | + | |
12 | 12 | | |
13 | 13 | | |
14 | 14 | | |
15 | 15 | | |
16 | 16 | | |
17 | | - | |
| 17 | + | |
18 | 18 | | |
19 | 19 | | |
20 | 20 | | |
| 21 | + | |
21 | 22 | | |
22 | 23 | | |
23 | 24 | | |
24 | 25 | | |
25 | | - | |
| 26 | + | |
26 | 27 | | |
27 | 28 | | |
28 | 29 | | |
| |||
0 commit comments