Socket
Book a DemoInstallSign in
Socket

link-directories

Package Overview
Dependencies
Maintainers
3
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

link-directories

Link your directories into node_modules

latest
npmnpm
Version
2.1.0
Version published
Maintainers
3
Created
Source

Link your directories into node_modules so you dont have to do things like require('../../../../foo')

Basically this is what @substack recommends in his browserify-handbook.

usage

Install it

npm i link-directories --save

Add it to postinstall hook in your package.json

Read more about postinstall here: https://docs.npmjs.com/misc/scripts

Let's say you want to require foo.js from lib directory (so basically require('lib/foo.js')), for this add a link-directories entry to your package.json.

{
  "name": "your-module",
  "dependencies": {
     "link-directories": "^1.0.0"
  },
  "scripts": {
    "postinstall": "link-directories"
  },
  "link-directories": [{
    "src": "lib",
    "dest": "node_modules/lib"
  }]
}

Run npm run postinstall

why postinstall?

Because if somebody starts to use your app/project they will git clone your-repo && npm install, so it will just work.

format

currently this module expects an array which contains an object of src and dest. later we should we should add option to use array of strings (which should be interpreted src: <string>, dest: <string>), or set cwd, etc. but first we need to add tests.

license

MIT

FAQs

Package last updated on 31 Mar 2016

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts