LinuxCommandLibrary

bun-patch

Patch installed packages locally

TLDR

Prepare a package for patching
$ bun patch [package-name]
copy
Apply patches after modifications
$ bun patch --commit [package-name]
copy
Commit with custom patches directory
$ bun patch --commit [package-name] --patches-dir=[mypatches]
copy
Patch a specific version
$ bun patch [package-name]@[1.2.3]
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 or path to patched package.
--patches-dir dir
Directory to store patch files. Default: patches.

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

bun(1), bun-install(1)

> TERMINAL_GEAR

Curated for the Linux community

Copied to clipboard