How can I contribute to an npm package?

I am using gulp-jade package in my project. It is added as a dev dependency, so I can run npm install to get it easily (along with others). Now I need to do some performance optimization in a jade module that is a gulp-jade dependency.

So far, I can think of the following:

  • fork and jade and gulp-jade,
  • change forked gulp-jade to use forked jade
  • update your .json package to use forked gulp-jade
  • make a stretch request for jade
  • when / if the pull request is accepted then go back to gulp-jade from npm

It doesn't seem very simple, especially because I might have to make changes not only in the jade itself, but also in its dependencies, so I will have to branch them as well.

That's a lot of forking!

Is there an easier way?

+3


source to share


1 answer


However, if you want your changes / optimizations to be included in the module branch master

, you have no other way than to submit a pull request to the maintainer or fork and maintain the module yourself with the code changes, but here is the workflow that I suggest that may reduce some of the effort on your side.

Paste in only the top level module you want to add, in this case it is the module gulp-jade

. Use your forked gulp-jade

in your project. If you want to make changes to its dependencies, do it in a separate branch (per dependency), and then merge it into the main module branch, which will again be a module gulp-jade

.

Adopt a branch naming convention that helps you easily identify which module was changed in that branch and which dependency tree it affects. At the end, you will have a branch tree with each module that fits perfectly in its branch.



In that case, simply unlock the appropriate module, add the remote upstream module branch, and then submit a pull request to the maintainer.

After all your port requests are accepted, you can switch the local module gulp-jade

to the remote one.

0


source







All Articles