Skip to content

Instantly share code, notes, and snippets.

@dmail
Last active August 29, 2015 14:19
Show Gist options
  • Save dmail/c0a7901acba918c60ca3 to your computer and use it in GitHub Desktop.
Save dmail/c0a7901acba918c60ca3 to your computer and use it in GitHub Desktop.
symlink your module to keep clean and separate sources from project usage
@dmail
Copy link
Author

dmail commented Apr 26, 2015

Use it in package.json like so

{
  "name": "app",
  "version": "0.0.1",
  "dependencies": {
    "module-a": "*"
  },
  "scripts": {
    "preinstall": "node symlink ../path/to/dev/folder/"
  }
}

You can also use it every time you add a new local module (by git clone for instance) in ../path/to/dev/folder using directly node symlink ../path/to/dev/folder

@dmail
Copy link
Author

dmail commented Apr 27, 2015

npm install-ed module don't need symlink after line #168 because the top level directory contains symlink to local modules.

But, if an external module (npm installed) depends on a previously not syminked local module (because not used), then the external module will not receive a symlinked version.

An easy fix would be to remove the check line #91 and symlink all local modules even if not used.

@dmail
Copy link
Author

dmail commented Apr 27, 2015

This gist is now a node module with it's own repo : https://github.com/dmail/symlink

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment