- Notifications
You must be signed in to change notification settings - Fork 16.3k
feat(frontend): upgrade Storybook and add extension component documentation #36498
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
| CodeAnt AI is reviewing your PR. |
| Bito Automatic Review Skipped - Files Excluded |
| CodeAnt AI finished reviewing your PR. |
💡 Enhance Your PR ReviewsWe noticed that 3 feature(s) are not configured for this repository. Enabling these features can help improve your code quality and workflow: 🚦 Quality GatesStatus: Quality Gates are not enabled at the organization level 🎫 Jira Ticket ComplianceStatus: Jira credentials file not found. Please configure Jira integration in your settings ⚙️ Custom RulesStatus: No custom rules configured. Add rules via organization settings or .codeant/review.json in your repository Want to enable these features? Contact your organization admin or check our documentation for setup instructions. |
| CodeAnt AI is running Incremental review |
PR Review Feedback AddressedRebased on master and addressed the following review feedback: 1. Script Comment Mismatch ✅Fixed misleading header comment that claimed the script scans for 2. Hardcoded "Sample alert message" ✅The MDX generator is now story-driven - it extracts actual
3. Alert-like Component Structure Assumption ✅Fixed - same as above. Live examples now use actual story props. 4. Webpack/TypeScript Alias Mismatch ✅Added clarifying comments to both
5. Inconsistent Import Path ✅Updated all imports from 6. Components Section Sidebar Position ✅Moved Components from the end of the Extensions sidebar to after "Contribution Types" - following the logical learning path: understand the toolkit → learn extension points → build. All changes are purely programmatic (regex parsing + string templates) with no AI involved in the doc generation itself. |
Upgrade all @storybook/* packages to 8.6.14 across the monorepo: - superset-frontend root package.json - packages/superset-ui-demo/package.json Also adds @storybook/test-runner to validate all stories compile and render without errors: - `npm run test-storybook` - run against a running Storybook server - `npm run test-storybook:ci` - build static + serve + test (for CI) This aligns all Storybook dependencies to a consistent version and picks up the latest patches and security fixes in the 8.x line. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Add @storybook/test-runner for automated story smoke tests - Add test-storybook and test-storybook:ci npm scripts - Add test-storybook job to GitHub Actions CI workflow - Fix webpack alias for react-dom/test-utils resolution - Fix null safety in webpack.config.js for test-storybook - Fix exampleThemes import in .storybook/preview.jsx - Fix DesignSystem.stories.tsx: convert markdown table to HTML - Fix AlteredSliceTag.stories.tsx: pass correct diffs prop - Fix ExampleApp.stories.jsx: import Alert/Table from antd - Fix ListViewCard.stories.tsx: simplify to avoid stack overflow 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Document the new npm run test-storybook and test-storybook:ci commands in the Storybook section of the development docs. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Add infrastructure for documenting components available to extension developers: - Add `extension-compatible` tag convention for Storybook stories - Add `extensionMeta` parameters for package/import info in stories - Create generate-extension-components.mjs script that: - Scans superset-core for stories with extension-compatible tag - Generates MDX documentation pages automatically - Creates index page listing all available components - Add Components section to Extensions in developer portal sidebar - Add npm script: `npm run generate:extension-components` - Tag Alert component as first extension-compatible component To add more components to extension docs: 1. Add `tags: ['extension-compatible']` to the story 2. Add `extensionMeta` parameters with package/import info 3. Run `npm run generate:extension-components` in docs/ 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Fix sidebar label: "Components > Overview" instead of "Components > Components" - Add live component rendering with StoryWithControls - Extract argTypes to generate interactive controls (select, boolean) - Parse variable references for select options (e.g., `options: types`) - Skip action argTypes (not user controls) - Auto-generate props table from story args - Fix component source link path 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Run generate:extension-components automatically before docusaurus start and build, so new extension-compatible stories are picked up without manual script execution. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Document how to mark components as extension-compatible: - Requirements for component location and exports - Story metadata fields (tags, extensionMeta) - How the auto-generation works - Best practices for argTypes and descriptions 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Add @docusaurus/theme-live-codeblock for interactive code editing - Create ReactLiveScope with extension components (Alert, etc.) - Update generator to include "Try It" section with live code blocks - Users can now edit code and see real-time component rendering The component pages now have: 1. Live Example - UI controls for quick prop toggling 2. Try It - Editable code block for experimentation 3. Usage in Extensions - Copy-paste code for real usage 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Move "This component is available in..." text from separate Installation section into Usage in Extensions section for cleaner layout. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
New order: Live Example → Try It → Props → Usage in Extensions → Source Keeps Props close to the live editor for quick reference while editing. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Components in @apache-superset/core are now automatically documented by virtue of their location - no manual tagging needed. Changes: - Remove extension-compatible tag requirement from generator - Remove tags and extensionMeta from Alert story (no longer needed) - Update developer portal docs to reflect simpler workflow - Update index page template with new instructions Workflow is now: 1. Add component to superset-core/src/ui/components/ 2. Create a Storybook story 3. Run yarn start in docs/ - done! 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Remove unused variables in generate-extension-components.mjs - Fix formatting with prettier 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
…imports The docs TypeScript build cannot resolve imports from superset-frontend. Create ExtensionComponents.tsx with local wrappers that mirror the @apache-superset/core API for use in documentation examples. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Instead of maintaining duplicate component wrappers, configure proper path aliasing so docs can import directly from @apache-superset/core: - Add webpack alias in webpack.extend.ts - Add tsconfig path mapping in tsconfig.json - Update ReactLiveScope and MDX to use package imports - Remove ExtensionComponents.tsx wrapper (no longer needed) This approach scales better as more components are added to the extension API - no wrapper maintenance required. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Add `npx playwright install-deps` to install system-level dependencies (libglib, libnss3, etc.) required to run browsers in the Docker container. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
TypeScript can't resolve types from superset-frontend due to the exclude pattern. Add a type declaration file that provides the types for tsc, while webpack alias handles the runtime resolution. This approach: - Type declarations in src/types/ for TypeScript compilation - Webpack alias for runtime module resolution - No need to maintain duplicate implementations 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
The @apache-superset/core package imports theme which has @fontsource dependencies. Point the webpack alias directly to the components folder to avoid pulling in fonts that aren't installed in docs. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
The generator now extracts type exports from component files and generates the .d.ts file automatically. No manual maintenance needed. When a new component is added to superset-core/src/ui/components/: - MDX documentation page is generated - Type declarations are extracted and added to .d.ts 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
The typecheck script needs to run the generator first to ensure the type declarations file exists before tsc runs. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Move paths, jsx, moduleResolution inside compilerOptions (they were being ignored) - Restructure types as src/types/apache-superset-core/index.d.ts so TypeScript resolves it as a module - Generator creates the types directory and index.d.ts automatically - Remove unnecessary triple-slash reference 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Storybook 8 has an ESM resolution issue where it tries to import react-dom/test-utils without an extension. Add webpack rule to disable fullySpecified for .mjs files. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Add test-runner-jest.config.js with 60s timeout (was 15s default) - Limit to 2 workers in CI to reduce memory pressure and timeouts - Stories were timing out in CI due to slow rendering + parallel load 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Regenerate package-lock.json starting from master's lockfile to preserve working peer dependency resolutions for @deck.gl packages. This fixes npm ci failures in CI. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
The storybook test-runner was timing out on all 214 tests because every story crashed with JavaScript errors before rendering: - "$RefreshSig$ is not defined" - React Fast Refresh transforms - "jsxDEV is not a function" - Development JSX runtime Root cause: Superset's webpack.config.js defaults to development mode (isDevMode = mode !== 'production'), which enables: - ReactRefreshWebpackPlugin - SWC loader with refresh: true and development: true When storybook builds, it inherits these settings. The static build includes Fast Refresh and jsxDEV code, but the runtime isn't available when served via http-server, causing immediate crashes. Fix: - Filter out ReactRefreshWebpackPlugin from inherited plugins - Override SWC loader to set refresh: false and development: false - Add test-runner.ts config with error logging for debugging Before: 142 test files, 214 tests - ALL FAILING (60s timeouts each) After: All tests PASS in ~1-2 seconds each 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Fix misleading comment claiming script scans for 'extension-compatible' tags when it actually processes all stories in superset-core/src - Make MDX generation story-driven: extract actual args/controls from stories instead of generating hardcoded Alert-specific code - Add text controls for string props (message, description) automatically - Extract prop descriptions from argTypes for better documentation - Update import path to @apache-superset/core/ui to match established codebase pattern used throughout superset-frontend - Add clarifying comments to webpack.extend.ts and tsconfig.json explaining the intentional split between runtime and type resolution - Move Components section in sidebar after Contribution Types to follow logical learning path (understand toolkit before implementation) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Simplify the args parsing regex by removing escape sequence handling. The nested quantifiers in the previous regex could theoretically cause exponential backtracking, though the practical risk was low since input is trusted local files. The simpler regex is sufficient for Storybook args which rarely contain escaped quotes. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
fac4b0b to fd14483 Compare
Summary
This PR upgrades Storybook and introduces an automated documentation system for extension-compatible UI components.
Storybook Upgrade (8.1.11 → 8.6.14)
superset-frontend/package.jsonpackages/superset-ui-demo/package.json@storybook/test-runnerto validate all stories compile and render without errorsStory Fixes
diffs, notcurrentFormDataAlertandTablefrom antd (not exported from components wrapper)CI Integration
test-storybookjob to GitHub Actions that builds Storybook and runs the test runnerExtension Component Documentation System
Added infrastructure for documenting components available to extension developers:
superset-core/src/ui/components/with a story is automatically documenteddocs/scripts/generate-extension-components.mjs) that:superset-corefor story files@docusaurus/theme-live-codeblockfor editable examples@apache-superset/coreresolves to superset-core componentsyarn startandyarn buildin docs/How to Add a New Extension Component
superset-frontend/packages/superset-core/src/ui/components/index.tsInteractiveexport:yarn startindocs/- the page generates automatically!Test plan
npm run build-storybook)npm run test-storybook)🤖 Generated with Claude Code