@ioffice/tc-builder
Advanced tools
Comparing version 2.1.3-beta.1807161213 to 2.1.3-beta.1807161248
{ | ||
"name": "@ioffice/tc-builder", | ||
"version": "2.1.3-beta.1807161213", | ||
"version": "2.1.3-beta.1807161248", | ||
"description": "iOFFICE TeamCity Builder", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var tslib_1 = require("tslib"); | ||
var Util_1 = require("../Util"); | ||
/** | ||
* Trying to keep this file free of dependencies. Using | ||
* | ||
* https://hackernoon.com/functional-javascript-resolving-promises-sequentially-7aac18c4431e | ||
*/ | ||
function promiseSerial(funcs) { | ||
return funcs.reduce(function (promise, func) { | ||
return promise.then(function (result) { return func().then(Array.prototype.concat.bind(result)); }); | ||
}, Promise.resolve([])); | ||
} | ||
/** | ||
* Executes `yarn add` on a set of dependencies specified in the package object provided. | ||
*/ | ||
function install(pkg, depType, options) { | ||
var _this = this; | ||
var _a = options || {}, _b = _a.exact, exact = _b === void 0 ? false : _b, _c = _a.regex, regex = _c === void 0 ? '' : _c, _d = _a.latest, latest = _d === void 0 ? false : _d; | ||
@@ -14,22 +22,21 @@ return new Promise(function (resolve, reject) { | ||
var deps = pkg[depType]; | ||
var promises = Object.keys(deps).map(function (name) { return tslib_1.__awaiter(_this, void 0, void 0, function () { | ||
var version, eParam, dParam, cmd; | ||
return tslib_1.__generator(this, function (_a) { | ||
switch (_a.label) { | ||
case 0: | ||
if (regex && !name.match(new RegExp(regex, 'i'))) | ||
return [2 /*return*/]; | ||
version = latest ? 'latest' : deps[name]; | ||
eParam = exact ? ' -E' : ''; | ||
dParam = depType === 'devDependencies' ? ' -D' : ''; | ||
cmd = "yarn add" + eParam + dParam + " " + name + "@" + version; | ||
process.stdout.write("$ " + cmd + "\n"); | ||
return [4 /*yield*/, Util_1.util.execCmd(cmd, true).catch(function () { | ||
exitNumber += 1; | ||
})]; | ||
case 1: return [2 /*return*/, _a.sent()]; | ||
} | ||
}); | ||
}); }); | ||
Promise.all(promises).then(function () { | ||
var fns = Object.keys(deps) | ||
.filter(function (name) { | ||
if (regex && !name.match(new RegExp(regex, 'i'))) | ||
return false; | ||
return true; | ||
}) | ||
.map(function (name) { | ||
return function () { | ||
var version = latest ? 'latest' : deps[name]; | ||
var eParam = exact ? ' -E' : ''; | ||
var dParam = depType === 'devDependencies' ? ' -D' : ''; | ||
var cmd = "yarn add" + eParam + dParam + " " + name + "@" + version; | ||
process.stdout.write("$ " + cmd + "\n"); | ||
return Util_1.util.execCmd(cmd, true).catch(function () { | ||
exitNumber += 1; | ||
}); | ||
}; | ||
}); | ||
promiseSerial(fns).then(function () { | ||
if (exitNumber === 0) { | ||
@@ -36,0 +43,0 @@ resolve(0); |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
120831
2804