Skip to content

CLI: Remove Create React App support - #36168

Merged
valentinpalkovic merged 22 commits into
nextfrom
chore/remove-cra
Sep 9, 2026
Merged

valentinpalkovic merged 22 commits into
nextfrom
chore/remove-cra

Conversation

@obvious-autobuild

@obvious-autobuild obvious-autobuild Bot commented Sep 3, 2026 •

Copy link
Copy Markdown
Contributor

Closes #

What I did

Create React App is unmaintained (archived upstream) and pins a webpack setup that Storybook 11's build stack no longer supports, so this PR removes CRA support end to end: the @storybook/preset-create-react-app package, the init generator, the react-webpack preset glue, the autoblock entry, the sandbox templates, and the docs. storybook init now fails fast on CRA projects with an error linking the new MIGRATION.md section instead of falling through to a broken generic scaffold, and storybook upgrade blocks while react-scripts is installed. The telemetry mapping 'react-scripts': 'CRA' is intentionally kept.

Checklist for Contributors

Testing

The changes in this PR are covered in the following automated tests:

  • stories
  • unit tests
  • integration tests
  • end-to-end tests

Manual testing

Caution

This section is mandatory for all contributions. If you believe no manual test is necessary, please state so explicitly. Thanks!

  1. In a Create React App project (react-scripts 5), run yarn storybook init from this branch — it should stop with the CRA unsupported error linking MIGRATION.md#create-react-app-support-removed, and nothing should be scaffolded.
  2. In the same project, run yarn storybook upgrade — it should warn that CRA is no longer supported while react-scripts is installed.

Documentation

  • Add or update documentation reflecting your changes
  • If you are deprecating/removing a feature, make sure to update
    MIGRATION.MD

Checklist for Maintainers

  • When this PR is ready for testing, make sure to add ci:normal, ci:merged or ci:daily GH label to it to run a specific set of sandboxes. The particular set of sandboxes can be found in code/lib/cli-storybook/src/sandbox-templates.ts

  • Declare whether manual QA will be needed for this PR during the next release, through qa:needed or qa:skip

  • Make 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 - 🚫 Not run

This PR does not have a canary release associated.

In-repo PRs: add the ci:canary label. Later pushes republish while the label remains.

Fork PRs: the label does nothing (a later push must not auto-publish). A maintainer publishes from this repository with Run workflow and the pr input. branch and sha are optional; if more than one is set, they must be the same commit. The fork author does not need to do anything.

🔗 Obvious Project · 🧵 Obvious Thread

@obvious-autobuild obvious-autobuild Bot added maintenance User-facing maintenance tasks ci:normal Run our default set of CI jobs (choose this for most PRs). labels Sep 3, 2026
@obvious-autobuild obvious-autobuild Bot added the qa:skip Pull Requests that do not need any QA. (e.g. documentation) label Sep 3, 2026
@obvious-autobuild
obvious-autobuild Bot marked this pull request as ready for review September 3, 2026 19:42
@valentinpalkovic
valentinpalkovic force-pushed the release/raise-framework-floors-drop-cra-support-deprecate-storybooknextjs-20260903-190632 branch from 1dbb4fe to 1eed720 Compare September 3, 2026 22:01
Comment thread code/lib/cli-storybook/src/autoblock/block-create-react-app.ts
Comment thread MIGRATION.md Outdated
Comment thread MIGRATION.md Outdated
Comment thread code/lib/cli-storybook/src/autoblock/block-create-react-app.ts
@storybook-app-bot

storybook-app-bot Bot commented Sep 3, 2026 •

Copy link
Copy Markdown
Contributor

Package Benchmarks

Commit: 941f0a6, ran on 9 September 2026 at 06:39:09 UTC

The following packages have significant changes to their size or dependencies:

@storybook/react-webpack5

Before After Difference
Dependency count 268 267 🎉 -1 🎉
Self size 23 KB 23 KB 0 B
Dependency size 50.24 MB 50.21 MB 🎉 -29 KB 🎉
Bundle Size Analyzer Link Link

@storybook/preset-react-webpack

Before After Difference
Dependency count 157 153 🎉 -4 🎉
Self size 18 KB 14 KB 🎉 -3 KB 🎉
Dependency size 34.64 MB 34.37 MB 🎉 -264 KB 🎉
Bundle Size Analyzer Link Link

@obvious-autobuild
obvious-autobuild Bot changed the base branch from release/raise-framework-floors-drop-cra-support-deprecate-storybooknextjs-20260903-190632 to next September 4, 2026 14:52

@obvious-autobuild obvious-autobuild Bot left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Obvious Code Review

Verdict: COMMENT

Summary

  • Blocker: 0
  • High: 1
  • Medium: 1

First pass on this thread (woke on synchronize at head 810f0fbb; no prior review existed).

High

  • code/core/src/server-errors.ts:77 — Duplicate error code: the new CreateReactAppUnsupportedError takes CLI_INIT code 2, already held by MissingAngularJsonError. Both render as SB_CLI_INIT_0002 and share the same error-docs URL. Use code 18 (next free in the category).

Medium

  • code/lib/cli-storybook/src/autoblock/block-create-react-app.ts:7 — New load-bearing autoblocker has no test coverage (sibling blockers have dedicated test files).

Also verified clean: no dangling preset-create-react-app references, the removed .mjs/fullySpecified webpack rules are redundantly applied by builder-webpack5's own base config (non-CRA react-webpack5/nextjs users unaffected), the MIGRATION.md anchor chain is consistent end to end, and all fixture swaps preserve assertion intent.


View full review in Obvious

Comment thread code/core/src/server-errors.ts Outdated
Comment thread code/lib/cli-storybook/src/autoblock/block-create-react-app.ts
@obvious-autobuild

Copy link
Copy Markdown
Contributor Author

Replying to this comment

Both findings addressed in cbf2754 and answered in their inline threads: the duplicate CLI_INIT error code (High) — now code 18, verified as the next free code in the category — and the missing blocker coverage (Medium) — block-create-react-app.test.ts added following the sibling blocker test pattern, with a typed options builder instead of any-casts. One note for the record: extending the no-duplicated-error-codes lint override to server-errors.ts as suggested exposes a pre-existing CORE_SERVER code-1 duplicate unrelated to this PR, so that extension belongs with the fix for that existing duplicate.

@obvious-autobuild obvious-autobuild Bot left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Obvious Code Review

Verdict: COMMENT

No findings — clean pass.

Incremental pass at head cbf2754e (Pass 2). Both Pass 1 findings verified resolved:

  • code/core/src/server-errors.ts — CreateReactAppUnsupportedError now uses CLI_INIT code 18. Full category re-extraction on this head confirms codes 1–18 are unique, so it no longer collides with MissingAngularJsonError (SB_CLI_INIT_0018 vs SB_CLI_INIT_0002, separate docs URLs).
  • code/lib/cli-storybook/src/autoblock/block-create-react-app.test.ts — new dedicated test covers the blocker's installed/absent gate and asserts the migration log output including the exact create-react-app-support-removed anchor link.

View full review in Obvious

@obvious-autobuild obvious-autobuild Bot left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Obvious Code Review

Verdict: COMMENT

No findings — clean pass.

Incremental pass at head f6898636 (Pass 3). The single new commit fixes the CRA blocker test's typecheck: a boundary-scoped as unknown as JsPackageManager cast (replacing the blanket options cast the typecheck gate rejected) and mainConfig: { stories: [] } matching the sibling test pattern. Verified by running the test on the PR head: 3/3 passed with no type errors. No production code changed since Pass 2.


View full review in Obvious

@obvious-autobuild
obvious-autobuild Bot force-pushed the chore/remove-cra branch 2 times, most recently from 582cfb1 to 7a369bc Compare September 7, 2026 08:13
@valentinpalkovic valentinpalkovic mentioned this pull request Sep 7, 2026
3 of 9 tasks
@obvious-autobuild

Copy link
Copy Markdown
Contributor Author

Replying to this comment

Acknowledged — clean pass at cbf2754e (pass 2), confirmed before the rebase; both pass-1 fixes were verified in their inline threads.

@obvious-autobuild

Copy link
Copy Markdown
Contributor Author

Replying to this comment

Acknowledged — clean pass at f6898636 (pass 3). The branch has since been rebased onto the latest next (single MIGRATION.md conflict resolved, keeping both the CRA-removal and Next.js-deprecation entries); the affected unit suites and the six-package compile sweep were re-run green on the new head.

@obvious-autobuild
obvious-autobuild Bot force-pushed the chore/remove-cra branch 2 times, most recently from 1921336 to 5dac9ec Compare September 7, 2026 10:34
@valentinpalkovic

Copy link
Copy Markdown
Contributor

@ObviousApp Please keep the comment #36163 (comment) in mind for this PR as well!

Remove @storybook/preset-create-react-app end to end: the package itself,
its workspace dependency and lockfile entries, the react-webpack CRA glue
(cra-config, framework-preset-cra, the default preset-cra addon entry and
its package export), and the builder-webpack5 special case that skipped
default webpack config when the CRA preset was present.

CRA projects now get a dedicated init error instead of a scaffoldable
generator (follow-up commit); the telemetry react-scripts mapping stays.
CRA projects now stop at init with CreateReactAppUnsupportedError and a
MIGRATION.md anchor instead of scaffolding a broken generic setup. The
REACT_SCRIPTS generator is unregistered and CRA is no longer treated as
onboarding-compatible. Test fixtures referencing the removed
@storybook/preset-create-react-app package now use live addons.
valentinpalkovic and others added 5 commits September 7, 2026 16:43
…flags

Both the upgrade-time autoblock message and the init-time
CreateReactAppUnsupportedError now point users at rerunning
`storybook init` with explicit --type/--builder flags to scaffold a
webpack5- or vite-based setup instead.
…oblocker

CreateReactAppUnsupportedError shared CLI_INIT code 2 with
MissingAngularJsonError, so both rendered as SB_CLI_INIT_0002 and
linked to the same docs page. Assign code 18, the next free code in
the category.

Add block-create-react-app.test.ts so the dedicated CRA autoblocker
has direct coverage of its installed/absent gate and migration log
output, matching the sibling blocker test pattern.
The check-package gate rejects the options-literal assertion: the stub
lacks 40+ JsPackageManager members, so TS2352 forces an explicit unknown
hop, and StorybookConfig requires the stories field. Widen only the
packageManager boundary with a comment and pass a minimal valid
mainConfig instead.
…each builder selection

Per review guidance, a react-scripts project no longer fails init with
CreateReactAppUnsupportedError. The REACT_SCRIPTS project type is removed
from the enum, its detection rule is gone, and such projects fall through
to ProjectType.REACT as before the CRA support existed.

Projects with neither direct vite nor webpack deps (like Create React App)
now reach the standard builder-selection prompt (Vite / Webpack 5 /
Rsbuild); the fail-fast guard in FrameworkDetectionCommand and the
CreateReactAppUnsupportedError are removed with their dedicated tests.

The upgrade-time blocker for @storybook/preset-create-react-app remains in
place: the preset cannot be installed into an 11.x project.

Verified e2e against a react-scripts fixture (no direct vite/webpack
dependency): init presents the builder prompt, selecting Vite detects
react-vite and scaffolds a working .storybook config with the CRA app
left untouched.
Comment thread code/lib/cli-storybook/src/autoblock/block-create-react-app.ts Outdated
Comment thread code/lib/cli-storybook/src/sandbox-templates.ts Outdated
The applied suggestion put unescaped backticks inside the dedent template literal, terminating it early and failing the esbuild compile; escape them so the package name renders as inline code. Update the test assertion to the reworded guidance.
…registry

The registry only ever held the removed CRA template keys, so it stayed empty; a function-form mainConfig now throws unconditionally.
@obvious-autobuild

Copy link
Copy Markdown
Contributor Author

Replying to this comment

Done — the guidance from that comment is applied on this PR: ProjectType.REACT_SCRIPTS, its detection rule, the init fail-fast guard, and CreateReactAppUnsupportedError are removed entirely. A react-scripts project with no direct vite/webpack dependency now falls through to the standard Vite/Webpack 5/Rsbuild builder prompt, verified end-to-end on a real react-scripts fixture (Vite selection detects @storybook/react-vite and the scaffold completes untouched). Your two follow-up review comments from Sep 8 are also addressed: the backtick escape fix (e5d56b5) and the empty UNREADABLE_MAIN_CONFIG_TEMPLATES registry removal (b6a9f13).

Comment thread code/core/src/common/presets.test.ts Outdated
Per review: @storybook/addon-jest no longer exists; use @storybook/addon-a11y (7.0.0 -> 8.0.0) so the fixture exercises the incompatible-dependencies upgrade path with a real package.
Per review: the file referenced removed packages (preset-scss, preset-typescript, addon-knobs, addon-notes); swap for real ones (preset-react-webpack, preset-server-webpack, addon-themes/manager, addon-a11y/preview, addon-links/manager) preserving each fixture's resolution behavior.
Comment thread code/lib/cli-storybook/src/autoblock/block-create-react-app.test.ts Outdated
@valentinpalkovic

Copy link
Copy Markdown
Contributor

@ObviousApp Verify the change by running init on a fresh Create React App project and running the upgrade procedure on an existing CRA open-source repository that uses Storybook.

@obvious-autobuild

Copy link
Copy Markdown
Contributor Author

Replying to this comment

Done — verified against a fresh CRA project using the compiled create-storybook from this branch:

• Fresh fixture: pristine create-react-app-style project (react 18.3.1, react-dom, react-scripts 5.0.1; 1,292 packages installed; no Storybook or direct vite/webpack dependencies).
• Builder prompt: with no direct Vite/Webpack dependency detected, init shows the standard builder selection (Vite / Webpack 5 / Rsbuild) — confirmed on three separate interactive runs against the compiled head build; the CRA classification and fail-fast error are gone.
• Full flow via --builder vite (the flag the prompt feeds into the same detection path): .storybook/main.js + preview.jsx generated with "framework": "@storybook/react-vite"; storybook + @storybook/react-vite + addon deps added; stories generated under src/stories.
• CRA app intact: the original start/build react-scripts scripts and src/ / public/ files are untouched.

Separately: the only CI failure on your applied head 055ec16 is the angular-cli-latest--webpack---typescript---dev sandbox (build 2029035) — the same environmental a11y-sandbox flake family documented earlier on 7a369bc; your head diff is 3 deleted comment lines in a CLI test file, so it cannot be related to this change.

Comment thread code/presets/react-webpack/package.json Outdated
Comment thread docs/get-started/setup.mdx
Comment thread docs/get-started/frameworks/react-webpack5.mdx Outdated
Comment thread code/lib/cli-storybook/src/autoblock/block-create-react-app.ts Outdated
- Soften the autoblock message: CRA projects where Storybook is set up
  separately are unaffected; Storybook 11+ no longer automatically
  inherits CRA's configurations.
- Remove the orphaned semver dependency (and its unused @types peer)
  from @storybook/preset-react-webpack now that cra-config.ts is gone.
- Replace the preset-create-react-app example in the preset-addon docs
  with @storybook/preset-react-webpack.
- Drop the CRA parenthetical from the react-webpack5 manual-init note.
@valentinpalkovic
valentinpalkovic merged commit 013b376 into next Sep 9, 2026
163 of 166 checks passed
@valentinpalkovic
valentinpalkovic deleted the chore/remove-cra branch September 9, 2026 07:18
@github-actions github-actions Bot mentioned this pull request Sep 9, 2026
2 tasks done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ci:normal Run our default set of CI jobs (choose this for most PRs). maintenance User-facing maintenance tasks qa:skip Pull Requests that do not need any QA. (e.g. documentation)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants