pnpm patch-commit <path>

从目录中生成一个补丁并保存它(受 Yarn 中类似命令的启发)。

This command will compare the changes from path to the package it was supposed to patch, generate a patch file, save the patch file to patchesDir (which can be customized by the --patches-dir option), and add an entry to patchedDependencies.

使用方法:

pnpm patch-commit <path>
  • path is the path to a modified copy of the patch target package, usually the directory generated by pnpm patch. It can also be a package name or specifier. If several edit directories match it, the command fails with ERR_PNPM_AMBIGUOUS_PATCH_TARGET.

After recording the patch, pnpm runs an install to apply it.

配置项#

--patches-dir <patchesDir>#

生成的补丁文件将保存到该目录。默认情况下,补丁保存在项目根目录下的 patches 目录中。