[BpkButton,BpkBadge,BpkCard] Colocate stories with components and convert to CSF3#4331
Conversation
There was a problem hiding this comment.
Pull request overview
Pilot migration to colocate Storybook stories alongside component source (Button, Badge, Card) and convert them to CSF3, while ensuring these story assets don’t ship in published packages.
Changes:
- Moved Button/Badge/Card stories into
packages/*/src/*.stories.tsxand converted from CSF2 → CSF3 (satisfies Meta+StoryObj). - Added/updated build + publish safeguards to exclude story files/styles from transpilation, packaging, and production SCSS compilation.
- Updated Storybook config to discover both legacy
examples/stories and new colocated stories during the incremental migration.
Reviewed changes
Copilot reviewed 13 out of 13 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
scripts/scss/styles-prod.js |
Skips compiling .stories. SCSS files in production styles build. |
packages/bpk-component-card/src/BpkCard.stories.tsx |
New colocated CSF3 stories for Card. |
packages/bpk-component-card/src/BpkCard.stories.module.scss |
Story-only SCSS module for Card stories. |
packages/bpk-component-button/src/BpkButton.stories.tsx |
New colocated CSF3 stories for Button. |
packages/bpk-component-button/src/BpkButton.stories.module.scss |
Story-only SCSS module for Button stories. |
packages/bpk-component-badge/src/BpkBadge.stories.tsx |
New colocated CSF3 stories for Badge. |
packages/bpk-component-badge/src/BpkBadge.stories.module.scss |
Story-only SCSS module for Badge stories. |
packages/.npmignore |
Ensures story/test files (and story style modules) are excluded from published packages. |
examples/bpk-component-card/stories.js |
Removes legacy examples-based Card story entrypoint. |
examples/bpk-component-button/stories.tsx |
Removes legacy examples-based Button story entrypoint. |
examples/bpk-component-badge/stories.tsx |
Removes legacy examples-based Badge story entrypoint. |
babel.config.js |
Prevents .stories files from being transpiled as part of distribution build. |
.storybook/main.ts |
Adds a new glob to discover colocated package stories alongside existing examples. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
Visit https://backpack.github.io/storybook-prs/4331 to see this build running in a browser. |
1 similar comment
|
Visit https://backpack.github.io/storybook-prs/4331 to see this build running in a browser. |
…vert to CSF3 Migrate stories from examples/ to packages/*/src/ for Button, Badge, and Card as a pilot for full story colocation. Convert from CSF2 to CSF3 format. Add build safeguards (babel ignore, .npmignore, SCSS skip) to prevent stories from shipping in the npm package. Update storybook config with dual-glob discovery to support incremental migration. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…ed components Clean up the remaining examples/ files (examples.tsx, SCSS, CSS) for the three components whose stories were colocated in the previous commit. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Remove Story type annotations from render-only stories to avoid TS errors where StoryObj requires args for required component props. Remove unused StoryObj imports. Add @ts-ignore for untyped bpk-storybook-utils module. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
4121684 to
f344935
Compare
- Fix swapped DockedRight/DockedLeft story names in badge stories - Use https:// instead of http:// in card story href - Remove legacy defaultProps pattern from ButtonStory, use default parameter Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
Visit https://backpack.github.io/storybook-prs/4331 to see this build running in a browser. |
| SIZE_TYPES, | ||
| } from '../../packages/bpk-component-button'; | ||
|
|
||
| // @ts-ignore Untyped import. See `decisions/imports-ts-suppressions.md`. |
There was a problem hiding this comment.
ts-ignore should be ts-expect-error — decisions/imports-ts-suppressions.md explicitly mandates ts-expect-error for untyped imports inside Backpack. ts-ignore silently suppresses errors indefinitely
Per decisions/imports-ts-suppressions.md, use @ts-expect-error for untyped imports so suppressions fail loudly if the underlying issue is fixed. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
Visit https://backpack.github.io/storybook-prs/4331 to see this build running in a browser. |
Summary
Pilot migration to colocate Storybook stories with component source files, preparing for NX monorepo migration. Migrates Button, Badge, and Card as proof of concept.
Changes:
examples/intopackages/*/src/*.stories.tsxfor 3 pilot componentssatisfies Meta+StoryObj)examples.tsx+stories.tsx) into single colocated story filesbabel.config.js: Added.storiesto the ignore listpackages/.npmignore: Added*.stories.*and*.test.*patternsscripts/scss/styles-prod.js: Skip.stories.SCSS files during compilation.storybook/main.tswith dual-glob discovery to support incremental migrationValidated:
npm pack --dry-runconfirms zero story files in published outputRemember to include the following changes:
[Clover-123][BpkButton] Updating the colourREADME.md(If you have created a new component)README.md