Drop storybook 9.1.x from addon-mcp peer dependency ranges - #378
Drop storybook 9.1.x from addon-mcp peer dependency ranges#378Mohith26 wants to merge 2 commits into
Conversation
The preset imports importModule from storybook/internal/common, which does not exist on the 9.1.x line, so any install admitted by the ^9.1.16 floor fails during preset loading with 'Unexpected module status 0'. Raise the floor to ^10.0.0, the first line providing the exports the preset needs, keeping ^0.0.0-0 for storybook canaries. Fixes storybookjs#376
Assert the published storybook peer range rejects the 9.1.x line the preset cannot load on, still admits 10.0.0 through 10.5.x and storybook canaries, and stays in lockstep with the @storybook/addon-vitest range. Also probe that the storybook/internal/common exports the preset imports (importModule, normalizeStoryPath) exist in the installed storybook, anchoring the range floor to real load-path behavior.
🦋 Changeset detectedLatest commit: a182068 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
✅ Deploy Preview for storybook-mcp-self-host-example canceled.
|
📝 WalkthroughWalkthroughThe addon-mcp peer ranges now exclude Storybook 9.1.x and support Storybook 10 releases and canaries. New tests validate the semver ranges, synchronization with ChangesStorybook peer compatibility
Estimated code review effort: 2 (Simple) | ~10 minutes 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. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (1)
packages/addon-mcp/src/peer-dependencies.test.ts (1)
12-12: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winUse the prescribed constant casing.
Rename
storybookRangetoSTORYBOOK_RANGEand update its references. As per coding guidelines, useSCREAMING_SNAKE_CASEfor constants.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@packages/addon-mcp/src/peer-dependencies.test.ts` at line 12, Rename the constant storybookRange to STORYBOOK_RANGE in the peer-dependency test and update every reference to use the prescribed SCREAMING_SNAKE_CASE naming.Source: Coding guidelines
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@packages/addon-mcp/src/peer-dependencies.test.ts`:
- Around line 8-10: Add semver as a direct development dependency in
packages/addon-mcp/package.json so the createRequire call in
peer-dependencies.test.ts resolves after a clean install. Keep the existing test
behavior unchanged.
---
Nitpick comments:
In `@packages/addon-mcp/src/peer-dependencies.test.ts`:
- Line 12: Rename the constant storybookRange to STORYBOOK_RANGE in the
peer-dependency test and update every reference to use the prescribed
SCREAMING_SNAKE_CASE naming.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro Plus
Run ID: 1b5c51b2-6fe7-4cdf-9da4-746009c3d6ee
📒 Files selected for processing (3)
.changeset/drop-storybook-9-peer-range.mdpackages/addon-mcp/package.jsonpackages/addon-mcp/src/peer-dependencies.test.ts
| const { satisfies } = createRequire(import.meta.url)('semver') as { | ||
| satisfies: (version: string, range: string) => boolean; | ||
| }; |
There was a problem hiding this comment.
🩺 Stability & Availability | 🟠 Major | ⚡ Quick win
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
set -euo pipefail
rg -n '"semver"\s*:' packages/addon-mcp/package.json || true
pnpm --filter `@storybook/addon-mcp` exec node -e "console.log(require.resolve('semver'))"Repository: storybookjs/mcp
Length of output: 546
🏁 Script executed:
#!/bin/bash
set -euo pipefail
echo "== package manifest dependencies =="
cat -n packages/addon-mcp/package.json | sed -n '1,220p' || true
echo
echo "== test file context =="
cat -n packages/addon-mcp/src/peer-dependencies.test.ts | sed -n '1,120p' || true
echo
echo "== semver references in packages/addon-mcp =="
rg -n --glob '!*node_modules*' 'semver|peer-dependencies' packages/addon-mcp || trueRepository: storybookjs/mcp
Length of output: 5522
Declare semver as a direct test dependency.
packages/addon-mcp/src/peer-dependencies.test.ts loads semver via createRequire(import.meta.url)('semver'), but packages/addon-mcp/package.json only declares storybook as a dev peer. semver is present through the lockfile dependency graph, yet a consumer’s clean install of the addon package will not include it, so this test can fail before running. Add semver as a direct dev dependency or replace it with a dependency owned by this package.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@packages/addon-mcp/src/peer-dependencies.test.ts` around lines 8 - 10, Add
semver as a direct development dependency in packages/addon-mcp/package.json so
the createRequire call in peer-dependencies.test.ts resolves after a clean
install. Keep the existing test behavior unchanged.
Fixes #376, reported by @rachelslurs.
The published peer ranges admit storybook 9.1.x, but the preset imports
importModulefromstorybook/internal/common, which only exists from 10.0.0, so 9.1.x installs crash during preset loading. This takes the issue's low-risk remedy: raise the floor to^10.0.0on both lockstep ranges (storybook,@storybook/addon-vitest), keeping the^0.0.0-0canary allowance. Patch changeset included.One open product question flagged rather than decided here: the reporter's follow-up shows the manifest-emitting range is effectively 10.3.x+, but the addon degrades gracefully without manifests, so a harder
^10.3.0floor (or a load-time version check with an explicit error) is an alternative if you would rather fail loudly.Five regression tests anchor the range to the real missing-export behavior (probing
importModuleon the installed storybook rather than asserting constants), reject 9.1.16/9.1.20, admit 10.0.0-10.5.3 + canaries, and keep the two ranges lockstep. Suite: 369 passed, zero new failures; oxlint/oxfmt/tsc clean.Summary by CodeRabbit
Compatibility
Bug Fixes