diff --git a/index.js b/index.js index a0599cb..0374aad 100644 --- a/index.js +++ b/index.js @@ -31,6 +31,23 @@ module.exports = { }, cb); }, + /** + * Link locallay (or globally) a NPM package + * @param {[type]} options [description] + * @param {Function} cb [description] + * @return {[type]} [description] + */ + link: function(options, cb) { + return doNpmCommand({ + npmCommand: 'link', + scope: options.scope || undefined, + cmdArgs: options.dependencies, + cmdOptions: { + loglevel: options.loglevel || undefined + } + }, cb); + }, + /** * @param {[type]} options [description] * @param {Function} cb [description] @@ -103,6 +120,10 @@ function doNpmCommand(options, cb) { // console.log('WOULD HAVE RUN::'); // console.log(cmd); + // Setup the scope + if (options.scope) + process.chdir(options.scope); + // Spin up child process var npm = exec(cmd); var stderr$npm = npm.stderr;