Delta更新
复制一个包含安装步骤和本插件的完整 Markdown 指南的设置提示。
Capgo的实时更新系统可以通过仅发送更改的文件而不是整个 JS 包来更快、更高效地交付更新。
这尤其有利于使用较慢或计量网络连接的用户,因为它最小化了需要下载的数据量。
A second benefit is when the app has large assets that change rarely, like images or videos, compared to zipped JS files, it will be downloaded only once.
如何Delta(Manifest)更新工作
标题:如何Delta(Manifest)更新工作Delta (manifest) updates in Capgo are handled by the Capgo plugin installed in your app. When you upload a new version of your app using the --delta flag, Capgo does the following:
- 每个文件的校验和
- 创建一个新的JSON清单,列出所有文件及其校验和
- 将此清单上传到Capgo数据库
- This manifest is uploaded to the Capgo database
When a device running your app checks for an update, the Capgo plugin receives the new manifest from the server. It compares this manifest to the one it currently has, identifying which files have changed based on the checksums and file paths.
清单
启用Delta(Manifest)更新
启用Delta(Manifest)更新要为您的Capgo应用启用Delta(manifest)更新,请简单地使用以下标志上传新版本: --delta 终端窗口
npx @capgo/cli@latest bundle upload --delta设置为即时应用模式( autoUpdate ,或"atInstall", "onLaunch") "always"在您的 capacitor.config,CLI检测到它。在非交互环境中,它会自动发送Delta(清单)更新,在交互环境中,它会在上传之前提示您确认。Legacy directUpdate 仍然检测到配置。使用 --no-delta 强制上传完整的捆绑包。
Delta更新限制
标题:Delta更新限制- 空文件: CLI日志
Ignoring empty file...并排除零字节文件从Delta清单。它不会停止上传,因此添加空文件可以更改结果捆绑包而不停止部署。请勿在Delta捆绑包路径中包含零字节文件。 - 路径中的空格: Delta上传在上传文件之前会失败,捆绑包路径包含空格。重命名文件或目录以删除空格,然后上传Delta更新。
强制Delta(清单)更新
标题:强制Delta(清单)更新如果您想确保所有上传都是Delta(清单)更新,并防止任何意外的全包上传,请使用 --delta-only 标志:
npx @capgo/cli@latest bundle upload --delta-only当 --delta-only 使用时,Capgo 将只上传单个文件并生成清单。任何不支持Delta(清单)更新的设备都无法下载更新。
您可能想使用 --delta-only 如果:
- 您总是想使用Delta(清单)更新,并且不想允许全包上传
- 您正在设置CI/CD管道,并且想确保所有自动上传都是Delta(清单)
- 您的应用程序很大,带宽受限,因此需要最小化上传/下载大小
如果您需要进行全包上传 --delta-only 请设置后,只需运行上传命令而无需 --delta-only。这样会覆盖该单次上传的设置,允许您在需要时推送完整的捆绑包。
故障排除
故障排除如果Delta(清单)更新似乎不起作用(即,即使是小的更改,设备也始终下载完整的JS捆绑包),请检查以下内容:
- 您正在使用
--delta标志每次上传新版本时 - 如果使用
--delta-only请确保您没有意外遗漏--delta标志 - 您的设备正在运行最新版本的Capgo插件
- 您的设备具有稳定的网络连接并可以访问Capgo服务器
您也可以使用Capgo web应用程序来检查您的上次上传的详细信息:
- 前往 web应用程序
- 点击您的应用
- 点击统计条中的包数量
- 选择最后一个包
- 检查
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更新如果您正在使用 Delta更新 连接到 Capgo Live Updates 为Capgo Live Updates产品工作流 概述 概述 功能 为 Features 中的实现细节 更新行为 为 Update Behavior 中的实现细节,并且 更新类型 编辑页面