Skip to content

node-ecosystem/depatcher

Repository files navigation

depatcher

Dependencies patcher ~ programmatically apply .patch files to your dependencies. Under the hood, it uses diff.

⚙️ Installation

Install as development dependency:

Package Manager Command
npm npm install -D depatcher
yarn yarn add -D depatcher
pnpm pnpm add -D depatcher

📖 Usage

applyPatch

Apply .patch files to specific files within a target dependency.

import { applyPatch } from 'depatcher'

// applyPatch(packageName, patchMap)
await applyPatch('packageName', {
  // 'target_file_in_dependency': 'path_to_patch_file'
  '/dist/index.js': './packageName_index.patch'
})

createPatch

Create a .patch file using the diff of an original file and a patched file.

import { createPatch } from 'depatcher'

createPatch(
  './original_file.js',
  './patched_file.js',
  './file.patch'
)

🔄 TODO

  • npm patch support

🛠️ Contributing

Got ideas or want to add a patch string?

  1. Clone the repository.
  2. Install dependencies with yarn install.
  3. Build the project using yarn build (uses tsdown).
  4. Run tests with yarn test.

📜 License

This project is licensed under the MIT License.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors