Skip to content

Instantly share code, notes, and snippets.

@vjpr
Last active August 29, 2015 14:22
Show Gist options
  • Save vjpr/d40ff0c0830f6c66565d to your computer and use it in GitHub Desktop.
Save vjpr/d40ff0c0830f6c66565d to your computer and use it in GitHub Desktop.
NPM module patching workflow

NPM module patching workflow

Create a new project

npm init -f

Add a module

npm install --save something

Need to patch module something

npm install --save https://github.com/something/something.git

git clone https://github.com/something/something ./patched_modules/something

cd ./patched_modules/something

git remote set-url origin https://github.com/USERNAME/something

npm link ./patched_modules/something

Make changes to ./patched_modules/something.

cd ./patched_modules/something

git commit -m 'fixed'

git push

cd ../

git push

-> A pre-push hook (I will post separately) looks for symlinked node_modules and updates the package.json with the latest pushed commit hash.

`git commit -m 'Update package.json git dependencies'

git push

git push heroku master

-> Deploys and uses your git dependencies. Because they use commit hashes (instead of tags or branches or something), they are cached.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment