跳过内容

概述

Capgo的Live Updates功能允许您实时更新应用程序的JavaScript包。您可以直接将JS更新推送给用户,无需通过应用商店审查流程即可立即修复bug并发布新功能。

Capgo的__CAPGO_KEEP_1__,您需要在应用程序中安装。__CAPGO_KEEP_2__负责检查可用更新并在后台下载它们。

  1. The Capgo SDK, which you install in your app. The SDK checks for available updates and downloads them in the background.

  2. Production, Staging__CAPGO_KEEP_1__ Dev.

当您上传一个新的 JS 包到 Capgo 并将其分配到一个频道时,Capgo SDK 在为该频道配置的应用中会检测到更新并下载它。下一次应用重启时,新的包将被加载。

要开始使用实时更新,请遵循以下步骤:

  1. 完成 Capgo 快速入门 以 Capgo 和安装 Capgo SDK

  2. 在您的应用 code 中调用 CapacitorUpdater.notifyAppReady() 在应用初始化完成后,在您的应用中调用此函数。这个函数告诉 Capgo SDK 应用已经准备好接收更新。

  3. 构建您的 JS 包并将其上传到 Capgo:

    终端窗口
    npm run build
    npx @capgo/cli@latest bundle upload --channel=production
  4. 打开你的应用并等待更新下载。您可以使用以下命令检查状态:

    终端窗口
    npx @capgo/cli@latest app debug
  5. 下载更新后,请关闭并重新打开你的应用以加载新包。

查看 了解更多关于 实时更新部署

The Capgo CLI is a powerful tool that allows developers to interact with Capgo’s services from their own CI/CD pipelines. With the CLI, you have granular control over when builds are produced and deployed, enabling you to integrate Capgo into your existing enterprise workflows.

The Capgo CLI is designed for developers and teams who need more control and flexibility in their live update workflows. By using the CLI in your CI/CD pipelines, you can:

  • 决定何时构建和部署更新,而不是依赖于Capgo的内置自动化
  • 在构建和部署步骤之间插入自己的过程,例如code签名、QA测试或经理批准
  • 将Capgo集成到您的现有DevOps工具和工作流程中

要使用Capgo CLI,您需要使用您的API密钥进行身份验证。您可以在Capgo帐户设置中生成一个API密钥。

要登录并安全存储您的API密钥,请运行:

终端窗口
npx @capgo/cli@latest login [API_KEY]

此命令将在下次使用时保存。您不需要在登录后为每个命令提供API密钥。

与其他CLI工具相比的关键区别

Section titled “与其他CLI工具的关键区别”

如果您熟悉其他实时更新CLI工具,了解一下Capgo的CLI的几个关键点:

  • Capgo使用单个CLI,适用于开发和CI/CD场景,因为Capgo专注于实时更新功能集。

  • Capgo的CLI不需要单独的安装步骤。它与包一起打包,可以直接使用 @capgo/cli __CAPGO_KEEP_0__的__CAPGO_KEEP_1__专门设计用于实时更新工作流,因此可能不包括一般用途__CAPGO_KEEP_2__工具中发现的某些功能或命令。 npx.

  • Capgo’s CLI is designed specifically for the live update workflow, so it may not include some features or commands found in more general-purpose CLI tools.

Section titled “下一步”

频道