Code
Upgrade a dependency
Move across a major version and fix the breaks it causes.
Fill it in
What to upgrade.
Current and target version.
Use the maintainers' migration scripts where they exist.
Your prompt
Upgrade [your package] ([your from and to]). Read the changelog and the migration guide first, and list the breaking changes that actually apply to this codebase. Most of a major release's breaking changes are irrelevant to any given project, and knowing which handful matter turns a scary upgrade into a small one. Run the maintainers' codemods where they exist. They are written by the people who made the breaking change and they handle cases nobody else would think of. Review the diff afterwards: a codemod is a good first pass and a poor last one. Then fix what is left by hand, run the full suite, and start the app. A type check is not evidence the thing runs. Deliver with a short note on what broke and what you did about it, so the next person upgrading something else knows where this project's edges are.
Use Upgrade a dependencyOpens with everything above already filled in.
Why this works
Reading the migration guide first sounds obvious and is the step that gets skipped. Most of a major release's breaking changes do not apply to any given project, so listing the handful that do turns a frightening upgrade into a small one. Running the maintainers' codemods matters for the same reason: they were written by the people who made the change and cover cases nobody else would think of. Reviewing their output matters because a codemod is a good first pass and a poor last one.
Questions
- Will it just bump the version and hope?
- No. It reads the changelog, applies the migration, runs the suite, and starts the app, because a type check is not evidence the thing runs.