How to actively develop and integration test a Node package within another Node package
Ideally, you'll want to develop your Node package in a self-contained way, thorugh unit testing and examples, independent from other packages. Sometimes, however, you'll want to develop your Node package within another package for integration testing purposes.
-
From your package directory, run
npm link
. This will create a globally-installed symlink to your package.cd ~/code/my-package npm link
-
From the desired parent package directory, run
npm link $PACKAGE_NAME
where$PACKAGE_NAME
is the name of your package. This will create a symlink from the parent package'snode_modules
directory to the global symlink of your package.cd ~/code/parent-package npm link my-package
-
Develop and integration test! Now, any change you make to your package will be seen from the parent package.
-
Commit and publish your changes when you're finished to give others access to your package updates.