@pagedip/util-npm
Advanced tools
Comparing version 1.0.1-rc.3 to 1.0.1-rc.4
39
index.js
@@ -21,2 +21,4 @@ 'use strict'; | ||
function _objectWithoutProperties(obj, keys) { var target = {}; for (var i in obj) { if (keys.indexOf(i) >= 0) continue; if (!Object.prototype.hasOwnProperty.call(obj, i)) continue; target[i] = obj[i]; } return target; } | ||
function _asyncToGenerator(fn) { return function () { var gen = fn.apply(this, arguments); return new Promise(function (resolve, reject) { function step(key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { return Promise.resolve(value).then(function (value) { step("next", value); }, function (err) { step("throw", err); }); } } return step("next"); }); }; } | ||
@@ -35,13 +37,18 @@ | ||
args = Array.isArray(args) ? args : args ? [args] : []; | ||
opts = opts || {}; | ||
var _ref3 = opts || {}, | ||
buffer = _ref3.buffer, | ||
_ref3$npmBinPath = _ref3.npmBinPath, | ||
npmBinPath = _ref3$npmBinPath === undefined ? globalNpm.GLOBAL_NPM_BIN : _ref3$npmBinPath, | ||
options = _objectWithoutProperties(_ref3, ["buffer", "npmBinPath"]); | ||
return yield new Promise(function (resolve, reject) { | ||
if (opts.buffer) { | ||
var cmd = [globalNpm.GLOBAL_NPM_BIN].concat(_toConsumableArray(args)).join(" "); | ||
if (buffer) { | ||
var cmd = [npmBinPath].concat(_toConsumableArray(args)).join(" "); | ||
return resolve(child_process.exec(cmd, opts)); | ||
} | ||
var cp = child_process.spawn(globalNpm.GLOBAL_NPM_BIN, args, _extends({ | ||
var cp = child_process.spawn(npmBinPath, args, _extends({ | ||
stdio: "inherit" | ||
}, opts)); | ||
}, options)); | ||
@@ -63,5 +70,5 @@ cp.on("exit", function (code) { | ||
if (!Array.isArray(args) && (typeof args === "undefined" ? "undefined" : _typeof(args)) === "object" && args != null) { | ||
var _ref3 = [args, null]; | ||
opts = _ref3[0]; | ||
args = _ref3[1]; | ||
var _ref4 = [args, null]; | ||
opts = _ref4[0]; | ||
args = _ref4[1]; | ||
} | ||
@@ -74,3 +81,3 @@ | ||
var loadNpmConfig = function () { | ||
var _ref4 = _asyncToGenerator(function* (opts) { | ||
var _ref5 = _asyncToGenerator(function* (opts) { | ||
globalNpmConfig.loaded = false; | ||
@@ -99,3 +106,3 @@ | ||
return function loadNpmConfig(_x3) { | ||
return _ref4.apply(this, arguments); | ||
return _ref5.apply(this, arguments); | ||
}; | ||
@@ -148,3 +155,3 @@ }(); | ||
var fetchPackageInfo = function () { | ||
var _ref5 = _asyncToGenerator(function* (registry, name) { | ||
var _ref6 = _asyncToGenerator(function* (registry, name) { | ||
if (!name) { | ||
@@ -157,4 +164,4 @@ throw "Your package is missing a name."; | ||
try { | ||
var _ref6 = yield req, | ||
body = _ref6.body; | ||
var _ref7 = yield req, | ||
body = _ref7.body; | ||
@@ -168,3 +175,3 @@ return body; | ||
return function fetchPackageInfo(_x4, _x5) { | ||
return _ref5.apply(this, arguments); | ||
return _ref6.apply(this, arguments); | ||
}; | ||
@@ -191,3 +198,3 @@ }(); | ||
var fetchRelease = function () { | ||
var _ref7 = _asyncToGenerator(function* (registry, name, tags) { | ||
var _ref8 = _asyncToGenerator(function* (registry, name, tags) { | ||
var info = yield fetchPackageInfo(registry, name); | ||
@@ -198,3 +205,3 @@ return getRelease(info, tags); | ||
return function fetchRelease(_x7, _x8, _x9) { | ||
return _ref7.apply(this, arguments); | ||
return _ref8.apply(this, arguments); | ||
}; | ||
@@ -201,0 +208,0 @@ }(); |
{ | ||
"name": "@pagedip/util-npm", | ||
"version": "1.0.1-rc.3", | ||
"version": "1.0.1-rc.4", | ||
"author": "Tyler Johnson <tyler@beneaththeink.com>", | ||
@@ -32,3 +32,3 @@ "repository": { | ||
], | ||
"gitHead": "02a7733d507bfa9f47b0e7931a140dd7b7d4873b" | ||
"gitHead": "705c40850927d5f2659088ecee1e9fc4ba79f729" | ||
} |
7936
164