-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
18 changed files
with
105 additions
and
140 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
'use strict'; | ||
|
||
var Promise = require('../ext/promise'); | ||
|
||
// | ||
|
||
/** | ||
Runs the npm command `command` with the supplied args and load options. | ||
Please note that the loaded module appears to retain some state, so do not | ||
expect multiple invocations within the same process to work without quirks. | ||
This problem is likely fixable. | ||
@method npm | ||
@param {String} command The npm command to run. | ||
@param {Array} npmArgs The arguments passed to the npm command. | ||
@param {Array} options The options passed when loading npm. | ||
@param {Module} [npm] A reference to the npm module. | ||
*/ | ||
module.exports = function npm(command, npmArgs, options/*, npm*/) { | ||
var lib; | ||
if (arguments.length === 4) { | ||
lib = arguments[3]; | ||
} else { | ||
lib = require('npm'); | ||
} | ||
|
||
var load = Promise.denodeify(lib.load); | ||
|
||
return load(options) | ||
.then(function() { | ||
// if install is denodeified outside load.then(), | ||
// it throws "Call npm.load(config, cb) before using this command." | ||
var operation = Promise.denodeify(lib.commands[command]); | ||
|
||
return operation(npmArgs || []); | ||
}); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.