upgrading-expo

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Upgrading Expo

升级Expo

Overview

概述

Upgrade Expo SDK versions safely, handling breaking changes, dependencies, and configuration updates.
安全地升级Expo SDK版本,处理重大变更、依赖项和配置更新。

When to Use This Skill

何时使用此技能

Use this skill when you need to upgrade Expo SDK versions.
Use this skill when:
  • Upgrading to a new Expo SDK version
  • Handling breaking changes between SDK versions
  • Updating dependencies for compatibility
  • Migrating deprecated APIs to new versions
  • Preparing apps for new Expo features
当你需要升级Expo SDK版本时,使用此技能。
在以下场景使用此技能:
  • 升级到新的Expo SDK版本
  • 处理SDK版本之间的重大变更
  • 更新依赖项以确保兼容性
  • 将已弃用的API迁移到新版本
  • 为应用准备适配Expo的新功能

Instructions

操作步骤

This skill guides you through upgrading Expo SDK versions:
  1. Pre-Upgrade Planning: Review release notes and breaking changes
  2. Dependency Updates: Update packages for SDK compatibility
  3. Configuration Migration: Update app.json and configuration files
  4. Code Updates: Migrate deprecated APIs to new versions
  5. Testing: Verify app functionality after upgrade
此技能将引导你完成Expo SDK版本的升级流程:
  1. 升级前规划:查看发布说明和重大变更
  2. 依赖项更新:更新包以适配SDK兼容性
  3. 配置迁移:更新app.json和配置文件
  4. 代码更新:将已弃用的API迁移到新版本
  5. 测试:升级后验证应用功能

Upgrade Process

升级流程

1. Pre-Upgrade Checklist

1. 升级前检查清单

  • Review Expo SDK release notes
  • Identify breaking changes affecting your app
  • Check compatibility of third-party packages
  • Backup current project state
  • Create a feature branch for the upgrade
  • 查看Expo SDK发布说明
  • 识别影响你应用的重大变更
  • 检查第三方包的兼容性
  • 备份当前项目状态
  • 创建用于升级的功能分支

2. Update Expo SDK

2. 更新Expo SDK

bash
undefined
bash
undefined

Update Expo CLI

Update Expo CLI

npm install -g expo-cli@latest
npm install -g expo-cli@latest

Upgrade Expo SDK

Upgrade Expo SDK

npx expo install expo@latest
npx expo install expo@latest

Update all Expo packages

Update all Expo packages

npx expo install --fix
undefined
npx expo install --fix
undefined

3. Handle Breaking Changes

3. 处理重大变更

  • Review migration guides for breaking changes
  • Update deprecated API calls
  • Modify configuration files as needed
  • Update native dependencies if required
  • Test affected features thoroughly
  • 查看迁移指南以了解重大变更
  • 更新已弃用的API调用
  • 根据需要修改配置文件
  • 如果需要,更新原生依赖项
  • 彻底测试受影响的功能

4. Update Dependencies

4. 更新依赖项

bash
undefined
bash
undefined

Check for outdated packages

Check for outdated packages

npx expo-doctor
npx expo-doctor

Update packages to compatible versions

Update packages to compatible versions

npx expo install --fix
npx expo install --fix

Verify compatibility

Verify compatibility

npx expo-doctor
undefined
npx expo-doctor
undefined

5. Testing

5. 测试

  • Test core app functionality
  • Verify native modules work correctly
  • Check for runtime errors
  • Test on both iOS and Android
  • Verify app store builds still work
  • 测试应用核心功能
  • 验证原生模块正常工作
  • 检查运行时错误
  • 在iOS和Android平台上进行测试
  • 验证应用商店构建仍然正常

Common Issues

常见问题

Dependency Conflicts

依赖冲突

  • Use
    expo install
    instead of
    npm install
    for Expo packages
  • Check package compatibility with new SDK version
  • Resolve peer dependency warnings
  • 对于Expo包,使用
    expo install
    而非
    npm install
  • 检查包与新SDK版本的兼容性
  • 解决对等依赖警告

Configuration Changes

配置变更

  • Update
    app.json
    for new SDK requirements
  • Migrate deprecated configuration options
  • Update native configuration files if needed
  • 针对新SDK要求更新
    app.json
  • 迁移已弃用的配置选项
  • 如果需要,更新原生配置文件

Breaking API Changes

API重大变更

  • Review API migration guides
  • Update code to use new APIs
  • Test affected features after changes
  • 查看API迁移指南
  • 更新代码以使用新API
  • 变更后测试受影响的功能

Best Practices

最佳实践

  • Always upgrade in a feature branch
  • Test thoroughly before merging
  • Review release notes carefully
  • Update dependencies incrementally
  • Keep Expo CLI updated
  • Use
    expo-doctor
    to verify setup
  • 始终在功能分支中进行升级
  • 合并前彻底测试
  • 仔细查看发布说明
  • 逐步更新依赖项
  • 保持Expo CLI为最新版本
  • 使用
    expo-doctor
    验证设置

Resources

资源

For more information, see the source repository.
如需更多信息,请查看源码仓库