Have a look at Dredd, for example, it makes the library Hooks available when you are running a script with the dredd
command.
Command line
$ dredd [...] --hookfiles=./hooks.js
hooks.js
const hooks = require('hooks');
...
How does it work?
Have a look at Dredd, for example, it makes the library Hooks available when you are running a script with the dredd
command.
Command line
$ dredd [...] --hookfiles=./hooks.js
hooks.js
const hooks = require('hooks');
...
How does it work?
I'm the maintainer of Dredd. In Dredd's case it's implemented using the proxyquire library. I think rewire does similar things.
Check out
npm link
, which can be used to "link" together local modules as if they were a dependency visible in thenode_modules
directory. This can be very useful when splitting off code into a library. I'm not exactly sure whatdredd
is doing, but it is likely based off of thenpm link
paradigm.