Skip to content

Commit 93bd4ec

Browse files
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

4 files changed

+79
-1860
lines changed

docs/README.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,21 +8,22 @@ This website is built using [Docusaurus](https://docusaurus.io/), a modern stati
88
```bash
99
cd docs/app # from the devbox root directory
1010
devbox shell # optional, develop inside a devbox
11-
yarn install # run in devbox shell
11+
pnpm install # run in devbox shell
1212
```
1313

1414
### Local Development
1515

1616
```bash
17-
yarn start
17+
devbox run start
1818
```
1919

2020
This command starts a local development server and opens up a browser window. Most changes are reflected live without having to restart the server.
21+
NOTE: this will open localhost:3000/docs that will show a 404 Not Found. Go to localhost:3000/docs/devbox instead to find the real docs.
2122

2223
### Build
2324

2425
```bash
25-
yarn build
26+
devbox run build
2627
```
2728

2829
This command generates static content into the `build` directory and can be served using any static contents hosting service.

0 commit comments

Comments
 (0)