Linux command
bun-patch 命令
文本
复制后可按需替换文件名、目录或参数。
常用示例
Prepare a package for patching
bun patch [package-name]
Prepare a specific version
bun patch [package-name]@[1.2.3]
Commit patches
bun patch --commit [package-name]
Commit with a custom patches directory
bun patch --commit [package-name] --patches-dir=[mypatches]
Patch using the path
bun patch --commit node_modules/[package-name]
说明
bun patch allows you to persistently patch node_modules in a maintainable, git-friendly way. It extracts a package for editing, and after making changes, --commit creates a .patch file that is applied on future installs. Patch files are stored in a patches directory and tracked via "patchedDependencies" in package.json. They can be committed to your repository and reused across multiple installs, projects, and machines. You can supply a package name, a precise version (if multiple versions are installed), or the path to the package in node_modules.
参数
- --commit _path-or-pkg_
- Generate a .patch file from modifications. Accepts package name, name@version, or path to patched package.
- --patches-dir _dir_
- Directory to store patch files (only with --commit). Default: patches.
- -p, --production
- Don't install devDependencies
- --frozen-lockfile
- Disallow changes to the lockfile
- --dry-run
- Don't install anything, only show what would be done
- --ignore-scripts
- Skip lifecycle scripts in the project's package.json
- -f, --force
- Always request the latest versions from the registry and reinstall all dependencies
- --verbose
- Enable verbose logging output
FAQ
What is the bun-patch command used for?
bun patch allows you to persistently patch node_modules in a maintainable, git-friendly way. It extracts a package for editing, and after making changes, --commit creates a .patch file that is applied on future installs. Patch files are stored in a patches directory and tracked via "patchedDependencies" in package.json. They can be committed to your repository and reused across multiple installs, projects, and machines. You can supply a package name, a precise version (if multiple versions are installed), or the path to the package in node_modules.
How do I run a basic bun-patch example?
Run `bun patch [package-name]` in a terminal, then adjust file names, paths, flags, or remote targets for your system.
What does --commit _path-or-pkg_ do in bun-patch?
Generate a .patch file from modifications. Accepts package name, name@version, or path to patched package.