Big migrations without breaking everything: a step-by-step guide
Hi everybody! ๐
Back again, this time with a topic that every developer faces sooner or later: the big migration.
If you've done one before, you know the drill: a new major version comes out, you bump the version number, run npm install and... pray. And if you're about to face your first one, this post is for you too: it's the guide I wish I had.
This year, my team and I went through a few Expo SDK upgrades. The first one, from SDK 52 to 54, was painful. The ones after it got much easier, because we turned that experience into a repeatable process.
In this post, I'll walk you through that process. While my examples come from mobile development, the same principles apply to web applications, whether you're upgrading React, Next.js or another framework.
TL;DR
- Before anything, add a release cooldown to reduce the risk of installing a compromised npm package.
- Take inventory of what moves together, the tooling around it, your toolchain, and every patch and pinned version (and why it exists).
- Plan before you touch anything: read the changelogs, map the impact, plan your rollback, make a Go / Conditional / Pause call, and share the plan with your team.
- Migrate and test in small steps. Ship the prep work first, and test after every step. The more you migrate, the more you test.
- Launch gradually and watch your error alerts.
- Document what you learned and turn the flow into an AI skill, so every migration makes the next one easier.
Before you start: set up a guardrail
The guardrail is a minimum release age. It isn't a migration step: you set it up once (ideally from the very beginning of your project), and it protects every install from then on, migration or not.
Supply-chain attacks on npm are real: sometimes a popular package gets a new version with malicious code. A compromised package can go unnoticed for hours, days or even longer. A release cooldown gives the community more time to discover and report suspicious releases before they reach your project.
A basic but good default can look like this:
# .npmrc
# Don't install package versions published less than 7 days ago
min-release-age=7
# Trusted core packages can skip the wait, so urgent fixes land right away
min-release-age-exclude[]=expo1. Take inventory before you touch anything
The worst migrations start with npm install. The best ones start with a list. Before changing a single line, go through these six things:
What has to move with it
A framework upgrade usually drags other packages along. For an Expo SDK, that could mean:
- the React and React Native versions,
- the TypeScript version (and the types that come with it),
- the test runner and its preset (Jest and
jest-expo), - the navigation library,
- animation and gesture libraries like Reanimated,
- and every native module that has to match the new React Native version.
What's native or platform-specific
On mobile, native modules are where most surprises live. For web apps, think of things like moving from one bundler to another (Webpack to Vite or Turbopack), a new major version of your CSS tooling (like Tailwind), or changes in how server rendering works.
The tooling around it
Not just the app: dev tools, Storybook, linters, CI and build scripts all depend on the same packages.
Your toolchain
New versions can also raise the minimum versions of the tools you build with: Xcode, Android Studio, Node, or the images your CI uses. Check them on your machine and in CI before you start.
Your workarounds
Patched libraries (with something like patch-package) and pinned versions (overrides or resolutions) are easy to add and easy to forget. Check whether this migration also needs to bump any of those libraries.
If it does, remember that upgrading a dependency doesn't automatically make its patches obsolete. Review whether the original issue has been fixed upstream, whether the patch is still necessary, or whether it needs to be rewritten.
How big each bump is
Finally, classify every bump (patch, minor or major release), so you know where to spend your time: a patch release usually needs a quick check, while a major one needs a full plan.
2. Plan first, change later
Writing a plan may take a few hours. Debugging a "big bang" upgrade where 20 packages changed at once takes days.
Before installing anything:
- Set your appetite. Rather than starting with an estimate, decide how much time your team is willing to invest in the migration. Is it worth one week? Two? Use that constraint to shape the scope of the upgrade. The goal isn't a perfect upgrade. It's the best upgrade that fits that time.
- Read the official changelog and migration guide for every major bump (for example, Expo's upgrade walkthrough). AI can help summarize them, but don't skip reading the changes yourself, so you understand their impact.
- Map the impact on your code. Search for the APIs that changed. How many files use them?
- List the risks. Peer dependencies that don't match, one of your patches that no longer applies, a known bug or an open security advisory in the new version...
- Plan your rollback. Before starting the migration, make sure you know how to return to a stable version if something goes wrong. Consider dependency changes, native builds, data migrations and compatibility with previous app versions. A rollback shouldn't be something you figure out in the middle of an incident.
- Make a call, knowing it's rarely black and white:
- Go: You upgrade it now. Ideally the impact is small, but in reality it can still take a significant amount of work.
- Conditional: OK, but only if some extra work is done first (bump a peer, rewrite a patch, test something on a real device).
- Pause: Don't upgrade it now. Something blocks it, or the change is too big for the time your product is willing to invest right now (it's all about appetite).
- Share the plan with your team before you start. Your teammates know corners of the codebase you don't, and they'll spot a risk or a missing step much faster when it's on paper than in the middle of a broken build. Then adjust your plan as needed.
In the end, your plan should split the work into three lists, and it's important to keep track of all of them:
- Prep work: changes you can ship before the upgrade, without touching any dependency.
- The migration itself: everything that has to change for the new version to work.
- Future work: what you're deliberately leaving for later (the trade-offs from your call), so it doesn't get lost.
3. Migrate in small steps
Resist the urge to do everything in one go. AI may make a 4,000-line PR easier to produce, but that doesn't make it easier to review, debug or roll back. When something breaks two weeks later, you want to find the change that caused it, and whoever reviews it, human or AI, does a much better job with a change small enough to actually follow.
- Ship the prep work first. Start with changes that don't need any dependency update. For example, the new NativeWind (our styling library) didn't fully support coloring SVG icons yet, so we changed how we color them before the upgrade.
- One package at a time, unless some packages must move together (like a framework and its own modules). This doesn't mean one PR per update: you can split your work into commits, one by one, or in groups with minimal risk.
- Small, reviewable changes. One commit per fix makes it much easier to find what broke what.
- Review the lockfile diff. A single bump can pull in dozens of transitive updates. Skim the lockfile changes so nothing unexpected sneaks in with your upgrade.
- Expect UI fallout. In our upgrades, the code compiled fine, but icons looked different, shadows disappeared, pickers and dropdowns showed up in the wrong place... None of that shows up in a type check.
4. Test, test, test
Establish a baseline before upgrading. Run your existing tests, check your build times and review your current error rates. Having a baseline makes it easier to distinguish migration-related regressions from issues that were already there.
Testing isn't a step you do once at the end. Expand your testing scope as the migration progresses: start with targeted checks after individual changes and work your way toward full regression testing of the app. The more you migrate, the more you test.
And green tests (unit, integration, end-to-end...) are necessary, but they're not enough.
- Start from a fresh build. On mobile, that means a new development build after the upgrade, not the old one you had installed.
- Test on real devices, both iOS and Android (or for web apps: different browsers, and production builds, not only the dev server).
- QA by feature, not by screen. List the features that touch native code or the platform (notifications, calendar, audio and video, maps, payments...) and check each one. Those are the ones a type check will never catch.
- Test your tooling too, not just the app. After one of our upgrades, the app worked perfectly... and Storybook didn't load at all. Run the tooling you listed in your inventory before you call it done.
- Read the logs. Warnings in the console or the build output often tell you about things you didn't map. For example, after upgrading to SDK 54, our app still worked with
expo-av, but the logs reminded us that it was deprecated and scheduled for removal in SDK 55. That gave us time to plan the move toexpo-videoandexpo-audiobefore it became urgent. - Run your release checks early. App store requirements, privacy settings or build configs can change between versions too. For web apps, it's the same story with your deployment: the Node version your hosting runs, your supported browsers, security headers or bundle size limits.
5. Launch it gradually and watch closely
Even after all that testing, resist the temptation to go straight to production. A successful QA cycle doesn't guarantee a bug-free release. A progressive rollout helps you detect unexpected issues while limiting their impact on your users.
- Define what a successful migration looks like. A successful build isn't enough. Make sure your critical user flows still work, error rates remain stable and performance hasn't noticeably regressed.
- Validate before production. Your team first, then internal testers or a beta group (TestFlight and Play Console testing tracks on mobile; a staging or preview environment on web).
- Then roll out progressively. Phased releases on the App Store and staged rollouts on Google Play; canary releases, or feature flags when they apply, on web.
- Watch your error alerts. Keep an eye on your error monitoring and crash reports for the first few days, and compare them with your baseline.
- Pay special attention to bug reports. A strange report right after the release is worth a second look: it might be the migration.
- Only when it meets your success criteria, roll it out to everyone.
6. Document what you learned
At the end of the first upgrade, we wrote down what broke, what we patched and what we had to work around. It felt like extra work at the time.
In subsequent upgrades, those notes were gold. We knew which patches to re-check, which areas of the UI to test first and which limitations were still there.
So before you close the migration, update your docs: the patches you removed, the ones you kept (and why), and anything you'd want to know next time.
7. Turn the flow into an AI skill
AI coding agents are great at the boring parts of a migration: finding every usage of an API, reading changelogs, comparing versions. But you don't want an agent that bumps 15 packages and "fixes" everything on its own.
Before writing your own, check if your framework already has one. Expo, for example, publishes official agent skills, including one for upgrading the Expo SDK with the known breaking changes for each version.
Here's a high-level example you can try out. Every codebase has its own constraints and gotchas, so treat it as a starting point rather than a universal solution, and adapt it to your project's architecture, tooling and testing requirements.
---
name: library-upgrade
description: Safely upgrade one npm package. Research first, present a plan,
and wait for approval before changing anything.
---
# Library upgrade
## Hard rules
- Plan first. Don't edit files or install anything until the plan is approved.
- One package per run, unless some packages must move together.
- Never bypass the release cooldown without explicit approval.
- Prefer official changelogs and migration guides over memory.
- Don't call the upgrade good or bad until impact and risks are mapped.
- Establish a testing baseline before making changes.
- Identify the rollback strategy before applying the upgrade.
- Never introduce unrelated refactors or optional features
as part of the migration.
- Clearly distinguish verified facts from assumptions.
- Never report a verification step as passed if it was not actually executed.
- Stop and report unexpected breaking changes before expanding
the approved scope.
## Steps
1. Resolve the current and target versions. Respect the release cooldown.
2. Classify the bump: patch, minor or major.
3. Read the upstream notes: changelog, breaking changes, peer dependencies,
security advisories. Keep the link to every changelog and migration guide
you actually opened.
4. Map the impact in this repo: usages, patches, pinned versions, native code,
the packages that must move with it, the tooling that depends on it,
and the toolchain it requires.
5. Present a plan with a recommendation and a rollback strategy, then STOP:
- Go: upgrade now.
- Conditional: OK only if named extra work is done first.
- Pause: don't upgrade yet.
Split the plan into prep work, the migration itself and future work
(what is deliberately left out, and why). Make it easy to share with the team.
6. Apply (only after approval). Update the patches, overrides and
limitations docs if any of them changed.
7. Verify against the baseline: tests, type check, lint, and a run on a real
device or browser.
8. Report what changed, which docs were updated, and the future work.
## Sources
End every plan with links to the changelogs and migration guides behind it,
pointing to the important breaking changes, so the user can read them
before approving.8. Use your skill in the next migration (and keep improving it)
For our next upgrade, we didn't start from zero: I ran the skill with an AI agent and got a detailed migration plan before touching any code.
That migration still taught us new things, and each one became part of our flow:
- Choose the smallest meaningful upgrade. A newer version was already out, but we aimed for the next one. Jumping two versions at once would have mixed two sets of breaking changes, so we left the newest one for a separate upgrade later.
- Check your build tools, not just your packages. SDK 55 needed Xcode 26.2 or newer, and my machine still had an older version, so updating it became the first step.
Every migration will teach you something new. Add it to your skill, so the next one builds on what you've already learned.
Recap: the checklist
If you only keep one thing from this post, keep this:
- Set up a release cooldown, and respect it
- List what you're upgrading and what has to move with it
- List the tooling that depends on it (Storybook, dev tools, CI, build scripts)
- Check toolchain requirements (Xcode, Node, build images)
- Review every patch, override and pinned version: keep it, rewrite it or delete it
- Classify every bump (patch, minor, major)
- Read the official changelogs, migration guides and security advisories
- Map the impact on your code and list the risks
- Plan your rollback before you start
- Choose the smallest meaningful upgrade, and write down what's out of scope
- Decide: Go, Conditional or Pause, and write down what you're leaving out
- Get feedback on the plan from your peers
- Track three lists: prep work, the migration itself and future work
- Establish a baseline: tests, build times and error rates
- Ship the prep work that doesn't need the upgrade first
- Migrate one package (or group) at a time, in small PRs
- Review the lockfile diff
- Don't turn on new optional features in the same change
- Test on real devices and browsers, not just CI
- Test your tooling too (Storybook, dev tools, CI, build scripts)
- Read the logs for deprecation warnings you didn't map
- Define what success looks like before the launch
- Launch to a small group first, then roll out progressively
- Watch error alerts and bug reports closely after the launch
- Update your docs for next time
- Turn the flow into a skill, and improve it after every migration
What I learned
Looking back, upgrading dependencies was rarely the hardest part. The real challenge was understanding the impact of each change, knowing what to test and making informed decisions along the way.
What started as a challenging migration eventually became a repeatable process. And with AI skills, we found a way to turn our team's experience into something we could reuse and improve with every upgrade.
The goal isn't just to make this migration successful. It's to make the next one easier.
And that's it! I hope this saves you some stress on your next big migration.
If you have your own migration tricks, I'd love to hear them. Feel free to reach out!