From 1a5f79a92b5d66b64ca77c71fdce037679758701 Mon Sep 17 00:00:00 2001 From: Kiko Beats Date: Sat, 4 Apr 2015 12:47:32 +0200 Subject: [PATCH 1/2] added link command --- index.js | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/index.js b/index.js index a0599cb..20740db 100644 --- a/index.js +++ b/index.js @@ -31,6 +31,22 @@ 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', + cmdArgs: options.dependencies, + cmdOptions: { + loglevel: options.loglevel || undefined + } + }, cb); + }, + /** * @param {[type]} options [description] * @param {Function} cb [description] From 0ffe75aa528e2c852a6a5a338b34eda1da3153ea Mon Sep 17 00:00:00 2001 From: Kiko Beats Date: Sat, 4 Apr 2015 13:11:01 +0200 Subject: [PATCH 2/2] added scope param --- index.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/index.js b/index.js index 20740db..0374aad 100644 --- a/index.js +++ b/index.js @@ -40,6 +40,7 @@ module.exports = { link: function(options, cb) { return doNpmCommand({ npmCommand: 'link', + scope: options.scope || undefined, cmdArgs: options.dependencies, cmdOptions: { loglevel: options.loglevel || undefined @@ -119,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;