规划并升级 Expo 应用 SDK
按 SDK 版本逐步调整依赖、原生配置与更新策略,并输出构建验证和发布安排。
完整提示词
<context>
Each Expo SDK is tied to one React Native version and a set of package versions that are tested together, so the job is mostly aligning versions, and doing it one SDK at a time is far easier to debug than jumping several. `npx expo install expo@^<sdk> --fix` and then `npx expo install --fix` move Expo packages and known libraries to compatible versions; `npx expo-doctor` reports mismatches, duplicate native modules and config problems. Whether the native folders are generated matters most: with Continuous Native Generation, `android/` and `ios/` are outputs of `npx expo prebuild` and can be regenerated with `--clean`, but if they are committed and hand-edited, regeneration wipes those edits and native changes must be applied by hand from the React Native upgrade diff. Third-party config plugins and native libraries must support the new SDK. SDKs change platform minimums (iOS deployment target, Android min and compile SDK), default the New Architecture on in recent SDKs, and deprecate packages (for example `expo-av` in favour of `expo-audio` and `expo-video`). Expo Go only runs the latest SDK, so development builds are the reliable way to test. EAS Update must never send an update built for the new SDK to binaries built on the old one; the `runtimeVersion` policy is what prevents that. Each SDK's changelog lists its breaking changes.
</context>
<task>
Upgrade this app to Expo SDK {{target_sdk}}.
{{#notes}}
Notes:
{{notes}}
{{/notes}}
1. Read `package.json`, `app.json` or `app.config.*`, `eas.json`, config plugins, and whether `android/` and `ios/` are generated or committed with manual edits. Record the current SDK, React Native version and `runtimeVersion` policy.
2. Plan the path one SDK at a time and read each SDK's changelog and breaking changes. List libraries and config plugins that need upgrades or have no support yet; stop for a decision on those.
3. For each SDK step: run `npx expo install expo@^<sdk> --fix`, then `npx expo install --fix`, then `npx expo-doctor`, and fix what it reports. Update deprecated packages and APIs named in the changelog.
4. Native code: if folders are generated, run prebuild with `--clean` on a branch and review the diff for lost customisations (they belong in config plugins). If folders are committed and edited, ask before regenerating and otherwise apply the native upgrade changes by hand.
5. Build development builds for both platforms, run the tests and check key flows: startup, navigation, permissions, push notifications, deep links, camera or media, and any native module.
6. Confirm `runtimeVersion` changes with the native change so old binaries cannot receive the new update, update EAS build images if pinned, and build release binaries with EAS.
</task>
<constraints>
- Never run `expo prebuild --clean` over committed native folders with manual edits without the user's confirmation.
- Do not publish an over-the-air update across an SDK change to existing store binaries.
- Do not force package versions outside what `expo install` selects without a stated reason.
- Do not cite breaking changes not in the SDK changelog or seen failing.
{{> guardrails/verify-before-done}}
{{> guardrails/scope-discipline}}
</constraints>
<output_format>
## Starting point
SDK, React Native version, native folder strategy, plugins and native libraries, update policy.
## Path
SDK steps with the main breaking changes for each.
## Changes made
Per step: packages changed, code and config changes, native diff summary.
## Verification
expo-doctor result, builds per platform, tests and flows checked.
## Release plan
Runtime version, store builds, update channels, rollback.
</output_format>可替换内容
- {{target_sdk}}
- {{#notes}}
- {{notes}}
- {{/notes}}
- {{> guardrails/verify-before-done}}
- {{> guardrails/scope-discipline}}
分类与标签
编程开发、Expo SDK升级、React Native、移动应用构建