npm link
multiple modules together to ensure they all work with latest while developing?If you answered YES to all the above, then this module is for you.
Install, then give it a set of directories containing packages that you would like to link together (will parse all immediate subdirectories containing a package.json).
npm install -g symlink
symlink repoDir # prints a list of commands that CAN be executed
To execute these commands in series run symlink by either piping to sh
if pipes are convenient for your use case, or use the --execute
flag which also gives you one log per command.
symlink repoDir --execute
Linking together the related tournament modules from clux's repositories, to ensure they all work together, and all get the same test frameworks (though that's mostly just convenience):
NB: for readability the full paths have been shortened
clux@kjttks ~/trn $ symlink . -g nodeunit -g jscoverage -g nodeunit
cd tournament && npm link nodeunit jscoverage coveralls
cd tournament && npm install interlude
cd tournament && npm link
cd duel && npm link nodeunit jscoverage coveralls tournament
cd duel && npm install interlude
cd duel && npm link
cd ffa && npm link nodeunit jscoverage coveralls tournament
cd ffa && npm install interlude group
cd ffa && npm link
cd groupstage && npm link nodeunit jscoverage coveralls tournament
cd groupstage && npm install interlude roundrobin group
cd groupstage && npm link
cd masters && npm link nodeunit jscoverage coveralls tournament ffa
cd masters && npm install interlude
cd masters && npm link
cd tiebreaker && npm link nodeunit jscoverage coveralls tournament groupstage ffa
cd tiebreaker && npm install interlude
cd tiebreaker && npm link
cd tourney && npm link nodeunit jscoverage coveralls tournament
cd tourney && npm install interlude
cd tourney && npm link
cd ffa-tb && npm link nodeunit jscoverage coveralls tourney tiebreaker ffa
cd ffa-tb && npm install autonomy
cd ffa-tb && npm link
cd groupstage-tb && npm link nodeunit jscoverage coveralls tiebreaker groupstage tourney
cd groupstage-tb && npm link
cd groupstage-tb-duel && npm link nodeunit jscoverage duel groupstage-tb tourney groupstage
cd groupstage-tb-duel && npm install autonomy
cd groupstage-tb-duel && npm link
# all looks sane - execute:
$ kjttks@clux ~/repos $ !! | sh
The most independent modules (tournament) gets their missing dependencies installed first, then gets npm linked so the more requiring modules (specific implementations) can npm link in these.
If you have a local/chowned install of node (such that creating links to globally installed modules can be done sans-sudo) then symlink
can execute sudo free too.
package.json
of each module founds in the given directory and collects their dependencies
and devDependencies
Once everything has been ordered, a bunch of commands are generated for each module from the order of least inclusion;
npm link (localDeps) ∪ ((globals ∩ externalDeps))
npm install (externalDeps ∖ globals)
npm link
I.e. link in all locally available dependencies + extenal globals that were requested explicitly, install the rest, then link the module itself so the modules with more inclusions can safely link the module in.
Test dependencies are often the same everywhere, and, to save querying npmjs, you could just give them the version you have installed (provided it is compatible, and installed globally):
In the example above, every module that uses jscoverage
, nodeunit
or coveralls
will get the relevant modules linked in.
MIT-Licensed. See LICENSE file for details.