Skip to content

fix: generate chart component registry#624

Merged
mattrothenberg merged 2 commits into
cloudflare:mainfrom
awhobbs87:fix/chart-component-registry
Jul 10, 2026
Merged

fix: generate chart component registry#624
mattrothenberg merged 2 commits into
cloudflare:mainfrom
awhobbs87:fix/chart-component-registry

Conversation

@awhobbs87

Copy link
Copy Markdown
Contributor

Summary

Fixes missing API reference tables for chart components, including BubbleMap and ChoroplethMap, on the maps documentation page.

Changes

  • Discover components exported from multi-component barrel directories when matching props types are exported.
  • Categorize chart entries under Data Visualization.
  • Extract complete props metadata and JSDoc descriptions from generic interfaces when schema generation cannot process the root type.
  • Add regression coverage for barrel discovery and generic interface extraction.
  • Add a patch changeset for @cloudflare/kumo.

Validation

  • pnpm --filter @cloudflare/kumo test:unit --run scripts/component-registry/index.test.ts

  • pnpm --filter @cloudflare/kumo typecheck

  • pnpm --filter @cloudflare/kumo lint

  • pnpm --filter @cloudflare/kumo build

  • pnpm --filter @cloudflare/kumo-docs-astro build

  • Verified /charts/maps/ renders both API tables without registry error banners.

  • Reviews

    • bonk has reviewed the change
    • automated review not possible because: registry generation and static documentation output require repository build context
  • Tests

    • Tests included/updated
    • Automated tests not possible - manual testing has been completed as follows:
    • Additional testing not necessary because:

@geoquant

Copy link
Copy Markdown
Collaborator

/bonk review

@pkg-pr-new

pkg-pr-new Bot commented Jul 10, 2026

Copy link
Copy Markdown
npm i https://pkg.pr.new/@cloudflare/kumo@624

commit: dcfc830

@github-actions

github-actions Bot commented Jul 10, 2026

Copy link
Copy Markdown
Contributor

Docs Preview

View docs preview

Commit: dcfc830

@ask-bonk ask-bonk Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This is a clean, targeted fix. The barrel-directory discovery logic correctly identifies components that previously fell through the conventional {dir}/{dir}.tsx pattern, and the generic-interface fallback in generatePropsFromType provides meaningful props metadata when ts-json-schema-generator cannot process the root type. The test coverage for both paths looks good.

Left a few minor inline notes — none are blockers.

Comment thread packages/kumo/scripts/component-registry/discovery.ts Outdated
Comment thread packages/kumo/scripts/component-registry/sub-components.ts Outdated
Comment thread packages/kumo/scripts/component-registry/index.ts Outdated
@ask-bonk

ask-bonk Bot commented Jul 10, 2026

Copy link
Copy Markdown
Contributor

Review posted successfully on PR #624. I left a batch review with three minor inline suggestions (none blocking):

  • discovery.ts: Consider a .ts fallback when resolving barrel source files.
  • sub-components.ts: The generic-interface regex may struggle with nested object-literal generics.
  • index.ts: The readFileSync inside the catch block isn't guarded against read errors.

Overall the PR is clean and well-tested.

github run

@awhobbs87

Copy link
Copy Markdown
Contributor Author

/bonk review

@mattrothenberg

Copy link
Copy Markdown
Collaborator

/bonk please re-review

@ask-bonk ask-bonk Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

All previous review feedback has been addressed cleanly:

  1. Barrel resolutiondetectComponentExportsFromIndex now checks both .tsx and .ts extensions, with test coverage for plain TypeScript modules.
  2. Generic interface extractionextractPropsFromInterface was rewritten to use the TypeScript AST instead of regex, correctly handling nested generic constraints and object-literal prop types.
  3. Guarded fallback readsreadFileSync inside the generatePropsFromType catch block is now wrapped in its own try/catch, preserving the variants-only fallback if source reading fails.

The barrel-directory discovery correctly avoids double-processing directories that already have a conventional {dir}/{dir}.tsx entry point, and the category addition for chart is straightforward. Tests pass and the change is well-scoped. LGTM.

@ask-bonk

ask-bonk Bot commented Jul 10, 2026

Copy link
Copy Markdown
Contributor

Review posted successfully on PR #624. Approved.

github run

@github-actions

Copy link
Copy Markdown
Contributor
Visual Regression Report — 1 changed, 0 unchanged

1 screenshot(s) with visual changes:

Sidebar

387 px (0.03%) changed

Before After Diff
Before After Diff

Generated by Kumo Visual Regression

@mattrothenberg mattrothenberg merged commit a90dc83 into cloudflare:main Jul 10, 2026
19 checks passed
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.

4 participants