pnpm patch <pkg>
准备一个用于修补的包(受到 Yarn 中类似命令的启发)。
¥Prepare a package for patching (inspired by a similar command in Yarn).
此命令将导致将包提取到可随意编辑的临时目录中。
¥This command will cause a package to be extracted in a temporary directory intended to be editable at will.
完成更改后,运行 pnpm patch-commit <path>
(<path>
是你收到的临时目录)以生成补丁文件并通过 patchedDependencies
字段将其注册到顶层清单中。
¥Once you're done with your changes, run pnpm patch-commit <path>
(with <path>
being the temporary directory you received) to generate a patchfile and register it into your top-level manifest via the patchedDependencies
field.
用法:
¥Usage:
pnpm patch <pkg name>@<version>
如果要更改包的依赖,请不要使用修补程序来修改包的 package.json
文件。要覆盖依赖,请使用 overrides 或 包钩子。
¥If you want to change the dependencies of a package, don't use patching to modify the package.json
file of the package. For overriding dependencies, use overrides or a package hook.
选项
¥Options
--edit-dir <dir>
需要打补丁的包会被解压到该目录下。
¥The package that needs to be patched will be extracted to this directory.
--ignore-existing
打补丁时忽略现有补丁文件。
¥Ignore existing patch files when patching.