@capgo/cordova-updater

中文文档
8.2.12发布于 2026/11/02MPL-2.0TypeScriptESM + CJS零依赖构建来源已验证近 30 天下载 1869

Capgo 的 Live 更新 Cordova 插件

中文使用文档
文档目录11 节
  1. QQ 与 Capgo 为您的 App 即时更新
  2. 为什么是Cordova更新器?
  3. 文档
  4. 兼容性
  5. 安装
  6. 插件变量
  7. 使用量
  8. 网络视频要求
  9. 发展
  10. 示例应用程序
  11. 许可证

@capgo/cordova-updater (英语)

Capgo - Cordova Updater - Instant updates for Cordova

Discord

npm GitHub latest commit https://good-labs.github.io/greater-good-affirmation/assets/images/badge.svg Security Rating Bugs Maintainability Rating Code Smells Vulnerabilities Quality Gate Status Technical Debt Open Bounties Rewarded Bounties

用于 Cordova 插件 队长 实时更新(OTA). Ship JavaScript,HTML,以及CSS更新到Cordova Android和iOS应用,无需等待应用商店审查.

已经使用 @capgo/capacitor-updater? 吗? 这个插件映射出相同的JavaScript API,并使用相同的Capgo Cloud后端,通道,和捆绑签名模型——为Cordova所改编.

为什么是Cordova更新器?

Cordova apps在商店发行之间仍然需要快速网络资产交付. @capgo/cordova-updater 把Capgo的回滚安全OTA模型带到了Cordova,而不首先迁移到Capacitor.

  • 相同的 API - 打电话 notifyAppReady(), (中文(简体) ), download(), (中文(简体) ), next(),通道 API,和与表层相同的统计钩 @capgo/capacitor-updater
  • 本地计划支持 – Hooks Cordova的路径和计划处理器,因此下载了捆绑来取代现代Cordova Android和iOS上的WebView内容
  • Capgo 云准备好了 上传捆绑 @capgo/cli,按频道推出,并从您用于 Capacitor apps 的同一仪表板上监测领养情况
  • 后退保护 ——自动还原已破损的更新以保持应用程序的稳定
  • 三角洲更新 — 只下载更改后的文件以更快更新
  • 开源 ——自宿或自用 笼罩云,可以完全控制您的更新基础设施

适合立即修复bugs,A/B测试功能,并维持对遗留的 Cordova 堆栈的释放时间表的控制.

文档

这里有最完整的医生: https://capgo.app/docs/plugins/cordova-updater/ (中文(简体) )

兼容性

平台最小版本
科多瓦语Name12岁以上
科多娃·安卓尔13岁以上
科尔多瓦iOS7个+

说明: JavaScript API 镜像 @capgo/capacitor-updater。Web不支持——桌面/电子应用程序应当使用 @capgo/electron-updater。 。 。 .

安装

cordova plugin add @capgo/cordova-updater --variable APP_ID=<your-capgo-app-id>

插件变量

变量默认说明
APP_ID(空虚)Capgo 应用程序标识
DEFAULT_CHANNEL(空虚)默认更新通道
UPDATE_URLhttps://plugin.capgo.app/updates更新检查终点
CHANNEL_URLhttps://plugin.capgo.app/channel_self频道 API 端点
STATS_URLhttps://plugin.capgo.app/stats状态终点
AUTO_UPDATEatBackground自动更新模式
PUBLIC_KEY(空虚)签名捆绑的 RSA 公钥
APP_READY_TIMEOUT10000回滚超时( 毫秒)

见 plugin.xml 用于完整首选项列表(与 Capacitor 更新器相匹配).

使用量

插件会曝光 cordova.plugins.Updater 之后 deviceready数字 :

document.addEventListener('deviceready', async () => {
  const { Updater } = cordova.plugins;

  await Updater.notifyAppReady();

  const { bundles } = await Updater.list();
  console.log('Downloaded bundles', bundles);

  const { bundle } = await Updater.current();
  console.log('Current bundle', bundle);
});

有 npm 包件的 Script 类型船 :

import type { UpdaterPlugin } from '@capgo/cordova-updater';

declare const cordova: { plugins: { Updater: UpdaterPlugin } };

网络视频要求

Cordova Android 13和iOS 7通过自定义计划为WebView服务(https://localhost/ 财务报告和审定财务报表 app://localhost/) (中文(简体) ). 插件钩子 CordovaPluginPathHandler (机器人)和 CDVPluginSchemeHandler (iOS)服务下载的捆绑.

执行 没有 使用情况 cordova-plugin-ionic-webview ——绕过克多瓦的计策处理器和OTA捆绑将不适用.

发展

bun install
bun run build
bun run verify          # Android tests + iOS compile + TypeScript build
bun run native:contract # Native contract tests (shared with capacitor-updater)

示例应用程序

bun run build
cd example-app
npm install
npx cordova build android   # or cordova build ios

示例将插件与 repo 根连接(spec=".." 内 config.xml. Cordova 注射剂 cordova.plugins.Updater 通过 plugin.xml —— 不需要手动脚本标记 www/index.html。 。 。 .

大师E2E流生活在 .maestro/ (从 capacitor-updater; 调整 scripts/maestro/* 一旦在设备/模拟器上运行示例.

许可证

MPL - 2.0 导弹

版本与发布记录

@capgo/cordova-updater 共发布 17 个版本,首次发布于 2026/09/23;过去 12 个月发布了 17 个版本。最新版本附带 npm provenance 构建来源证明,可追溯到公开的 CI 构建记录。

版本发布日期距今
8.2.12latest2026/11/027 天前
8.2.112026/11/027 天前
8.2.102026/10/1921 天前
8.2.92026/10/1525 天前
8.2.82026/10/1228 天前
8.2.72026/10/1129 天前

关于 @capgo/cordova-updater 的常见问题

@capgo/cordova-updater 是什么?

Capgo 的 Live 更新 Cordova 插件

如何安装 @capgo/cordova-updater?

在项目目录运行 npm install @capgo/cordova-updater,或使用 pnpm add / yarn add / bun add。

@capgo/cordova-updater 支持 TypeScript 吗?

支持。包内自带 TypeScript 类型声明(package.json 声明了 types 入口),安装后即可获得类型提示,无需再安装 @types 包。

@capgo/cordova-updater 支持 ESM 还是 CommonJS?

同时提供 ES Module 与 CommonJS 入口,import 和 require() 都可以使用,打包工具会自动选择合适的版本。

@capgo/cordova-updater 可以商用吗?

@capgo/cordova-updater 使用 MPL-2.0 许可。弱 Copyleft:可以商用,也可以和闭源代码一起使用;但如果分发时修改了 MPL 授权的文件,这些文件的修改需以 MPL 开源。以上为概括,不构成法律意见,请以许可原文为准。

@capgo/cordova-updater 的下载量有多少?

根据 npm 官方下载统计,@capgo/cordova-updater 在 2026/10/09 – 2026/11/07 这 30 天内被下载 1,869 次,日均约 62 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@capgo/cordova-updater 还在维护吗?

最新版本 8.2.12 发布于 2026/11/02(7 天前);至今共发布 17 个版本,其中过去 12 个月发布了 17 个;首次发布于 2026/09/23。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。