跳过内容

Delta更新

Capgo’s Live Update system can deliver updates faster and more efficiently by only sending the changed files, rather than the entire JS bundle.

复制给AI使用的提示信息

应用大型资产(如图片或视频)时,仅当这些资产发生较少变化时,会带来第二个好处。与压缩的JS文件相比,这些资产只会在第一次下载后再次下载。

如何Delta(清单)更新工作

如何Delta(清单)更新工作

Delta(manifest)更新在Capgo中由您应用中安装的Capgo插件处理。您使用Capgo上传应用新版本时, --delta 标志,Capgo 的作用是:

  1. 每个构建文件都单独上传
  2. 每个文件都生成校验和
  3. 在 Capgo 中,会创建一个新的 JSON 清单,列出所有文件及其校验和
  4. 此清单会上传到Capgo数据库。

当设备运行您的应用程序时,检查更新时,Capgo 插件会从服务器接收新的清单。它将此清单与当前的清单进行比较,根据校验和和文件路径确定哪些文件已更改。

该插件然后只下载改变的文件,而不是整个JS包。它通过将下载的文件与已经有的未改变的文件结合起来,重建了应用程序的新版本。

启用 Delta (Manifest) 更新

启用 Delta (Manifest) 更新

要为您的Capgo应用启用 Delta (manifest) 更新,请简单地使用以下标志上传新版本: --delta 终端窗口

复制到剪贴板
npx @capgo/cli@latest bundle upload --delta

设置为立即应用模式( autoUpdate"atInstall", "onLaunch"在您的 "always"__CAPGO_KEEP_0__ capacitor.config,CLI检测到它。在非交互环境中,它会自动发送Delta(清单)更新,在交互环境中,它会在上传之前提示您确认。Legacy directUpdate 仍然检测到配置。使用 --no-delta 强制进行全量包上传。

  • 空文件: CLI日志 Ignoring empty file... 并排除零字节文件从Delta清单。它不会停止上传,因此添加一个空文件可以改变结果包而不停止您的部署。请勿在Delta包路径中包含零字节文件。
  • 路径中的空格: Delta上传在包路径包含空格之前会失败。重命名文件或目录以移除空格,然后上传Delta更新。

强制Delta(清单)更新

标题:强制Delta(清单)更新

If you want to ensure that all uploads are Delta (manifest) updates and prevent any accidental full bundle uploads, you can use the --delta-only flag:

Terminal window
npx @capgo/cli@latest bundle upload --delta-only

When --delta-only used, Capgo will only upload individual files and generate a manifest. Any device that does not support Delta (manifest) updates will not be able to download the update.

You might want to use --delta-only if:

  • You always want to use Delta (manifest) updates and never want to allow full bundle uploads
  • You’re setting up a CI/CD pipeline and want to ensure all automated uploads are Delta (manifest)
  • Your app is large and bandwidth is constrained, so you need to minimize upload/download sizes

If you need to do a full bundle upload while --delta-only 请确保已设置此项,仅需运行上传命令即可 --delta-only这将覆盖单次上传的设置,允许您在需要时推送完整的包

故障排除

故障排除

如果Delta(清单)更新似乎不起作用(即设备始终下载完整的JS包,即使有小变化),请检查以下内容:

  • 您是否使用了 --delta 每次上传新版本时都要使用
  • 如果使用 --delta-only请确保没有遗漏 --delta 标志
  • Your device is running the latest version of the Capgo plugin
  • Your device has a stable network connection and can reach the Capgo servers

您也可以使用 Capgo 网页应用程序来检查您的上次上传的详细信息:

  1. 前往 网页应用程序
  2. 点击您的应用程序
  3. 点击统计条中的包数量。
  4. 选择最后一个包
  5. 检查 Partial 字段 包类型

如果您继续遇到问题,请联系 Capgo 支持以获取进一步的帮助。他们可以检查服务器日志以确认您的Delta(清单)上传正在正确处理,并且设备正在接收更新的清单。

就这样!该标志告诉 __CAPGO_KEEP_0__ 执行Delta(清单)更新所需的单个文件上传和清单生成。 --delta 您可以使用 Capgo 网页应用程序来检查您的上次上传的详细信息:

请注意,您需要使用 --delta every time you upload a new version that you want to be delivered as a Delta (manifest) update. If you omit the flag, Capgo will upload the entire JS bundle as a single file, and devices will download the whole bundle even if only a small part has changed.

继续使用Delta更新

继续使用Delta更新

使用 context: 企业产品/价格页面。角色:短UI标签或导航项。见于:企业产品页面 连接到 Capgo Live Updates for the product workflow in Capgo Live Updates, 概览 概览 功能 为Features中的实现细节 更新行为 为更新行为中的实现细节,并且 更新类型 为更新类型中的实现细节。