Skip to content

Conversation

@iamdarshshah
Copy link
Collaborator

@iamdarshshah iamdarshshah commented Dec 22, 2025

🚀 React 17 Migration + Storybook v7 (v7.0.0-beta.0)

This PR modernizes the library to support React 17 as the minimum version, upgrades Storybook from v5 to v7, and updates the entire toolchain to current standards.

What Changed

React & Dependencies

  • Bumped peerDependencies to React 17.0.0+
  • Updated devDependencies to React 17.0.2
  • Switched to the new JSX transform ("jsx": "react-jsx") — no more import React needed in every file

Storybook v5 → v7

  • Removed deprecated Storybook v5 config files (addons.js, config.js, webpack.config.js)
  • Added new Storybook v7 config files (main.ts, preview.ts)
  • Updated scripts: start-storybookstorybook dev, build-storybookstorybook build
  • Migrated stories from storiesOf API to CSF3 (Component Story Format 3)
  • Added Babel presets (@babel/preset-env, @babel/preset-react, @babel/preset-typescript)

Testing & Tooling

  • Upgraded Jest from v24 → v29
  • Updated @testing-library/react to v12.1.5 (last version supporting React 17)
  • Modernized Husky to v9 (new .husky/ directory setup)
  • Pinned lint-staged to v15 for Node 18 compatibility

CI/CD & Node.js

  • Updated GitHub Actions to test on Node 18.x, 20.x, and 22.x
  • Dropped Node 16 support (EOL since September 2023)
  • Added engines.node: ">=18.18.0" to enforce minimum version

Why This Matters

React 16 and Storybook v5 have reached end-of-life, and the ecosystem has moved on. By setting React 17 as our baseline and upgrading to Storybook v7:

  • We can use modern React patterns and the new JSX transform
  • Our dependencies stay compatible with actively maintained versions
  • Users on React 18+ are fully supported (React 17 APIs are forward-compatible)
  • Component documentation uses the modern CSF3 story format
  • Storybook benefits from improved performance and new features

Breaking Changes

Before (v6) After (v7)
React 16+ React 17+
Node 12+ Node 18.18.0+
Storybook v5 Storybook v7

Migration Guide

If you're on React 16, you'll need to upgrade to React 17 or later before using v7 of this library:

npm install react@17 react-dom@17
# or
yarn add react@17 react-dom@17

@codecov
Copy link

codecov bot commented Dec 22, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 79.33%. Comparing base (b48b0ae) to head (4039656).
⚠️ Report is 5 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #415      +/-   ##
==========================================
+ Coverage   75.46%   79.33%   +3.87%     
==========================================
  Files           2        2              
  Lines         163      150      -13     
  Branches       61       56       -5     
==========================================
- Hits          123      119       -4     
- Misses         16       24       +8     
+ Partials       24        7      -17     
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@iamdarshshah iamdarshshah changed the title chore: upgrade to React 17+ with v7.0.0 release chore: upgrade to React 17 with v7.0.0 release Dec 22, 2025
@iamdarshshah iamdarshshah force-pushed the feat/upgrade-to-v7 branch 2 times, most recently from ef62655 to 17cc499 Compare December 22, 2025 21:42
- Remove deprecated Storybook v5 config files (addons.js, config.js, webpack.config.js)
- Add new Storybook v7 config files (main.ts, preview.ts)
- Update package.json scripts to use new Storybook CLI commands
- Convert stories from storiesOf API to CSF3 format
- Add babel.config.js with TypeScript, React, and env presets
- Remove render() calls from story components that were causing DOM errors
- Add @babel/preset-env, @babel/preset-react, @babel/preset-typescript
- Check if release is marked as prerelease
- Use --tag beta for prereleases to avoid overwriting latest tag
@iamdarshshah iamdarshshah changed the title chore: upgrade to React 17 with v7.0.0 release chore: upgrade to React 17 with v7.0.0-beta.0 release Dec 27, 2025
@iamdarshshah iamdarshshah merged commit 5f134f5 into ankeetmaini:master Dec 27, 2025
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant