@capawesome/capver

中文文档
0.1.5发布于 2026/07/14MITES Module构建来源已验证近 30 天下载 7792

CLI for managing versions in a Capacitor project across multiple platforms.

原始使用文档
文档目录20 节
  1. Features
  2. Installation
  3. Configuration
  4. Pattern
  5. Usage
  6. Commands
  7. get
  8. set
  9. major
  10. minor
  11. patch
  12. hotfix
  13. sync
  14. doctor
  15. Help
  16. Integrations
  17. Commit and Tag Version
  18. Development
  19. Changelog
  20. License

capver

npm version npm downloads license

CLI for managing versions in a Capacitor project across multiple platforms.

Features

  • 📱 Capacitor-native: Designed specifically for Capacitor projects and workflows.
  • 🤖 Android: Full Android platform support with build.gradle integration.
  • 🍎 iOS: Complete iOS platform support with Xcode project integration.
  • 🌐 Web: Complete web platform support with package.json integration.
  • 🖥️ Electron: Full Electron platform support with electron/package.json integration.
  • ⬆️ Automatic increase: Easily increment major, minor, patch, and hotfix versions.
  • 🔧 Hotfixes: Support for hotfix versioning on mobile platforms.
  • ⚙️ Configurable patterns: Customize build number patterns to fit your project needs.
  • 🩺 Health checks: Verify version consistency across platforms with built-in diagnostics.
  • 🎯 Easy usage: Simple commands with intuitive CLI interface.
  • ✅ Fully tested: Comprehensive test coverage for reliable operation.

Installation

The CLI can be installed globally via npm:

npm install -g @capawesome/capver

Configuration

You can customize the behavior of the CLI by adding a capver section to your package.json.

Pattern

The pattern field allows you to define the format of your build numbers. Here is an example configuration:

{
  "name": "my-app",
  "version": "1.2.3",
  "capver": {
    "pattern": "MMmmmpphh"
  }
}

Pattern format:

  • M = Major version digit (variable length)
  • m = Minor version digit (fixed length)
  • p = Patch version digit (fixed length)
  • h = Hotfix version digit (optional)

Common patterns:

  • MMmmmpphh (default) - Supports up to 999 minor, 99 patch, 99 hotfix
  • MMmmmppph - Extended patch support (up to 999)
  • MMmmpp - No hotfix support

[!WARNING] Android's versionCode is a positive integer with a maximum value of 2,147,483,647. With the default MMmmmpphh pattern, this limit is reached at major version 215 (e.g., 215.0.0 would produce a versionCode of 2150000000). If your project is likely to reach high major version numbers (e.g., through automated conventional commit versioning), consider using a shorter pattern like MMmmmpp to raise this ceiling.

Usage

The CLI can be invoked with the @capawesome/capver command.

npx @capawesome/capver <command> [options]
# Initialize a new Capacitor project with version 0.0.1
npx @capawesome/capver set 0.0.1

# Increment the patch version
npx @capawesome/capver patch

# Increment the minor version
npx @capawesome/capver minor

# Increment the major version
npx @capawesome/capver major

# Increment only the build number
npx @capawesome/capver hotfix

# Check version consistency across platforms
npx @capawesome/capver get

# Synchronize all platforms to use the highest version found
npx @capawesome/capver sync

Commands

get

Get the version of the app from all relevant files.

npx @capawesome/capver get

This command displays the current version across all platforms and verifies they are synchronized.

set

Set the version of the app in all relevant files.

npx @capawesome/capver set <version>

Arguments:

  • version - Version in format major.minor.patch (e.g., 1.2.3)

major

Increment the major version of the app in all relevant files.

npx @capawesome/capver major

Increments the major version number (e.g., 1.2.3 → 2.0.0).

minor

Increment the minor version of the app in all relevant files.

npx @capawesome/capver minor

Increments the minor version number (e.g., 1.2.3 → 1.3.0). Maximum value depends on your configured pattern.

patch

Increment the patch version of the app in all relevant files.

npx @capawesome/capver patch

Increments the patch version number (e.g., 1.2.3 → 1.2.4). Maximum value depends on your configured pattern.

hotfix

Increment the hotfix version of the app in all relevant files.

npx @capawesome/capver hotfix

Increments the hotfix version for mobile platforms (iOS/Android only). Maximum value depends on your configured pattern.

sync

Set the highest version number among all platforms in all relevant files.

npx @capawesome/capver sync

Synchronizes all platforms to use the highest version found across any platform.

doctor

Prints out necessary information for debugging.

npx @capawesome/capver doctor

Displays system information including Node.js, NPM, CLI version, and OS details.

Help

The CLI ships with command documentation that is accessible with the --help flag.

npx @capawesome/capver --help

Integrations

Commit and Tag Version

The commit-and-tag-version package offers automatic versioning, changelog generation, and Git tagging using conventional commits. You can integrate it with the @capawesome/capver CLI for a seamless versioning experience. Just add the following configuration to your package.json:

{
    "version": "0.0.1",
    "scripts": {
        "release": "commit-and-tag-version --commit-all"
    },
    "commit-and-tag-version": {
        "scripts": {
            "postbump": "npx @capawesome/capver set $(node -p \"require('./package.json').version\") && git add android/app/build.gradle ios/App/App/Info.plist"
        }
    }
}

This configuration ensures that the version is automatically updated in all relevant files whenever a new version is released. Just run npm run release to automatically bump the version, update all relevant files, and commit the changes.

Development

Run the following commands to get started with development:

  1. Clone the repository:

    git clone https://github.com/capawesome-team/capver.git
    
  2. Install dependencies:

    npm install
    
  3. Run your first command:

    npm start -- --help
    

    Note: The -- is required to pass arguments to the script.

Changelog

See CHANGELOG.

License

See LICENSE.

版本与发布记录

@capawesome/capver 共发布 11 个版本,首次发布于 2025/09/02;过去 12 个月发布了 5 个版本。最新版本附带 npm provenance 构建来源证明,可追溯到公开的 CI 构建记录。

版本发布日期距今
0.1.5latest2026/07/143 个月前
0.1.42026/05/165 个月前
0.1.32026/05/066 个月前
0.1.22026/04/027 个月前
0.1.12026/03/098 个月前
0.1.02025/09/201.1 年前

其他发布通道:dev → 0.0.4-dev.a152672.1758123919。

关于 @capawesome/capver 的常见问题

@capawesome/capver 是什么?

CLI for managing versions in a Capacitor project across multiple platforms.

如何安装 @capawesome/capver?

在项目目录运行 npm install @capawesome/capver,或使用 pnpm add / yarn add / bun add。它还提供命令行工具 capver,可以用 npx capver 直接运行。

@capawesome/capver 支持 TypeScript 吗?

该包的 package.json 没有声明类型入口。需要类型提示时,可以在 npm 上查找社区维护的 @types/capawesome__capver 是否存在。

@capawesome/capver 支持 ESM 还是 CommonJS?

以 ES Module 形式发布,推荐使用 import 引入。在 CommonJS 项目中,Node.js 20.19+ / 22.12+ 可以直接 require() 不含顶层 await 的 ES Module,更早的版本需要改用动态 import()。

@capawesome/capver 需要什么版本的 Node.js?

package.json 的 engines 字段要求 Node.js >=18.0.0。版本不符时 npm 默认只给出警告,开启 engine-strict 后会拒绝安装。

@capawesome/capver 可以商用吗?

@capawesome/capver 使用 MIT 许可。宽松许可:允许商业使用、修改和再分发,通常只需在分发时保留原版权与许可声明。以上为概括,不构成法律意见,请以许可原文为准。

@capawesome/capver 的下载量有多少?

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

@capawesome/capver 还在维护吗?

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