Skip to content
This repository has been archived by the owner on Aug 13, 2021. It is now read-only.

added link command #5

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down Expand Up @@ -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;
Expand Down