跳过内容

从V2到V3

This documentation will explain how to upgrade to the version 3 of auto-update.

Terminal window
npm remove -g capgo
npm remove capacitor-updater
npm i @capgo/cli
npm i @capgo/capacitor-updater@3
npx cap sync
{
CapacitorUpdater: {
autoUpdateURL: "https...",
...
},
}

to only let this:

{
"CapacitorUpdater": {
"autoUpdate": true
}
}

⚠️ 如果您使用的是您的服务器, autoUpdateURL我会尽快为您升级这份指南。目前,请查看新的上传选项 external 允许您只发送您的zip链接,而不是将code上传到Capgo云中。这是为遵守严格隐私政策的公司而设计的。在外部模式下,code将永远不会在Capgo服务器上存储,我们只会存储URL并将其发送到设备,设备将直接下载它。在标准方式下,code会被压缩并存储在我们的服务器上,但我们不会打开或使用它。

所有配置都变为服务器端的自动更新,给您更大的控制权来决定如何向用户发送更新。

这使我们能够回滚,甚至只向一个用户部署!这些设置已添加回Web界面:

  • 禁用原生回滚
  • 禁用重大更新

⚠️它们将在所有通道中默认为真

This will also remove the need to update often the plugin, most updates will be done server side, and you will get it without any change in your side.

⚠️ When an update becomes the default, reset so if you prefer not to remove all download versions when updating from the store, do this:

{
"CapacitorUpdater": {
"autoUpdate": true,
"resetWhenUpdate": false
}
}

最后,更新所有您的JS文件中的导入语句从:

import { CapacitorUpdater } from 'capacitor-updater'

import { CapacitorUpdater } from '@capgo/capacitor-updater'

然后重新构建您的 code npm run build 并复制资产一次 npx cap copy.

您现在应该能够测试最后的自动更新系统

使用以下命令发送您的版本:

npx @capgo/cli@latest bundle upload

而不是

npx capgo upload

目前只有第一个公共频道在使用中,未来公共频道将会变为多个公共频道,如果设置了多个,则会发生变化。

  • 升级后构建问题:如果您已经在Android Studio或Xcode中打开了插件的源代码code,有时同步不会删除它们,这是问题的原因。请打开本机IDE并手动删除 capacitor-updater 手动删除并 npx cap sync 这应该解决问题。

从 V2 到 V3 继续前进

从 V2 到 V3 继续前进

如果您正在使用 从 V2 到 V3 为了计划实时更新的交付,请将其与 Capgo 实时更新 为产品工作流程在 Capgo 实时更新中 概览 概览的实现细节 功能 功能的实现细节 更新行为 为更新行为的实现细节,和 更新类型 为更新类型的实现细节。