Skip to content

Conversation

savil
Copy link
Collaborator

@savil savil commented Sep 29, 2025

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.

@savil savil requested review from loreto and LucilleH September 29, 2025 19:56
@savil savil marked this pull request as ready for review September 29, 2025 19:56
Copy link
Contributor

@loreto loreto left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@savil savil merged commit 93bd4ec into main Sep 29, 2025
52 of 62 checks passed
@savil savil deleted the savil/fix-docusaurus-dependencies branch September 29, 2025 20:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants