[docs] fix docusaurus due to previous upgrade being incompatible by savil · Pull Request #2710 · jetify-com/devbox

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.

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.