CLI: Fix react native template not copying in init#33308
Conversation
|
View your CI Pipeline Execution ↗ for commit 50ee2cc ☁️ Nx Cloud last updated this comment at |
📝 WalkthroughWalkthroughAdds a new mapping entry to the Changes
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~2 minutes Possibly related issues
✨ Finishing touches
Comment |
There was a problem hiding this comment.
Actionable comments posted: 0
🧹 Nitpick comments (1)
code/core/src/common/utils/get-storybook-info.ts (1)
22-37: React Native renderer mapping is correct and consistentThe new
'@storybook/react-native': SupportedRenderer.REACT_NATIVEentry matches the existing renderer mapping pattern and should unblock reverse lookups for the React Native renderer (e.g., for template copying). No issues from a typing or style perspective.As a follow‑up, consider adding a small unit/integration test that exercises
getStorybookInfofor a React Native setup to ensurerendererPackageresolves to@storybook/react-nativeand to prevent regressions in thecreate-storybookRN flow.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
code/core/src/common/utils/get-storybook-info.ts(1 hunks)
🧰 Additional context used
📓 Path-based instructions (5)
**/*.{js,jsx,json,html,ts,tsx,mjs}
📄 CodeRabbit inference engine (.github/copilot-instructions.md)
Use ESLint and Prettier configurations that are enforced in the codebase
Files:
code/core/src/common/utils/get-storybook-info.ts
**/*.{ts,tsx}
📄 CodeRabbit inference engine (.github/copilot-instructions.md)
Enable TypeScript strict mode
Files:
code/core/src/common/utils/get-storybook-info.ts
code/**/*.{ts,tsx,js,jsx,mjs}
📄 CodeRabbit inference engine (.github/copilot-instructions.md)
code/**/*.{ts,tsx,js,jsx,mjs}: Use server-side logger from 'storybook/internal/node-logger' for Node.js code
Use client-side logger from 'storybook/internal/client-logger' for browser code
Do not use console.log, console.warn, or console.error directly unless in isolated files where importing loggers would significantly increase bundle size
Files:
code/core/src/common/utils/get-storybook-info.ts
code/**/*.{ts,tsx,js,jsx}
📄 CodeRabbit inference engine (.github/copilot-instructions.md)
Export functions that need to be tested from their modules
Files:
code/core/src/common/utils/get-storybook-info.ts
code/**/*.{js,jsx,json,html,ts,tsx,mjs}
📄 CodeRabbit inference engine (.github/copilot-instructions.md)
code/**/*.{js,jsx,json,html,ts,tsx,mjs}: Run Prettier with --write flag to format code before committing
Run ESLint with yarn lint:js:cmd to check for linting issues and fix errors before committing
Files:
code/core/src/common/utils/get-storybook-info.ts
🧠 Learnings (1)
📚 Learning: 2025-11-05T09:38:47.712Z
Learnt from: Sidnioulz
Repo: storybookjs/storybook PR: 32458
File: code/core/src/components/components/Select/Select.tsx:200-204
Timestamp: 2025-11-05T09:38:47.712Z
Learning: Repo: storybookjs/storybook — Guidance: Until Storybook 11 is released, do not suggest using React.useId anywhere (e.g., in code/core/src/components/components/Select/Select.tsx) to maintain compatibility with React 17 runtimes. Prefer advising: accept a caller-provided props.id and, if needed, generate a client-only fallback id to minimize SSR hydration issues — but avoid useId. Resume prompting for useId after Storybook 11.
Applied to files:
code/core/src/common/utils/get-storybook-info.ts
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
- GitHub Check: normal
- GitHub Check: Core Unit Tests, windows-latest
Package BenchmarksCommit: The following packages have significant changes to their size or dependencies:
|
| Before | After | Difference | |
|---|---|---|---|
| Dependency count | 191 | 191 | 0 |
| Self size | 75 KB | 75 KB | 🚨 +48 B 🚨 |
| Dependency size | 32.21 MB | 32.18 MB | 🎉 -23 KB 🎉 |
| Bundle Size Analyzer | Link | Link |
@storybook/angular
| Before | After | Difference | |
|---|---|---|---|
| Dependency count | 191 | 191 | 0 |
| Self size | 118 KB | 118 KB | 🎉 -48 B 🎉 |
| Dependency size | 30.33 MB | 30.30 MB | 🎉 -23 KB 🎉 |
| Bundle Size Analyzer | Link | Link |
@storybook/ember
| Before | After | Difference | |
|---|---|---|---|
| Dependency count | 195 | 195 | 0 |
| Self size | 15 KB | 15 KB | 0 B |
| Dependency size | 28.93 MB | 28.91 MB | 🎉 -23 KB 🎉 |
| Bundle Size Analyzer | Link | Link |
@storybook/nextjs
| Before | After | Difference | |
|---|---|---|---|
| Dependency count | 537 | 537 | 0 |
| Self size | 645 KB | 645 KB | 🎉 -120 B 🎉 |
| Dependency size | 59.14 MB | 59.12 MB | 🎉 -23 KB 🎉 |
| Bundle Size Analyzer | Link | Link |
@storybook/nextjs-vite
| Before | After | Difference | |
|---|---|---|---|
| Dependency count | 128 | 128 | 0 |
| Self size | 1.12 MB | 1.12 MB | 0 B |
| Dependency size | 21.98 MB | 21.96 MB | 🎉 -23 KB 🎉 |
| Bundle Size Analyzer | Link | Link |
@storybook/react-native-web-vite
| Before | After | Difference | |
|---|---|---|---|
| Dependency count | 160 | 160 | 0 |
| Self size | 30 KB | 30 KB | 🚨 +18 B 🚨 |
| Dependency size | 23.16 MB | 23.14 MB | 🎉 -23 KB 🎉 |
| Bundle Size Analyzer | Link | Link |
@storybook/react-vite
| Before | After | Difference | |
|---|---|---|---|
| Dependency count | 118 | 118 | 0 |
| Self size | 35 KB | 35 KB | 🚨 +18 B 🚨 |
| Dependency size | 19.78 MB | 19.75 MB | 🎉 -24 KB 🎉 |
| Bundle Size Analyzer | Link | Link |
@storybook/react-webpack5
| Before | After | Difference | |
|---|---|---|---|
| Dependency count | 277 | 277 | 0 |
| Self size | 24 KB | 24 KB | 🚨 +12 B 🚨 |
| Dependency size | 44.09 MB | 44.07 MB | 🎉 -23 KB 🎉 |
| Bundle Size Analyzer | Link | Link |
@storybook/server-webpack5
| Before | After | Difference | |
|---|---|---|---|
| Dependency count | 203 | 203 | 0 |
| Self size | 16 KB | 16 KB | 0 B |
| Dependency size | 33.46 MB | 33.44 MB | 🎉 -23 KB 🎉 |
| Bundle Size Analyzer | Link | Link |
@storybook/cli
| Before | After | Difference | |
|---|---|---|---|
| Dependency count | 173 | 173 | 0 |
| Self size | 774 KB | 774 KB | 0 B |
| Dependency size | 67.62 MB | 67.60 MB | 🎉 -23 KB 🎉 |
| Bundle Size Analyzer | Link | Link |
@storybook/codemod
| Before | After | Difference | |
|---|---|---|---|
| Dependency count | 166 | 166 | 0 |
| Self size | 30 KB | 30 KB | 0 B |
| Dependency size | 66.19 MB | 66.17 MB | 🎉 -23 KB 🎉 |
| Bundle Size Analyzer | Link | Link |
@storybook/preset-react-webpack
| Before | After | Difference | |
|---|---|---|---|
| Dependency count | 170 | 170 | 0 |
| Self size | 18 KB | 18 KB | 🎉 -24 B 🎉 |
| Dependency size | 31.33 MB | 31.31 MB | 🎉 -23 KB 🎉 |
| Bundle Size Analyzer | Link | Link |
@storybook/react
| Before | After | Difference | |
|---|---|---|---|
| Dependency count | 57 | 57 | 0 |
| Self size | 716 KB | 716 KB | 0 B |
| Dependency size | 12.93 MB | 12.90 MB | 🎉 -23 KB 🎉 |
| Bundle Size Analyzer | Link | Link |
…ate-not-copied CLI: Fix react native template not copying in init (cherry picked from commit 91d158e)
fixes: #33307
What I did
Added
@storybook/react-nativeto therendererPackagesmapping inget-storybook-info.ts.The React Native template files were not being copied during
create-storybookinitialization because@storybook/react-nativewas missing from therendererPackagesmap. This causedgetRendererDir()to returnnullwhen looking up thereact-nativerenderer, which meantcopyTemplateFiles()silently skipped copying the template files.Checklist for Contributors
Testing
The changes in this PR are covered in the following automated tests:
Manual testing
npx storybook@next init.rnstorybookfolder is created with template filesDocumentation
MIGRATION.MD
Checklist for Maintainers
When this PR is ready for testing, make sure to add
ci:normal,ci:mergedorci:dailyGH label to it to run a specific set of sandboxes. The particular set of sandboxes can be found incode/lib/cli-storybook/src/sandbox-templates.tsMake 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/coreteam 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
✏️ Tip: You can customize this high-level summary in your review settings.