LinuxCommandLibrary
GitHubF-DroidGoogle Play Store

bun-patch

Patch installed packages locally

TLDR

Prepare a package for patching
$ bun patch [package-name]
copy
Prepare a specific version for patching
$ bun patch [package-name]@[1.2.3]
copy
Commit patches after making modifications
$ bun patch --commit [package-name]
copy
Commit with a custom patches directory
$ bun patch --commit [package-name] --patches-dir=[mypatches]
copy
Patch using the path to the package in node_modules
$ bun patch --commit node_modules/[package-name]
copy

SYNOPSIS

bun patch [options] package-name

DESCRIPTION

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.

PARAMETERS

--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

CAVEATS

Patches are stored in a patches directory and must be committed to version control. Patches may break when the package is updated.

SEE ALSO

Copied to clipboard
Kai