Capacitor Plugin Upgrades

capawesome-team/skills/skills/capacitor-plugin-upgrades

作者 capawesome-teamc58aeb068d27MIT45 個星標收錄於 2026年10月9日更新於 2026年10月9日儲存庫3 天前更新

Guides the agent through upgrading a Capacitor plugin to a newer major version. Supports upgrades from Capacitor 4 through 8, including multi-version jumps. Covers automated upgrade via official migration tools, Android SDK targets, Gradle configuration, Java/Kotlin versions, iOS deployment targets, and manual step-by-step fallback for each version. Do not use for app project upgrade or non-Capacitor plugin frameworks.

AI 產生的概覽

引導將 Capacitor 外掛升級至 4 到 8 的新主版本,包含跨多個版本的升級。

功能
此技能引導代理將 Capacitor 外掛升級至較新的主版本,涵蓋從版本 4 到 8 的升級。它會偵測目前的 @capacitor/core 版本,依序套用對應的各版本參考指南,並在每個步驟後執行 npm install 與 npx cap sync 並進行建置驗證。內容也涵蓋 Android SDK 目標、Gradle 設定、Java/Kotlin 版本、iOS 部署目標,以及自動化遷移工具失敗時的手動備援步驟。
適用情境
當 Capacitor 外掛專案需要升級至較新的 Capacitor 主版本時使用,包含 5 到 8 這類跨多個版本的升級。它不適用於升級應用程式專案或非 Capacitor 外掛框架。
執行需求
需要 Node.js 與 npm,最低 Node.js 版本取決於目標 Capacitor 版本(v5 需 16+,v6 需 18+,v7 需 20+,v8 需 22+)。專案必須是 Capacitor 外掛。此技能不附帶指令碼,依賴參考 markdown 檔案以及 npm install、npx cap sync 等指令。

Capacitor Plugin Upgrade

Upgrade a Capacitor plugin to a newer major version (4→5, 5→6, 6→7, or 7→8).

Prerequisites

Target VersionNode.js
516+
618+
720+
822+

The project must be a Capacitor plugin (not an app project).

Procedures

Step 1: Detect Current Version

Read @capacitor/core version from package.json (devDependencies or peerDependencies). Determine the current major version.

Ask the user for the target version. Default to the latest (8) if not specified.

Step 2: Execute Upgrade

For each major version jump between the current and target version, apply the corresponding upgrade guide sequentially:

Current → TargetReference
4 → 5references/upgrade-v4-to-v5.md
5 → 6references/upgrade-v5-to-v6.md
6 → 7references/upgrade-v6-to-v7.md
7 → 8references/upgrade-v7-to-v8.md

For multi-version jumps (e.g., 5 → 8), apply each upgrade in order:

  1. Read and apply references/upgrade-v5-to-v6.md
  2. Run npm install && npx cap sync, build, and verify the plugin's test/example app
  3. Read and apply references/upgrade-v6-to-v7.md
  4. Run npm install && npx cap sync, build, and verify the plugin's test/example app
  5. Read and apply references/upgrade-v7-to-v8.md
  6. Run npm install && npx cap sync, build, and verify the plugin's test/example app

Do not skip intermediate versions.

Step 3: Final Verification

After completing all upgrade steps:

bash
npm installnpx cap sync

Build the plugin's test/example app on both platforms to verify.

Error Handling

  • If automated upgrade tools fail, check the terminal output for which steps failed and apply those manually using the steps in the corresponding reference file.
  • If Android build fails after upgrade, run Tools > AGP Upgrade Assistant in Android Studio.
  • If iOS build fails, verify the deployment target matches the target version requirements in the reference file.
  • If Gradle property syntax warnings appear (v8+), search all .gradle files for property assignments without = and update them.
  • If a multi-version upgrade fails mid-way, fix the current version step before proceeding to the next.

Related Skills

  • capacitor-app-upgrades — If the app project itself also needs upgrading, use this skill.
  • capacitor-plugin-spm-support — After upgrading a plugin to Capacitor 6+, use this skill to add Swift Package Manager support.
  • capacitor-plugin-development — For creating new Capacitor plugins from scratch, including scaffolding, native implementation, and publishing.

來源與署名

來源:capawesome-team/skills位於skills/capacitor-plugin-upgrades提交c58aeb0

授權條款: MIT

內容歸原作者所有。SourceWeft 從公開儲存庫中收錄這些內容。

檢舉或申請下架