Repository navigation
feat(demo): publish Storybook alongside the demo site - #26
Merged
Merged
Conversation
The stories are the only place the measurement behaviour can be seen in a real browser, and nothing published them: Netlify builds the docs app and GitHub Pages deploys the same output, so the repros added for #21 and #23 existed only on a developer's machine. Deploy previews could show that the demo still worked but never the bug a change was about. Storybook now builds into demo/public/storybook, so it rides along in whatever the host serves — verified end to end by serving the built .output/public and loading a story from it. The demo's prebuild runs it, so the two cannot fall out of step, and the header links to it. Two things this needed: Storybook gets its own Vite config. It otherwise loads demo/vite.config.ts, whose tanstack-start and nitro plugins take over the build: `storybook build` emitted the demo app into .output/public, produced no story preview at all, and still exited 0. .storybook/vite.config.ts carries only what the stories need — React, Tailwind, the `@` alias, and the react-dom dedupe that keeps the library's flushSync working. The base has to match where the site is served from, since the assets are requested from `<demo base>/storybook/`. Netlify serves from the root and GitHub Pages from the repository name, so it is derived from GITHUB_PAGES exactly as the demo derives its own. CI builds Storybook and asserts the preview and the story index exist, because the silent-success failure above is otherwise invisible until someone opens the page. Stacked on the tests branch to avoid a conflict in the demo's prebuild. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Review or Edit in CodeSandboxOpen the branch in Web Editor • VS Code • Insiders |
✅ Deploy Preview for react-responsive-overflow-list ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (6)
📝 WalkthroughWalkthroughThe demo now builds Storybook into ChangesStorybook hosting integration
Estimated code review effort: 3 (Moderate) | ~20 minutes Sequence Diagram(s)sequenceDiagram
participant CI
participant DemoScripts as demo/package.json
participant Storybook
participant StorybookOutput as public/storybook
CI->>DemoScripts: run pnpm build:storybook
DemoScripts->>Storybook: build static Storybook
Storybook->>StorybookOutput: write iframe.html and index.json
CI->>StorybookOutput: validate generated files and story entries
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Publishes Storybook as
/storybookon the demo site, so deploy previews can show the stories.Why
The stories are the only place the measurement behaviour is visible in a real browser, and nothing published them. Netlify builds the docs app; GitHub Pages deploys the same output. So the repros added for #21 and #23 existed only on a developer's machine — a deploy preview could show that the demo still worked, but never the bug the change was about.
Two problems this had to solve
1. Storybook was building the wrong thing, silently.
storybook buildloads the project'svite.config.tsby default. The demo's hastanstackStart()andnitro(), which took over the build: Storybook emitted the demo app into.output/public, produced no story preview at all (noiframe.html, noassets/), and exited 0.Fixed by giving Storybook its own config at
.storybook/vite.config.ts, carrying only what the stories need — React, Tailwind, the@alias, and thereact-domdedupe that keeps the library'sflushSyncfrom becoming a silent no-op.publicDir: falsethere, since the output now lands inside the public directory.2. The output had to land somewhere the host actually serves.
viteStaticCopywrites todemo/dist, which nitro does not serve — that path was a dead end.demo/public/*is what ends up in.output/public(which is howvite.svggets there), so Storybook builds straight intodemo/public/storybook.The base also has to match where the site is served from, since assets are requested from
<demo base>/storybook/. Netlify serves from the root, GitHub Pages from the repository name, somain.tsderives it fromGITHUB_PAGESexactly asdemo/vite.config.tsderives its own.Verified end to end
Not just that files exist — that it serves and renders:
Then loaded
Issues/Issue21 › FixedHeightIndicatorWrapsfrom the served build and stepped it: stage 1 →Overview / Assets / Issues / More (2), stage 6 →Overview99+ / Assets99+ / More (3),measured rows: 1throughout. So the published bundle carries working stories, not just a shell. 9 stories indexed.CI
Builds Storybook and asserts
iframe.html,index.json, and a non-zero story count. That silent-success failure mode is otherwise invisible until someone opens the page, and it is exactly what happened here during development.Also
The demo's
prebuildruns the Storybook build, so the two cannot fall out of step, and the header links to/storybook.demo/public/storybook/is gitignored.🤖 Generated with Claude Code
Summary by CodeRabbit
/storybook/path.