跳过内容

Getting Started

终端窗口
npm install @capgo/capacitor-patch
npx cap sync

直到您在 Capacitor 配置中选择补丁时,包都是无效的。

列出所有已发货补丁:

终端窗口
npx capgo-capacitor-patch list --all

然后添加您的应用程序需要的补丁ID capacitor.config.ts:

import type { CapacitorConfig } from '@capacitor/cli';
const config: CapacitorConfig = {
appId: 'com.example.app',
appName: 'Example',
webDir: 'dist',
plugins: {
CapacitorPatch: {
patches: ['upstream-pr-8418-android'],
strict: true,
},
},
};
export default config;

再次运行同步:

终端窗口
npx cap sync

包补丁在 syncupdate. 本机项目补丁在 syncupdate.

使用 doctor 来检查是否选中的补丁与安装的包版本匹配:

终端窗口
npx capgo-capacitor-patch doctor --phase package --strict

使用 apply 当您想要手动运行选中的补丁时:

终端窗口
npx capgo-capacitor-patch apply --phase package

配置选项

配置选项部分
选项类型DefaultDescription
recommendedbooleanfalseApplies patches Capgo marks as recommended.
patchesstring[][]Applies explicit patch IDs.
disabledstring[][]Skips selected patch IDs, even when recommended.
strictbooleanfalseThrows when a selected patch is incompatible or cannot apply.
Terminal 窗口
npx capgo-capacitor-patch list --all
npx capgo-capacitor-patch doctor
npx capgo-capacitor-patch apply

有用选项:

  • --root <dir> 设置应用根目录。
  • --phase package|native|all 限制哪个补丁阶段运行。
  • --platform ios|android 在 Capacitor 钩子外应用平台过滤。
  • --strict 将选中补丁失败作为错误处理。
  1. 安装 @capgo/capacitor-patch.
  2. 运行 npx capgo-capacitor-patch list --all.
  3. 将选中补丁 ID 添加到 plugins.CapacitorPatch.patches.
  4. Run npx capgo-capacitor-patch doctor --strict.
  5. Run npx cap sync.

当选中的补丁目标是 @capacitor/cli,补丁将应用到安装的CLI包和下一个 cap 命令使用修补的CLI code。

继续从Getting Started

继续从Getting Started

如果您正在使用 Getting Started 来规划原生插件工作,连接它与 使用@capgo/capacitor-patch 为原生能力在使用@capgo/capacitor-patch, Capgo 插件目录 为产品工作流程在 Capgo 插件目录, Capacitor 插件由 Capgo 为实现细节在 Capacitor 插件由 Capgo, 添加或更新插件 为实现细节在添加或更新插件,和 Ionic Enterprise 插件替代方案 为产品工作流程在 Ionic Enterprise 插件替代方案。