@capgo/cordova-updater

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

Live update Cordova plugin for Capgo

原始使用文档
文档目录11 节
  1. ➡️ Get Instant updates for your App with Capgo
  2. Why Cordova Updater?
  3. Documentation
  4. Compatibility
  5. Install
  6. Plugin variables
  7. Usage
  8. WebView requirements
  9. Development
  10. Example app
  11. License

@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 plugin for Capgo live updates (OTA). Ship JavaScript, HTML, and CSS updates to Cordova Android and iOS apps without waiting on app store review.

Already using @capgo/capacitor-updater? This plugin mirrors the same JavaScript API and uses the same Capgo Cloud backend, channels, and bundle signing model — adapted for Cordova.

Why Cordova Updater?

Cordova apps still need fast web asset delivery between store releases. @capgo/cordova-updater brings Capgo's rollback-safe OTA model to Cordova without migrating to Capacitor first.

  • Same API — Call notifyAppReady(), download(), next(), channel APIs, and stats hooks with the same surface as @capgo/capacitor-updater
  • Native scheme support — Hooks Cordova's path and scheme handlers so downloaded bundles replace WebView content on modern Cordova Android and iOS
  • Capgo Cloud ready — Upload bundles with @capgo/cli, roll out by channel, and monitor adoption from the same dashboard you use for Capacitor apps
  • Rollback protection — Automatically revert broken updates to keep your app stable
  • Delta updates — Only download changed files for faster updates
  • Open source — Self-host or use Capgo Cloud, with full control over your update infrastructure

Perfect for fixing bugs immediately, A/B testing features, and maintaining control over your release schedule on legacy Cordova stacks.

Documentation

The most complete doc is available here: https://capgo.app/docs/plugins/cordova-updater/

Compatibility

PlatformMinimum version
Cordova12+
Cordova Android13+
Cordova iOS7+

Note: The JavaScript API mirrors @capgo/capacitor-updater. Web is not supported — desktop/Electron apps should use @capgo/electron-updater.

Install

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

Plugin variables

VariableDefaultDescription
APP_ID(empty)Capgo app ID
DEFAULT_CHANNEL(empty)Default update channel
UPDATE_URLhttps://plugin.capgo.app/updatesUpdate check endpoint
CHANNEL_URLhttps://plugin.capgo.app/channel_selfChannel API endpoint
STATS_URLhttps://plugin.capgo.app/statsStats endpoint
AUTO_UPDATEatBackgroundAuto-update mode
PUBLIC_KEY(empty)RSA public key for signed bundles
APP_READY_TIMEOUT10000Rollback timeout (ms)

See plugin.xml for the full list of preferences (aligned with the Capacitor updater).

Usage

The plugin exposes cordova.plugins.Updater after 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);
});

TypeScript types ship with the npm package:

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

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

WebView requirements

Cordova Android ≥13 and iOS ≥7 serve the WebView via custom schemes (https://localhost/ and app://localhost/). The plugin hooks CordovaPluginPathHandler (Android) and CDVPluginSchemeHandler (iOS) to serve downloaded bundles.

Do not use cordova-plugin-ionic-webview — it bypasses Cordova's scheme handlers and OTA bundles will not apply.

Development

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)

Example app

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

The example links the plugin from the repo root (spec=".." in config.xml). Cordova injects cordova.plugins.Updater via plugin.xml — no manual script tag needed in www/index.html.

Maestro E2E flows live under .maestro/ (copied from capacitor-updater; adapt scripts/maestro/* once you run the example on device/simulator).

License

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 是什么?

Live update Cordova plugin for Capgo

如何安装 @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 和提交记录判断。