Skip to content

fix: auto-generate component barrel file during docs sync#59

Open
rishavmukherji wants to merge 1 commit intomainfrom
fix/sync-mdx-components
Open

fix: auto-generate component barrel file during docs sync#59
rishavmukherji wants to merge 1 commit intomainfrom
fix/sync-mdx-components

Conversation

@rishavmukherji
Copy link
Copy Markdown
Contributor

Summary

  • Generates src/components/docs/index.ts barrel file in the target repo during sync
  • New components are automatically available to mdx-components.tsx without manual registration
  • Also triggers sync on mdx-components.tsx changes

Fixes the Vercel build failure caused by unregistered ElementPreview, ColorSwatch, and SnapPreview components.

Test plan

  • Merge and verify Vercel build passes on docs repo

🤖 Generated with Claude Code

Generates src/components/docs/index.ts in the target repo so
new components are automatically available to mdx-components.tsx
without manual registration.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@vercel
Copy link
Copy Markdown

vercel Bot commented Apr 6, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
snap-docs Ready Ready Preview, Comment Apr 6, 2026 10:21pm

Request Review

@CryptoExplor
Copy link
Copy Markdown

Good fix — auto-generating the barrel file during docs sync removes the manual bookkeeping that caused the Vercel build failure. A few notes from reviewing the approach:

On the trigger for mdx-components.tsx changes: Makes sense to include this since mdx-components.tsx imports from the barrel file, so any new component that lands there should propagate. Worth confirming the sync doesn't create a loop if the barrel generation itself touches mdx-components.tsx.

One question on the generated file: Is src/components/docs/index.ts gitignored in the target repo, or is it committed? If it's committed, diff noise on every new component addition is acceptable. If it's generated-only and gitignored, the Vercel build pipeline needs to run the sync script as a pre-build step — worth making sure that's documented in the target repo's build config.

Minor nit: The test plan checkbox (Merge and verify Vercel build passes on docs repo) can only be verified post-merge. It would be helpful to add a pre-merge test step, e.g., running the sync script locally and confirming index.ts is generated correctly with the new components present.

Overall this is the right approach — manual registration of MDX components is error-prone and easy to forget. LGTM once the post-merge Vercel check passes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants