npm link file
Install
npm install npm-link-file --save-dev
Usage
npm-link-file ./lib/path/file.js file-library
How
Here's the rundown, when you run command above the following happens.
- create directory
node_modules_linked
- create direcotry
node_modules_linked/<name>
- create
package.json
with name and main - simlink
<file>
tonode_modules_linked/<name>/index.js
- simlink
node_modules_linked/<name>
tonode_modules/<name>
Why?
Have you ever wanted to require a file absolutely as a module?
var fileLibrary = require("file-library")
Instead of relatively like this.
var fileLibrary = require("./lib/path/file.js")