Skip to content

Core: Move docgen JSDoc parser into csf-tools - #35623

Merged
huang-julien merged 1 commit into
nextfrom
refacotr/docgen_shared_extraction
Jul 28, 2026
Merged

huang-julien merged 1 commit into
nextfrom
refacotr/docgen_shared_extraction

Conversation

@huang-julien

@huang-julien huang-julien commented Jul 28, 2026 •

Copy link
Copy Markdown
Contributor

Closes #

What I did

extractJSDocInfo and extractComponentDescription were in React renderer but the description, summariy and JSDoc tags it implementes is part of the DocGenPayload which every docgen providers fills

This move them beside extractDescription in csftools so a another renderer can reuse them instead of duplicating code.

This is a refacotr. There's no additionnal feature but this makes eveyrthing more clean to work on a Vue or Angular docgen provider.

Checklist for Contributors

Testing

The changes in this PR are covered in the following automated tests:

  • stories
  • unit tests
  • integration tests
  • end-to-end tests

Manual testing

verify that nothing broke with react docgen

Caution

This section is mandatory for all contributions. If you believe no manual test is necessary, please state so explicitly. Thanks!

Documentation

  • Add or update documentation reflecting your changes
  • If you are deprecating/removing a feature, make sure to update
    MIGRATION.MD

Checklist for Maintainers

  • When this PR is ready for testing, make sure to add ci:normal, ci:merged or ci:daily GH label to it to run a specific set of sandboxes. The particular set of sandboxes can be found in code/lib/cli-storybook/src/sandbox-templates.ts

  • Declare whether manual QA will be needed for this PR during the next release, through qa:needed or qa:skip

  • Make sure this PR contains one of the labels below:

    Available labels
    • bug: Internal changes that fixes incorrect behavior.
    • maintenance: User-facing maintenance tasks.
    • dependencies: Upgrading (sometimes downgrading) dependencies.
    • build: Internal-facing build tooling & test updates. Will not show up in release changelog.
    • cleanup: Minor cleanup style change. Will not show up in release changelog.
    • documentation: Documentation only changes. Will not show up in release changelog.
    • feature request: Introducing a new feature.
    • BREAKING CHANGE: Changes that break compatibility in some way with current major version.
    • other: Changes that don't fit in the above categories.

🦋 Canary release

This PR does not have a canary release associated. You can request a canary release of this pull request by mentioning the @storybookjs/core team here.

core team members can create a canary release here or locally with gh workflow run --repo storybookjs/storybook publish.yml --field pr=<PR_NUMBER>

Summary by CodeRabbit

Summary by CodeRabbit

  • New Features

    • Added shared CSF JSDoc utilities to extract component descriptions, summaries, and tag details.
    • Improved component documentation resolution by reusing the shared description extraction logic.
  • Bug Fixes

    • Standardized JSDoc parsing across component docs and import tag processing.
    • Preserved multi-paragraph descriptions and consistently formatted extracted tag values.

@huang-julien
huang-julien requested a review from a team July 28, 2026 14:44
@coderabbitai

coderabbitai Bot commented Jul 28, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 3d4ac46d-a1de-4e32-9d0e-4f24ca1b1c3f

📥 Commits

Reviewing files that changed from the base of the PR and between abb5247 and 1f4eff7.

📒 Files selected for processing (8)
  • code/core/src/csf-tools/index.ts
  • code/core/src/csf-tools/jsdoc.test.ts
  • code/core/src/csf-tools/jsdoc.ts
  • code/renderers/react/src/componentManifest/buildReactComponentDocgen.ts
  • code/renderers/react/src/componentManifest/extractComponentDescription.ts
  • code/renderers/react/src/componentManifest/jsdocTags.ts
  • code/renderers/react/src/componentManifest/reactDocgen.ts
  • code/renderers/react/src/componentManifest/resolveComponents.ts
💤 Files with no reviewable changes (2)
  • code/renderers/react/src/componentManifest/extractComponentDescription.ts
  • code/renderers/react/src/componentManifest/jsdocTags.ts
🚧 Files skipped from review as they are similar to previous changes (6)
  • code/core/src/csf-tools/index.ts
  • code/renderers/react/src/componentManifest/reactDocgen.ts
  • code/core/src/csf-tools/jsdoc.test.ts
  • code/renderers/react/src/componentManifest/resolveComponents.ts
  • code/core/src/csf-tools/jsdoc.ts
  • code/renderers/react/src/componentManifest/buildReactComponentDocgen.ts

📝 Walkthrough

Walkthrough

JSDoc parsing and component description resolution are centralized in csf-tools, exported through its barrel, and adopted by React component manifest modules. Existing parsing tests now target the shared module.

Changes

CSF JSDoc centralization

Layer / File(s) Summary
Shared JSDoc utilities
code/core/src/csf-tools/jsdoc.ts, code/core/src/csf-tools/index.ts, code/core/src/csf-tools/jsdoc.test.ts
Adds shared JSDoc tag extraction and component description resolution, re-exports the utilities, and updates parsing tests to import the shared implementation.
React manifest import migration
code/renderers/react/src/componentManifest/...
Switches React manifest code to storybook/internal/csf-tools for JSDoc helpers instead of the former local modules.

Estimated code review effort: 3 (Moderate) | ~20 minutes

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@huang-julien huang-julien added feature request ci:normal Run our default set of CI jobs (choose this for most PRs). refactoring qa:skip Pull Requests that do not need any QA. (e.g. documentation) labels Jul 28, 2026
@huang-julien
huang-julien force-pushed the refacotr/docgen_shared_extraction branch from abb5247 to 1f4eff7 Compare July 28, 2026 15:42
@storybook-app-bot

Copy link
Copy Markdown
Contributor

Package Benchmarks

Commit: 1f4eff7, ran on 28 July 2026 at 15:50:57 UTC

The following packages have significant changes to their size or dependencies:

storybook

Before After Difference
Dependency count 70 70 0
Self size 21.31 MB 21.33 MB 🚨 +14 KB 🚨
Dependency size 33.98 MB 33.98 MB 0 B
Bundle Size Analyzer Link Link

@storybook/nextjs

Before After Difference
Dependency count 531 531 0
Self size 641 KB 641 KB 🎉 -120 B 🎉
Dependency size 62.51 MB 62.49 MB 🎉 -12 KB 🎉
Bundle Size Analyzer Link Link

@storybook/react-native-web-vite

Before After Difference
Dependency count 125 125 0
Self size 29 KB 29 KB 0 B
Dependency size 25.90 MB 25.89 MB 🎉 -12 KB 🎉
Bundle Size Analyzer Link Link

@storybook/react-vite

Before After Difference
Dependency count 83 83 0
Self size 32 KB 32 KB 🎉 -18 B 🎉
Dependency size 21.23 MB 21.22 MB 🎉 -12 KB 🎉
Bundle Size Analyzer Link Link

@storybook/react-webpack5

Before After Difference
Dependency count 272 272 0
Self size 23 KB 23 KB 🚨 +12 B 🚨
Dependency size 48.29 MB 48.27 MB 🎉 -12 KB 🎉
Bundle Size Analyzer Link Link

@storybook/tanstack-react

Before After Difference
Dependency count 84 84 0
Self size 113 KB 113 KB 0 B
Dependency size 21.26 MB 21.25 MB 🎉 -12 KB 🎉
Bundle Size Analyzer Link Link

@storybook/cli

Before After Difference
Dependency count 202 202 0
Self size 827 KB 827 KB 0 B
Dependency size 88.68 MB 88.70 MB 🚨 +14 KB 🚨
Bundle Size Analyzer Link Link

@storybook/codemod

Before After Difference
Dependency count 195 195 0
Self size 32 KB 32 KB 🚨 +36 B 🚨
Dependency size 87.16 MB 87.18 MB 🚨 +14 KB 🚨
Bundle Size Analyzer Link Link

create-storybook

Before After Difference
Dependency count 71 71 0
Self size 1.09 MB 1.09 MB 🚨 +66 B 🚨
Dependency size 55.29 MB 55.31 MB 🚨 +14 KB 🚨
Bundle Size Analyzer node node

@storybook/react

Before After Difference
Dependency count 59 59 0
Self size 1.49 MB 1.48 MB 🎉 -12 KB 🎉
Dependency size 12.30 MB 12.30 MB 0 B
Bundle Size Analyzer Link Link

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

Labels

ci:normal Run our default set of CI jobs (choose this for most PRs). feature request qa:skip Pull Requests that do not need any QA. (e.g. documentation) refactoring

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants