Reputation: 12487
I just forked a node module and fixed some of its problems. The originally version was referenced in my Meteor project using Npm.depends
. But now I want to use my forked version instead (until the original owner accepts my pull request).
What's a good way of doing this? I don't really want to publish my forked version onto npmjs.org.
Is it possible to use Npm.depends on git urls?
Upvotes: 1
Views: 118
Reputation: 2576
You can easily wrap it in a smart package, no hacking required.
I had the same problem when I came across a useful, abandoned module that had a couple of bugs in it. I forked the module and wrapped it in a smart package. Example:
Smart Package my fork of the npm module
Upvotes: 0
Reputation: 22696
Here is a quick hack I came up with :
I have my custom node module located in MyProject/packages/my-package/my-node-module (you'll need to git clone your forked node module locally)
In the main.js file of your package, you can reference your node module using Npm.require like this :
console.log(process.cwd());
// this will output something like "/home/user/projects/MyProject/.meteor/local/build/programs/server"
var myNodeModule=Npm.require("../../../../../packages/my-package/my-node-module");
We use the parent directory syntax to get back to the project directory, then reference the relative path of our node module.
We don't need Npm.depends using this technique, it's not very nice but it will do the trick.
Upvotes: 2