ionic-appflow-migration
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseIonic Appflow Migration
Ionic Appflow 迁移指南
Migrate an existing Ionic/Capacitor project from Ionic Appflow to Capawesome Cloud.
将现有Ionic/Capacitor项目从Ionic Appflow迁移至Capawesome Cloud。
Prerequisites
前提条件
- A Capacitor 6, 7, or 8 app currently using Ionic Appflow.
- Node.js 18+ and npm installed.
- Access to the project's source code repository.
- A Capawesome Cloud account and organization.
- 当前使用Ionic Appflow的Capacitor 6、7或8版本应用。
- 已安装Node.js 18+及npm。
- 可访问项目的源代码仓库。
- 拥有Capawesome Cloud账号及组织。
General Rules
通用规则
- Before running any command for the first time, run it with the
@capawesome/cliflag to review all available options.--help - Do not remove Ionic Appflow configuration until the corresponding Capawesome Cloud feature is fully set up and verified.
- Determine the Capacitor version from (
package.json) before making any changes — it affects which plugin version and update strategy to use.@capacitor/core
- 首次运行任何命令前,先添加
@capawesome/cli参数查看所有可用选项。--help - 在对应的Capawesome Cloud功能完全设置并验证通过前,请勿删除Ionic Appflow配置。
- 在进行任何更改前,先从的
package.json字段确认Capacitor版本——这会影响插件版本选择及更新策略。@capacitor/core
Procedures
迁移步骤
Step 1: Detect Ionic Appflow Usage
步骤1:检测Ionic Appflow功能使用情况
Scan the project to determine which Appflow features are in use.
扫描项目以确定正在使用的Appflow功能。
1.1 Check for Live Updates
1.1 检查实时更新功能
Search for these signals:
- in
@capacitor/live-updates(dependencies or devDependencies).package.json - in
cordova-plugin-ionic— this is the legacy Cordova SDK for Ionic Live Updates.package.json - A key inside the
LiveUpdatesobject inpluginsorcapacitor.config.ts.capacitor.config.json - Imports of or
@capacitor/live-updatesin TypeScript/JavaScript source files.cordova-plugin-ionic
If any signal is found, mark Live Updates as in use. Also record which SDK is in use ( or ).
@capacitor/live-updatescordova-plugin-ionicRecord the current configuration values:
- (Ionic Appflow app ID)
appId - (
autoUpdateMethod,background, oralways)none channelenabledmaxVersions
查找以下特征:
- 的依赖或开发依赖中包含
package.json。@capacitor/live-updates - 中包含
package.json——这是Ionic实时更新的旧版Cordova SDK。cordova-plugin-ionic - 或
capacitor.config.ts的capacitor.config.json对象中存在plugins配置项。LiveUpdates - TypeScript/JavaScript源文件中导入了或
@capacitor/live-updates。cordova-plugin-ionic
如果发现以上任一特征,标记实时更新为已使用。同时记录所使用的SDK类型(或)。
@capacitor/live-updatescordova-plugin-ionic记录当前配置值:
- (Ionic Appflow应用ID)
appId - (
autoUpdateMethod、background或always)none channelenabledmaxVersions
1.2 Check for Native Builds
1.2 检查原生构建功能
Search for these signals:
- References to in CI/CD configuration files (e.g.,
ionic appflow build,.github/workflows/*.yml,.gitlab-ci.yml,bitrise.yml,Jenkinsfile).azure-pipelines.yml - References to or
dashboard.ionicframework.comin CI/CD files or scripts.appflow.ionic.io - An or similar Appflow build configuration file in the project root.
appflow.config.json
If any signal is found, mark Native Builds as in use.
查找以下特征:
- CI/CD配置文件(如、
.github/workflows/*.yml、.gitlab-ci.yml、bitrise.yml、Jenkinsfile)中存在azure-pipelines.yml引用。ionic appflow build - CI/CD文件或脚本中存在或
dashboard.ionicframework.com引用。appflow.ionic.io - 项目根目录下存在或类似的Appflow构建配置文件。
appflow.config.json
如果发现以上任一特征,标记原生构建为已使用。
1.3 Check for App Store Publishing
1.3 检查应用商店发布功能
Search for these signals:
- References to in CI/CD configuration files.
ionic appflow deploy - Appflow deploy destinations or channels configured for app store submission.
If any signal is found, mark App Store Publishing as in use.
查找以下特征:
- CI/CD配置文件中存在引用。
ionic appflow deploy - 已配置用于应用商店提交的Appflow发布目标或渠道。
如果发现以上任一特征,标记应用商店发布为已使用。
1.4 Present Findings
1.4 呈现检测结果
Present the detected features to the user. Ask the user to confirm which features to migrate. The user may choose to migrate all detected features or only a subset.
向用户展示检测到的功能,询问用户确认需要迁移的功能。用户可选择迁移所有检测到的功能或仅迁移部分功能。
Step 2: Set Up Capawesome Cloud
步骤2:搭建Capawesome Cloud
2.1 Authenticate
2.1 身份验证
bash
npx @capawesome/cli loginbash
npx @capawesome/cli login2.2 Create an App
2.2 创建应用
Skip if the user already has a Capawesome Cloud app ID.
bash
npx @capawesome/cli apps:createSave the returned app ID (UUID) for subsequent steps.
如果用户已有Capawesome Cloud应用ID,可跳过此步骤。
bash
npx @capawesome/cli apps:create保存返回的应用ID(UUID),供后续步骤使用。
Step 3: Migrate Live Updates
步骤3:迁移实时更新功能
Skip this step if Live Updates was not detected or the user chose not to migrate it.
如果未检测到实时更新功能,或用户选择不迁移该功能,可跳过此步骤。
3.1 Remove the Ionic Live Updates SDK
3.1 移除Ionic实时更新SDK
If the project uses :
@capacitor/live-updatesbash
npm uninstall @capacitor/live-updatesIf the project uses the legacy Cordova SDK ():
cordova-plugin-ionicbash
npm uninstall cordova-plugin-ionicRead for the native configuration cleanup steps (removing legacy keys from , , and Capacitor config).
references/cordova-sdk-migration.mdInfo.pliststrings.xml如果项目使用:
@capacitor/live-updatesbash
npm uninstall @capacitor/live-updates如果项目使用旧版Cordova SDK():
cordova-plugin-ionicbash
npm uninstall cordova-plugin-ionic阅读了解原生配置清理步骤(从、及Capacitor配置中移除旧版配置项)。
references/cordova-sdk-migration.mdInfo.pliststrings.xml3.2 Install the Capawesome Live Update Plugin
3.2 安装Capawesome实时更新插件
Install the version matching the project's Capacitor version:
- Capacitor 8:
npm install @capawesome/capacitor-live-update@latest - Capacitor 7:
npm install @capawesome/capacitor-live-update@^7.3.0 - Capacitor 6:
npm install @capawesome/capacitor-live-update@^6.0.0
安装与项目Capacitor版本匹配的插件版本:
- Capacitor 8:
npm install @capawesome/capacitor-live-update@latest - Capacitor 7:
npm install @capawesome/capacitor-live-update@^7.3.0 - Capacitor 6:
npm install @capawesome/capacitor-live-update@^6.0.0
3.3 Update the Capacitor Configuration
3.3 更新Capacitor配置
Replace the plugin config with in (or ). Map the configuration options as follows:
LiveUpdatesLiveUpdatecapacitor.config.ts.jsonIonic Appflow ( | Capawesome Cloud ( | Notes |
|---|---|---|
| | Replace with the Capawesome Cloud app ID from Step 2 |
| | Capacitor 7/8 only. Omit for Capacitor 6 |
| | Capacitor 7/8 only. Also add |
| (omit | Use manual sync code instead (see Step 3.6) |
| | Same value |
| (remove) | Not needed — controlled in code |
| | Boolean instead of number |
Example — Capacitor 7/8 with background strategy:
diff
// capacitor.config.ts
const config: CapacitorConfig = {
plugins: {
- LiveUpdates: {
- appId: 'abc12345',
- autoUpdateMethod: 'background',
- channel: 'production',
- maxVersions: 3
- }
+ LiveUpdate: {
+ appId: '<CAPAWESOME_APP_ID>',
+ autoUpdateStrategy: 'background',
+ defaultChannel: 'production',
+ autoDeleteBundles: true
+ }
}
};Example — Capacitor 6 (no autoUpdateStrategy):
diff
// capacitor.config.ts
const config: CapacitorConfig = {
plugins: {
- LiveUpdates: {
- appId: 'abc12345',
- channel: 'production',
- maxVersions: 3
- }
+ LiveUpdate: {
+ appId: '<CAPAWESOME_APP_ID>',
+ defaultChannel: 'production',
+ autoDeleteBundles: true
+ }
}
};将(或)中的插件配置替换为。配置项映射如下:
capacitor.config.ts.jsonLiveUpdatesLiveUpdateIonic Appflow( | Capacitor Cloud( | 说明 |
|---|---|---|
| | 替换为步骤2中获取的Capawesome Cloud应用ID |
| | 仅适用于Capacitor 7/8,Capacitor 6无需配置 |
| | 仅适用于Capacitor 7/8,同时需添加 |
| (省略 | 改用手动同步代码(见步骤3.6) |
| | 值保持不变 |
| (移除) | 无需配置,由代码控制 |
| | 布尔值替代数字 |
示例——Capacitor 7/8(background策略):
diff
// capacitor.config.ts
const config: CapacitorConfig = {
plugins: {
- LiveUpdates: {
- appId: 'abc12345',
- autoUpdateMethod: 'background',
- channel: 'production',
- maxVersions: 3
- }
+ LiveUpdate: {
+ appId: '<CAPAWESOME_APP_ID>',
+ autoUpdateStrategy: 'background',
+ defaultChannel: 'production',
+ autoDeleteBundles: true
+ }
}
};示例——Capacitor 6(无autoUpdateStrategy):
diff
// capacitor.config.ts
const config: CapacitorConfig = {
plugins: {
- LiveUpdates: {
- appId: 'abc12345',
- channel: 'production',
- maxVersions: 3
- }
+ LiveUpdate: {
+ appId: '<CAPAWESOME_APP_ID>',
+ defaultChannel: 'production',
+ autoDeleteBundles: true
+ }
}
};3.4 Update Import Statements and API Calls
3.4 更新导入语句及API调用
Search all TypeScript/JavaScript files for imports of (or ) and replace. The Ionic SDK uses two import styles — replace both:
@capacitor/live-updatescordova-plugin-ionicdiff
-import * as LiveUpdates from '@capacitor/live-updates';
+import { LiveUpdate } from '@capawesome/capacitor-live-update';diff
-import { LiveUpdates } from '@capacitor/live-updates';
+import { LiveUpdate } from '@capawesome/capacitor-live-update';If the project uses the legacy Cordova SDK (), read for the complete → method mapping, including the granular check-download-extract-reload pattern and native config cleanup.
cordova-plugin-ionicreferences/cordova-sdk-migration.mdDeployLiveUpdateReplace all references to the class (or class) with (singular).
LiveUpdatesDeployLiveUpdatesync(){ activeApplicationPathChanged: boolean }{ nextBundleId: string | null }diff
const result = await LiveUpdate.sync();
-if (result.activeApplicationPathChanged) {
+if (result.nextBundleId) {
await LiveUpdate.reload();
}reload()setConfig()getConfig()resetConfig()diff
// Setting config at runtime
-await LiveUpdates.setConfig({ appId: '456', channel: 'staging', maxVersions: 5 });
+await LiveUpdate.setConfig({ appId: '456' });
+await LiveUpdate.setChannel({ channel: 'staging' });diff
// Getting config at runtime
-const config = await LiveUpdates.getConfig();
-console.log(config.channel);
+const config = await LiveUpdate.getConfig(); // { appId, autoUpdateStrategy }
+const { channel } = await LiveUpdate.getChannel(); // { channel }diff
// Resetting config
-await LiveUpdates.resetConfig();
+await LiveUpdate.resetConfig();maxVersionsautoDeleteBundles: true在所有TypeScript/JavaScript文件中查找(或)的导入语句并替换。Ionic SDK有两种导入方式,均需替换:
@capacitor/live-updatescordova-plugin-ionicdiff
-import * as LiveUpdates from '@capacitor/live-updates';
+import { LiveUpdate } from '@capawesome/capacitor-live-update';diff
-import { LiveUpdates } from '@capacitor/live-updates';
+import { LiveUpdate } from '@capawesome/capacitor-live-update';如果项目使用旧版Cordova SDK(),请阅读了解完整的 → 方法映射,包括细粒度的检查-下载-提取-重载流程及原生配置清理步骤。
cordova-plugin-ionicreferences/cordova-sdk-migration.mdDeployLiveUpdate将所有类(或类)的引用替换为(单数形式)。
LiveUpdatesDeployLiveUpdatesync(){ activeApplicationPathChanged: boolean }{ nextBundleId: string | null }diff
const result = await LiveUpdate.sync();
-if (result.activeApplicationPathChanged) {
+if (result.nextBundleId) {
await LiveUpdate.reload();
}reload()setConfig()getConfig()resetConfig()diff
// 运行时设置配置
-await LiveUpdates.setConfig({ appId: '456', channel: 'staging', maxVersions: 5 });
+await LiveUpdate.setConfig({ appId: '456' });
+await LiveUpdate.setChannel({ channel: 'staging' });diff
// 运行时获取配置
-const config = await LiveUpdates.getConfig();
-console.log(config.channel);
+const config = await LiveUpdate.getConfig(); // { appId, autoUpdateStrategy }
+const { channel } = await LiveUpdate.getChannel(); // { channel }diff
// 重置配置
-await LiveUpdates.resetConfig();
+await LiveUpdate.resetConfig();maxVersionsautoDeleteBundles: true3.5 Add Always-Latest Update Logic (Capacitor 7/8 Only)
3.5 添加始终最新更新逻辑(仅适用于Capacitor 7/8)
If the previous Ionic Appflow was , add a listener to prompt the user when an update is ready. Add this code early in the app's initialization:
autoUpdateMethodalwaysnextBundleSettypescript
import { LiveUpdate } from '@capawesome/capacitor-live-update';
LiveUpdate.addListener('nextBundleSet', async (event) => {
if (event.bundleId) {
const shouldReload = confirm('A new update is available. Install now?');
if (shouldReload) {
await LiveUpdate.reload();
}
}
});Copy this snippet exactly. Do not simplify or omit the dialog.
confirm()如果之前Ionic Appflow的设置为,添加监听器,在更新就绪时提示用户。在应用初始化早期添加以下代码:
autoUpdateMethodalwaysnextBundleSettypescript
import { LiveUpdate } from '@capawesome/capacitor-live-update';
LiveUpdate.addListener('nextBundleSet', async (event) => {
if (event.bundleId) {
const shouldReload = confirm('有新更新可用,是否立即安装?');
if (shouldReload) {
await LiveUpdate.reload();
}
}
});请完全复制此代码片段,请勿简化或省略对话框。
confirm()3.6 Migrate Force Update Logic (If Applicable)
3.6 迁移强制更新逻辑(如适用)
If the project implements a "Force Update" pattern (extending the splash screen until the update completes), migrate it as follows:
diff
import { SplashScreen } from '@capacitor/splash-screen';
-import * as LiveUpdates from '@capacitor/live-updates';
+import { LiveUpdate } from '@capawesome/capacitor-live-update';
const initializeApp = async () => {
- const result = await LiveUpdates.sync();
- if (result.activeApplicationPathChanged) {
- await LiveUpdates.reload();
+ const { nextBundleId } = await LiveUpdate.sync();
+ if (nextBundleId) {
+ await LiveUpdate.reload();
} else {
await SplashScreen.hide();
}
};This pattern may impact user experience on slow connections. Consider migrating to the background update strategy instead.
如果项目实现了“强制更新”模式(在更新完成前保持启动页显示),按以下方式迁移:
diff
import { SplashScreen } from '@capacitor/splash-screen';
-import * as LiveUpdates from '@capacitor/live-updates';
+import { LiveUpdate } from '@capawesome/capacitor-live-update';
const initializeApp = async () => {
- const result = await LiveUpdates.sync();
- if (result.activeApplicationPathChanged) {
- await LiveUpdates.reload();
+ const { nextBundleId } = await LiveUpdate.sync();
+ if (result.nextBundleId) {
+ await LiveUpdate.reload();
} else {
await SplashScreen.hide();
}
};此模式可能在网络连接缓慢时影响用户体验,建议改用后台更新策略。
3.7 Add Manual Update Logic (Capacitor 6 Only)
3.7 添加手动更新逻辑(仅适用于Capacitor 6)
Capacitor 6 does not support . If the project uses Capacitor 6, add manual sync logic:
autoUpdateStrategytypescript
import { App } from '@capacitor/app';
import { LiveUpdate } from '@capawesome/capacitor-live-update';
void LiveUpdate.ready();
App.addListener('resume', async () => {
const { nextBundleId } = await LiveUpdate.sync();
if (nextBundleId) {
const shouldReload = confirm('A new update is available. Install now?');
if (shouldReload) {
await LiveUpdate.reload();
}
}
});Capacitor 6不支持。如果项目使用Capacitor 6,添加手动同步逻辑:
autoUpdateStrategytypescript
import { App } from '@capacitor/app';
import { LiveUpdate } from '@capawesome/capacitor-live-update';
void LiveUpdate.ready();
App.addListener('resume', async () => {
const { nextBundleId } = await LiveUpdate.sync();
if (result.nextBundleId) {
const shouldReload = confirm('有新更新可用,是否立即安装?');
if (shouldReload) {
await LiveUpdate.reload();
}
}
});3.8 Add Rollback Protection (Recommended)
3.8 添加回滚保护(推荐)
Add and to the config:
readyTimeoutautoBlockRolledBackBundlesLiveUpdatetypescript
LiveUpdate: {
appId: '<CAPAWESOME_APP_ID>',
autoUpdateStrategy: 'background', // Capacitor 7/8 only
readyTimeout: 10000,
autoBlockRolledBackBundles: true,
}Call as early as possible in app startup:
ready()typescript
import { LiveUpdate } from '@capawesome/capacitor-live-update';
void LiveUpdate.ready();在配置中添加和:
LiveUpdatereadyTimeoutautoBlockRolledBackBundlestypescript
LiveUpdate: {
appId: '<CAPAWESOME_APP_ID>',
autoUpdateStrategy: 'background', // 仅适用于Capacitor 7/8
readyTimeout: 10000,
autoBlockRolledBackBundles: true,
}在应用启动早期调用:
ready()typescript
import { LiveUpdate } from '@capawesome/capacitor-live-update';
void LiveUpdate.ready();3.9 Configure iOS Privacy Manifest
3.9 配置iOS隐私清单
Add to inside the array:
ios/App/PrivacyInfo.xcprivacyNSPrivacyAccessedAPITypesxml
<dict>
<key>NSPrivacyAccessedAPIType</key>
<string>NSPrivacyAccessedAPICategoryUserDefaults</string>
<key>NSPrivacyAccessedAPITypeReasons</key>
<array>
<string>CA92.1</string>
</array>
</dict>在的数组中添加以下内容:
ios/App/PrivacyInfo.xcprivacyNSPrivacyAccessedAPITypesxml
<dict>
<key>NSPrivacyAccessedAPIType</key>
<string>NSPrivacyAccessedAPICategoryUserDefaults</string>
<key>NSPrivacyAccessedAPITypeReasons</key>
<array>
<string>CA92.1</string>
</array>
</dict>3.10 Sync the Capacitor Project
3.10 同步Capacitor项目
bash
npx cap syncbash
npx cap syncStep 4: Migrate Native Builds
步骤4:迁移原生构建功能
Skip this step if Native Builds was not detected or the user chose not to migrate it.
Native build setup in Capawesome Cloud requires connecting a Git repository, uploading signing certificates, configuring environments, and triggering builds. Use the skill — follow the Native Builds section starting from "Connect Git Repository." Specifically, read the skill's for the full procedure.
capawesome-cloudcapawesome-cloudreferences/native-builds.mdRemove any Ionic Appflow build commands from CI/CD configuration files after verifying that Capawesome Cloud builds work correctly (see Step 6 for CI/CD migration).
如果未检测到原生构建功能,或用户选择不迁移该功能,可跳过此步骤。
Capawesome Cloud中的原生构建设置需要连接Git仓库、上传签名证书、配置环境并触发构建。请使用技能,遵循原生构建章节中从“连接Git仓库”开始的流程。具体请阅读技能中的获取完整步骤。
capawesome-cloudcapawesome-cloudreferences/native-builds.md在验证Capawesome Cloud构建功能正常工作后,从CI/CD配置文件中移除所有Ionic Appflow构建命令(CI/CD迁移见步骤6)。
Step 5: Migrate App Store Publishing
步骤5:迁移应用商店发布功能
Skip this step if App Store Publishing was not detected or the user chose not to migrate it.
App store publishing setup requires creating destinations and configuring credentials for Apple App Store and/or Google Play Store. Use the skill — follow the App Store Publishing section. Specifically, read the skill's for the full procedure.
capawesome-cloudcapawesome-cloudreferences/app-store-publishing.mdRemove any Ionic Appflow deploy commands from CI/CD configuration files after verifying that Capawesome Cloud deployments work correctly (see Step 6 for CI/CD migration).
如果未检测到应用商店发布功能,或用户选择不迁移该功能,可跳过此步骤。
应用商店发布设置需要创建发布目标,并为Apple App Store和/或Google Play Store配置凭据。请使用技能,遵循应用商店发布章节的流程。具体请阅读技能中的获取完整步骤。
capawesome-cloudcapawesome-cloudreferences/app-store-publishing.md在验证Capawesome Cloud发布功能正常工作后,从CI/CD配置文件中移除所有Ionic Appflow发布命令(CI/CD迁移见步骤6)。
Step 6: Update CI/CD Pipelines
步骤6:更新CI/CD流水线
Skip this step if the project has no CI/CD pipeline or uses Ionic Appflow's built-in build/deploy features without external CI/CD.
Use the following CLI command mapping as a reference when replacing Appflow commands:
| Appflow CLI Command | Capawesome CLI Equivalent |
|---|---|
| |
| |
| |
| |
| |
| Use versioned channels or |
| |
| |
如果项目没有CI/CD流水线,或仅使用Ionic Appflow内置的构建/发布功能而无外部CI/CD,可跳过此步骤。
替换Appflow命令时,可参考以下CLI命令映射:
| Appflow CLI命令 | Capawesome CLI等效命令 |
|---|---|
| |
| |
| |
| |
| |
| 使用版本化渠道,或在上传时添加 |
| |
| |
6.1 Replace Authentication
6.1 替换身份验证方式
Replace Ionic Appflow authentication with Capawesome Cloud token-based auth:
diff
-# Ionic Appflow authentication
-IONIC_TOKEN: ${{ secrets.IONIC_TOKEN }}
+# Capawesome Cloud authentication
+- run: npx @capawesome/cli login --token ${{ secrets.CAPAWESOME_CLOUD_TOKEN }}Generate a token in the Capawesome Cloud Console and store it as a CI/CD secret named .
CAPAWESOME_CLOUD_TOKEN将Ionic Appflow身份验证替换为Capawesome Cloud基于令牌的身份验证:
diff
-# Ionic Appflow身份验证
-IONIC_TOKEN: ${{ secrets.IONIC_TOKEN }}
+# Capawesome Cloud身份验证
+- run: npx @capawesome/cli login --token ${{ secrets.CAPAWESOME_CLOUD_TOKEN }}在Capawesome Cloud控制台生成令牌,并将其存储为CI/CD密钥,命名为。
CAPAWESOME_CLOUD_TOKEN6.2 Replace Build Commands
6.2 替换构建命令
diff
-ionic appflow build android --type release
+npx @capawesome/cli apps:builds:create --app-id <APP_ID> --platform android --type release --git-ref main --certificate "<CERTIFICATE_NAME>" --yesdiff
-ionic appflow build ios --type app-store
+npx @capawesome/cli apps:builds:create --app-id <APP_ID> --platform ios --type app-store --git-ref main --certificate "<CERTIFICATE_NAME>" --yesAdd for non-blocking builds in CI/CD pipelines.
--detacheddiff
-ionic appflow build android --type release
+npx @capawesome/cli apps:builds:create --app-id <APP_ID> --platform android --type release --git-ref main --certificate "<CERTIFICATE_NAME>" --yesdiff
-ionic appflow build ios --type app-store
+npx @capawesome/cli apps:builds:create --app-id <APP_ID> --platform ios --type app-store --git-ref main --certificate "<CERTIFICATE_NAME>" --yes在CI/CD流水线中添加参数实现非阻塞构建。
--detached6.3 Replace Live Update Upload Commands
6.3 替换实时更新上传命令
diff
-ionic appflow deploy web --channel production
+npx @capawesome/cli apps:liveupdates:upload --app-id <APP_ID> --channel productiondiff
-ionic appflow deploy web --channel production
+npx @capawesome/cli apps:liveupdates:upload --app-id <APP_ID> --channel production6.4 Replace App Store Deploy Commands
6.4 替换应用商店发布命令
diff
-ionic appflow deploy android --destination "Google Play"
+npx @capawesome/cli apps:deployments:create --app-id <APP_ID> --build-number <BUILD_NUMBER> --destination "<DESTINATION_NAME>"diff
-ionic appflow deploy android --destination "Google Play"
+npx @capawesome/cli apps:deployments:create --app-id <APP_ID> --build-number <BUILD_NUMBER> --destination "<DESTINATION_NAME>"6.5 Remove Ionic Appflow Dependencies
6.5 移除Ionic Appflow依赖
After verifying the new CI/CD pipeline works:
- Remove any or Appflow-related npm packages from
@ionic/appflow.package.json - Remove Ionic Appflow environment variables from CI/CD secrets (e.g., ).
IONIC_TOKEN - Remove or similar Appflow configuration files from the project root.
appflow.config.json
在验证新CI/CD流水线正常工作后:
- 从中移除所有
package.json或与Appflow相关的npm包。@ionic/appflow - 从CI/CD密钥中移除Ionic Appflow环境变量(如)。
IONIC_TOKEN - 从项目根目录中移除或类似的Appflow配置文件。
appflow.config.json
Step 7: Test and Verify
步骤7:测试与验证
7.1 Verify Live Updates (if migrated)
7.1 验证实时更新功能(如已迁移)
Ask the user whether to test live update functionality. If accepted:
- Make a small, visible change in the app (e.g., append " - Migration Test" to a heading).
- Build the web assets: .
npm run build - Check existing channels:
bash
npx @capawesome/cli apps:channels:list --app-id <APP_ID> --json - Create the target channel if missing:
bash
npx @capawesome/cli apps:channels:create --app-id <APP_ID> --name <CHANNEL_NAME> - Upload the bundle:
bash
npx @capawesome/cli apps:liveupdates:upload --app-id <APP_ID> --channel <CHANNEL_NAME> - Revert the visible change, rebuild, and sync:
bash
npm run build && npx cap sync - Open the native project (or
npx cap open ios) and run on a device or emulator.npx cap open android - Verify the live update is applied. For Capacitor 7/8 with , wait for the update prompt or force-close and reopen the app. For Capacitor 6, switch away from the app and return to trigger a check.
autoUpdateStrategy: "background"
询问用户是否测试实时更新功能。如果用户同意:
- 在应用中进行一个小的可见修改(如在标题后添加“ - 迁移测试”)。
- 构建Web资源:。
npm run build - 检查现有渠道:
bash
npx @capawesome/cli apps:channels:list --app-id <APP_ID> --json - 如果目标渠道不存在,创建该渠道:
bash
npx @capawesome/cli apps:channels:create --app-id <APP_ID> --name <CHANNEL_NAME> - 上传构建包:
bash
npx @capawesome/cli apps:liveupdates:upload --app-id <APP_ID> --channel <CHANNEL_NAME> - 撤销可见修改,重新构建并同步:
bash
npm run build && npx cap sync - 打开原生项目(或
npx cap open ios),在设备或模拟器上运行。npx cap open android - 验证实时更新是否生效。对于使用的Capacitor 7/8应用,等待更新提示,或强制关闭并重新打开应用。对于Capacitor 6应用,切换出应用再返回以触发更新检查。
autoUpdateStrategy: "background"
7.2 Verify Native Builds (if migrated)
7.2 验证原生构建功能(如已迁移)
Trigger a test build via the Capawesome CLI and verify the build artifact is produced.
通过Capawesome CLI触发测试构建,验证是否生成构建产物。
7.3 Verify App Store Publishing (if migrated)
7.3 验证应用商店发布功能(如已迁移)
Deploy a test build to the configured destination and verify it appears in TestFlight or Google Play Console.
将测试构建部署至配置的发布目标,验证其是否出现在TestFlight或Google Play控制台中。
7.4 Clean Up
7.4 清理工作
After all features are verified:
- Confirm all Ionic Appflow SDK packages are removed from .
package.json - Confirm all Ionic Appflow configuration is removed from /
capacitor.config.ts.capacitor.config.json - Confirm all Ionic Appflow CI/CD commands and environment variables are removed.
在所有功能验证通过后:
- 确认中已移除所有Ionic Appflow SDK包。
package.json - 确认/
capacitor.config.ts中已移除所有Ionic Appflow配置。capacitor.config.json - 确认已移除所有Ionic Appflow CI/CD命令及环境变量。
Error Handling
错误处理
Live Updates
实时更新功能
- fails → The package may be listed under a different name. Search
npm uninstall @capacitor/live-updatesfor any package containingpackage.jsonfromlive-updatesscope.@capacitor - fails after plugin swap → Verify the installed
npx cap syncversion matches the Capacitor version in@capawesome/capacitor-live-update.package.json - App reverts to default bundle after restart → is likely not called early enough. Add it as the first call in app initialization.
LiveUpdate.ready() - Updates not detected with → Updates only checked if last check was >15 minutes ago. Force-close and restart the app. Check device logs for Live Update SDK output.
autoUpdateStrategy: "background" - or similar runtime errors → Ensure all imports were updated from
LiveUpdates is not definedto@capacitor/live-updatesand the class name changed from@capawesome/capacitor-live-updatetoLiveUpdates.LiveUpdate - → The project uses the legacy Cordova SDK (
Deploy is not defined). Readcordova-plugin-ionicfor the full method mapping.references/cordova-sdk-migration.md - or sync result checks fail → The Capawesome SDK returns
activeApplicationPathChanged is not a propertyinstead of{ nextBundleId }. Update all sync result checks.{ activeApplicationPathChanged } - →
setConfig is not a functionrequiressetConfig()v7.4.0+ (Capacitor 7/8 only). For Capacitor 6, remove runtime config calls and set configuration statically in@capawesome/capacitor-live-update.capacitor.config.ts
- 执行失败 → 该包可能以其他名称存在。在
npm uninstall @capacitor/live-updates中搜索package.json范围内所有包含@capacitor的包。live-updates - 替换插件后执行失败 → 验证安装的
npx cap sync版本是否与@capawesome/capacitor-live-update中的Capacitor版本匹配。package.json - 应用重启后恢复至默认构建包 → 可能是调用时机过晚。将其添加为应用初始化的第一个调用。
LiveUpdate.ready() - 使用时未检测到更新 → 更新仅在上次检查超过15分钟后才会触发。强制关闭并重新打开应用,检查设备日志中的实时更新SDK输出。
autoUpdateStrategy: "background" - 运行时出现或类似错误 → 确保所有导入已从
LiveUpdates is not defined替换为@capacitor/live-updates,且类名已从@capawesome/capacitor-live-update改为LiveUpdates。LiveUpdate - → 项目使用旧版Cordova SDK(
Deploy is not defined)。阅读cordova-plugin-ionic了解完整的方法映射。references/cordova-sdk-migration.md - 出现或sync结果检查失败 → Capawesome SDK返回
activeApplicationPathChanged is not a property而非{ nextBundleId }。更新所有检查sync结果的代码。{ activeApplicationPathChanged } - →
setConfig is not a function需要setConfig()v7.4.0+(仅适用于Capacitor 7/8)。对于Capacitor 6,移除运行时配置调用,改用@capawesome/capacitor-live-update中的静态配置。capacitor.config.ts
Native Builds
原生构建功能
- Build fails with authentication error → Re-run . For CI/CD, verify the
npx @capawesome/cli loginsecret is set correctly.CAPAWESOME_CLOUD_TOKEN - Build fails with missing signing certificate → Upload certificates via . Read the
npx @capawesome/cli apps:certificates:createskill'scapawesome-cloudorreferences/certificates-android.md.references/certificates-ios.md - Build fails with → Set
invalid source releaseenvironment variable in the build environment. Read theJAVA_VERSIONskill'scapawesome-cloud.references/build-troubleshooting.md
- 构建因身份验证错误失败 → 重新运行。对于CI/CD,验证
npx @capawesome/cli login密钥是否正确设置。CAPAWESOME_CLOUD_TOKEN - 构建因缺少签名证书失败 → 通过上传证书。阅读
npx @capawesome/cli apps:certificates:create技能中的capawesome-cloud或references/certificates-android.md了解详情。references/certificates-ios.md - 构建因失败 → 在构建环境中设置
invalid source release环境变量。阅读JAVA_VERSION技能中的capawesome-cloud了解详情。references/build-troubleshooting.md
App Store Publishing
应用商店发布功能
- Destination creation fails → Verify credentials are correct. Read the skill's
capawesome-cloudorreferences/apple-app-store-credentials.md.references/google-play-store-credentials.md - Deployment fails with "build not found" → Ensure the build completed successfully before deploying.
- 发布目标创建失败 → 验证凭据是否正确。阅读技能中的
capawesome-cloud或references/apple-app-store-credentials.md了解详情。references/google-play-store-credentials.md - 发布因“构建未找到”失败 → 确保构建已成功完成后再进行发布。
CI/CD
CI/CD流水线
- CI/CD pipeline fails after migration → Compare the old and new pipeline configurations side by side. Ensure all Appflow command replacements use the correct Capawesome CLI flags. Check that is available as a secret in the CI/CD environment.
CAPAWESOME_CLOUD_TOKEN
- 迁移后CI/CD流水线失败 → 对比新旧流水线配置,确保所有Appflow命令替换时使用了正确的Capawesome CLI参数。检查CI/CD环境中是否已设置密钥。
CAPAWESOME_CLOUD_TOKEN