capacitor-plugin-upgrade-v5-to-v6
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseCapacitor Plugin Upgrade v5 to v6
Capacitor 插件 v5 到 v6 升级指南
Upgrade a Capacitor plugin from version 5 to version 6.
将Capacitor插件从版本5升级到版本6。
When to Use This Skill
何时使用此技能
- User says the plugin targets Capacitor 5 and must move to v6
- User wants the exact v5 to v6 migration path
- User needs v6-specific native and package updates
- 用户说明插件适配Capacitor 5且需要迁移到v6
- 用户需要v5到v6的准确迁移路径
- 用户需要v6专属的原生层和包更新
Live Project Snapshot
项目实时快照
Plugin and Capacitor package snapshot:
!
node -e "const fs=require('fs');if(!fs.existsSync('package.json'))process.exit(0);const pkg=JSON.parse(fs.readFileSync('package.json','utf8'));const out=['package.name='+(pkg.name||''),'package.version='+(pkg.version||'')];for(const section of ['peerDependencies','dependencies','devDependencies']){for(const [name,version] of Object.entries(pkg[section]||{})){if(name.startsWith('@capacitor/'))out.push(section+'.'+name+'='+version)}}console.log(out.join('\n'))"Example and native project paths:
!
find . -maxdepth 3 \( -path './example-app' -o -path './ios' -o -path './android' \)插件和Capacitor包快照:
!
node -e "const fs=require('fs');if(!fs.existsSync('package.json'))process.exit(0);const pkg=JSON.parse(fs.readFileSync('package.json','utf8'));const out=['package.name='+(pkg.name||''),'package.version='+(pkg.version||'')];for(const section of ['peerDependencies','dependencies','devDependencies']){for(const [name,version] of Object.entries(pkg[section]||{})){if(name.startsWith('@capacitor/'))out.push(section+'.'+name+'='+version)}}console.log(out.join('\n'))"示例和原生项目路径:
!
find . -maxdepth 3 \( -path './example-app' -o -path './ios' -o -path './android' \)Procedure
操作步骤
- Start from the injected snapshot and confirm the current Capacitor peer dependency range in .
package.json - Update the peer dependency range to Capacitor 6.
- Review the v5 to v6 migration notes before editing native files.
- Update the example app if it exists.
- Run .
npm install - Sync and verify the example or test app.
- 基于注入的快照信息,确认中当前Capacitor对等依赖的版本范围。
package.json - 将对等依赖的版本范围更新为Capacitor 6。
- 编辑原生文件前先查阅v5到v6的迁移说明。
- 如果存在示例应用则对其进行更新。
- 运行。
npm install - 同步并验证示例或测试应用。
Error Handling
错误处理
- If the example app breaks, fix the plugin API or native bridge before moving on.
- If iOS fails, verify the deployment target for Capacitor 6.
- If Android fails, verify the Gradle and Java requirements for Capacitor 6.
- 如果示例应用运行异常,先修复插件API或原生桥接层再继续后续操作。
- 如果iOS运行失败,检查是否满足Capacitor 6的部署目标要求。
- 如果Android运行失败,检查是否满足Capacitor 6的Gradle和Java版本要求。