📦 bundle
📦 管理用于在 Capgo Cloud 中部署的应用 bundle,包括上传、兼容性检查和加密。
⬆️ Upload
Section titled “ ⬆️ Upload”别名: u
npx @capgo/cli@latest bundle upload⬆️ 上传新的应用 bundle 到 Capgo Cloud 进行分发。 版本必须 > 0.0.0 且唯一。出于安全考虑,已删除的版本不能重复使用。 外部选项:仅存储 URL 链接(适用于大于 200MB 的应用或隐私要求)。 Capgo 从不检查外部内容。添加加密以实现无信任安全。
示例:
npx @capgo/cli@latest bundle upload com.example.app --path ./dist --channel production选项:
| Param | Type | Description |
|---|---|---|
| -a, | string | 用于链接到您账户的 API 密钥 |
| -p, | string | 要上传的文件夹路径,如果未提供,将使用 capacitor.config 中设置的 webDir |
| -c, | string | 要链接的频道 |
| -e, | string | 链接到外部 URL 而不是上传到 Capgo Cloud |
| —iv-session-key | string | 为外部 bundle URL 设置 IV 和会话密钥 |
| —s3-region | string | S3 存储桶的区域 |
| —s3-apikey | string | S3 端点的 API 密钥 |
| —s3-apisecret | string | S3 端点的 API 密钥 |
| —s3-endpoint | string | S3 端点的 URL |
| —s3-bucket-name | string | AWS S3 存储桶的名称 |
| —s3-port | string | S3 端点的端口 |
| —no-s3-ssl | boolean | 禁用 S3 上传的 SSL |
| —key-v2 | string | 私钥签名密钥的自定义路径(v2 系统) |
| —key-data-v2 | string | 私钥签名密钥(v2 系统) |
| —bundle-url | boolean | 将 bundle URL 打印到 stdout |
| —no-key | boolean | 忽略签名密钥并发送明文更新 |
| —no-code-check | boolean | 忽略检查源代码中是否调用了 notifyAppReady() 以及根文件夹中是否存在索引 |
| —display-iv-session | boolean | 在控制台中显示用于加密更新的 IV 和会话密钥 |
| -b, | string | 要上传的 bundle 版本号 |
| —link | string | 链接到外部资源(例如 GitHub release) |
| —comment | string | 关于此版本的注释,可以是发行说明、提交哈希、提交消息等 |
| —min-update-version | string | 更新到此版本所需的最低版本。仅在频道中禁用自动更新设置为元数据时使用 |
| —auto-min-update-version | boolean | 根据原生包设置最小更新版本 |
| —ignore-metadata-check | boolean | 上传时忽略元数据(node_modules)检查 |
| —ignore-checksum-check | boolean | 上传时忽略校验和检查 |
| —timeout | string | 上传过程的超时时间(秒) |
| —multipart | boolean | [已弃用] 使用 —tus 代替。使用多部分协议进行 S3 上传 |
| —zip | boolean | 使用 zip 上传 bundle 到 Capgo cloud(旧版) |
| —tus | boolean | 使用 TUS 上传 bundle 到 Capgo cloud |
| —tus-chunk-size | string | TUS 可恢复上传的块大小(字节)(默认:自动) |
| —partial | boolean | [已弃用] 使用 —delta 代替。上传增量更新 |
| —partial-only | boolean | [已弃用] 使用 —delta-only 代替。仅上传增量更新,跳过完整 bundle |
| —delta | boolean | 上传增量/差异更新以减少带宽 |
| —delta-only | boolean | 仅上传增量更新而不上传完整 bundle(适用于大型应用) |
| —encrypted-checksum | string | 加密的校验和(签名)。仅在上传外部 bundle 时使用。 |
| —auto-set-bundle | boolean | 在 capacitor.config.json 中设置 bundle |
| —dry-upload | boolean | 干运行 bundle 上传过程,意味着它不会上传文件但会在数据库中添加行(由 Capgo 用于内部测试) |
| —package-json | string | monorepo 的 package.json 文件路径(逗号分隔) |
| —node-modules | string | monorepo 的 node_modules 目录路径(逗号分隔) |
| —encrypt-partial | boolean | 加密增量更新文件(对于 updater > 6.14.4 自动启用) |
| —delete-linked-bundle-on-upload | boolean | 定位您尝试上传到的频道中当前链接的 bundle 并删除它 |
| —no-brotli-patterns | string | 要从 Brotli 压缩中排除的文件(逗号分隔的 glob,例如 “.jpg,.png”) |
| —disable-brotli | boolean | 完全禁用 brotli 压缩,即使 updater 版本支持它 |
| —version-exists-ok | boolean | 如果 bundle 版本已存在,则成功退出,对于使用 monorepo 的 CI/CD 工作流很有用 |
| —self-assign | boolean | 允许设备自动加入此频道(更新频道设置) |
| —supa-host | string | 自定义 Supabase 主机 URL(用于自托管或 Capgo 开发) |
| —supa-anon | string | 自定义 Supabase anon 密钥(用于自托管) |
🧪 Compatibility
Section titled “ 🧪 Compatibility”npx @capgo/cli@latest bundle compatibility🧪 检查 bundle 与 Capgo Cloud 中特定频道的兼容性,以确保更新安全。
示例:
npx @capgo/cli@latest bundle compatibility com.example.app --channel production选项:
| Param | Type | Description |
|---|---|---|
| -a, | string | 用于链接到您账户的 API 密钥 |
| -c, | string | 要检查兼容性的频道 |
| —text | boolean | 输出文本而不是表情符号 |
| —package-json | string | monorepo 的 package.json 文件路径(逗号分隔) |
| —node-modules | string | monorepo 的 node_modules 目录路径(逗号分隔) |
| —supa-host | string | 自定义 Supabase 主机 URL(用于自托管或 Capgo 开发) |
| —supa-anon | string | 自定义 Supabase anon 密钥(用于自托管) |
🗑️ Delete
Section titled “ 🗑️ Delete”别名: d
npx @capgo/cli@latest bundle delete🗑️ 从 Capgo Cloud 删除特定 bundle,可选择针对单个版本。
示例:
npx @capgo/cli@latest bundle delete BUNDLE_ID com.example.app选项:
| Param | Type | Description |
|---|---|---|
| -a, | string | 用于链接到您账户的 API 密钥 |
| —supa-host | string | 自定义 Supabase 主机 URL(用于自托管或 Capgo 开发) |
| —supa-anon | string | 自定义 Supabase anon 密钥(用于自托管) |
📋 List
Section titled “ 📋 List”别名: l
npx @capgo/cli@latest bundle list📋 列出为 Capgo Cloud 中的应用上传的所有 bundle。
示例:
npx @capgo/cli@latest bundle list com.example.app选项:
| Param | Type | Description |
|---|---|---|
| -a, | string | 用于链接到您账户的 API 密钥 |
| —supa-host | string | 自定义 Supabase 主机 URL(用于自托管或 Capgo 开发) |
| —supa-anon | string | 自定义 Supabase anon 密钥(用于自托管) |
🧹 Cleanup
Section titled “ 🧹 Cleanup”别名: c
npx @capgo/cli@latest bundle cleanup🧹 删除 Capgo Cloud 中的旧 bundle,保留指定数量的最新版本。 除非使用 —ignore-channel,否则链接到频道的 bundle 将被保留。
示例:
npx @capgo/cli@latest bundle cleanup com.example.app --bundle=1.0 --keep=3选项:
| Param | Type | Description |
|---|---|---|
| -b, | string | 要删除的应用的 bundle 版本号 |
| -a, | string | 用于链接到您账户的 API 密钥 |
| -k, | string | 要保留的版本数量 |
| -f, | string | 强制删除 |
| —ignore-channel | boolean | 即使链接到频道也删除 bundle(警告:也会删除频道) |
| —supa-host | string | 自定义 Supabase 主机 URL(用于自托管或 Capgo 开发) |
| —supa-anon | string | 自定义 Supabase anon 密钥(用于自托管) |
🔒 Encrypt
Section titled “ 🔒 Encrypt”npx @capgo/cli@latest bundle encrypt🔒 加密 zip bundle 以进行安全的外部存储。 返回用于上传/解密的 ivSessionKey。使用 ‘bundle zip —json’ 获取校验和。
示例:
npx @capgo/cli@latest bundle encrypt ./myapp.zip CHECKSUM选项:
| Param | Type | Description |
|---|---|---|
| —key | string | 私钥签名密钥的自定义路径 |
| —key-data | string | 私钥签名密钥 |
| -j, | string | 以 JSON 格式输出 |
🔓 Decrypt
Section titled “ 🔓 Decrypt”npx @capgo/cli@latest bundle decrypt🔓 解密加密的 bundle(主要用于测试)。 打印 base64 会话密钥以进行验证。
示例:
npx @capgo/cli@latest bundle decrypt ./myapp_encrypted.zip CHECKSUM选项:
| Param | Type | Description |
|---|---|---|
| —key | string | 私钥签名密钥的自定义路径 |
| —key-data | string | 私钥签名密钥 |
| —checksum | string | bundle 的校验和,用于验证 bundle 的完整性 |
npx @capgo/cli@latest bundle zip🗜️ 创建应用 bundle 的 zip 文件。 返回用于加密的校验和。使用 —json 以获取机器可读输出。
示例:
npx @capgo/cli@latest bundle zip com.example.app --path ./dist选项:
| Param | Type | Description |
|---|---|---|
| -p, | string | 要上传的文件夹路径,如果未提供,将使用 capacitor.config 中设置的 webDir |
| -b, | string | 用于命名 zip 文件的 bundle 版本号 |
| -n, | string | zip 文件的名称 |
| -j, | string | 以 JSON 格式输出 |
| —no-code-check | boolean | 忽略检查源代码中是否调用了 notifyAppReady() 以及根文件夹中是否存在索引 |
| —key-v2 | boolean | 使用加密 v2 |
| —package-json | string | monorepo 的 package.json 文件路径(逗号分隔) |