Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

node-ecosystem/depatcher

Open more actions menu

Repository files navigation

depatcher

Programmatically create and apply .patch files to your project's dependencies.
Under the hood, it leverages diff to generate diffs and package manager primitives to apply them.

Note: diff is bundled to support the patch cross package managers.

⚙️ Installation

Install as a development dependency:

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

📖 Usage

createPatch

Generates a .patch file by comparing an original file with a modified (patched) file.

import { createPatch } from 'depatcher'

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

applyPatch

Applies .patch files to specific file paths 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'
})

applyPatchMultiple

Applies .patch files to multiple target dependencies efficiently.

import { applyPatchMultiple } from 'depatcher'

// applyPatchMultiple(packagePatchMap)
await applyPatchMultiple({
  packageName1: {
    '/dist/index.js': './packageName1_index.patch'
  },
  packageName2: {
    '/dist/index.js': './packageName2_index.patch'
  }
})

🔄 TODO

  • npm patch support

📜 License

This project is licensed under the MIT License.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Morty Proxy This is a proxified and sanitized view of the page, visit original site.