lincd-cli 0.2.20 → 0.2.21
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/cli-methods.js
CHANGED
|
@@ -1329,9 +1329,39 @@ var publishUpdated = function (test) {
|
|
|
1329
1329
|
});
|
|
1330
1330
|
};
|
|
1331
1331
|
exports.publishUpdated = publishUpdated;
|
|
1332
|
+
function getEnvJsonPath() {
|
|
1333
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
1334
|
+
var path, i, envFile;
|
|
1335
|
+
return __generator(this, function (_a) {
|
|
1336
|
+
switch (_a.label) {
|
|
1337
|
+
case 0:
|
|
1338
|
+
path = './';
|
|
1339
|
+
i = 0;
|
|
1340
|
+
_a.label = 1;
|
|
1341
|
+
case 1:
|
|
1342
|
+
if (!(i <= 10)) return [3 /*break*/, 4];
|
|
1343
|
+
return [4 /*yield*/, (0, get_env_vars_1.getEnvFile)({ filePath: path + '.env.json' })["catch"](function (err) {
|
|
1344
|
+
return null;
|
|
1345
|
+
})];
|
|
1346
|
+
case 2:
|
|
1347
|
+
envFile = _a.sent();
|
|
1348
|
+
if (envFile) {
|
|
1349
|
+
//note: we're getting the actual contents here, so we could also use that more directly?
|
|
1350
|
+
return [2 /*return*/, path + '.env.json'];
|
|
1351
|
+
}
|
|
1352
|
+
path += '../';
|
|
1353
|
+
_a.label = 3;
|
|
1354
|
+
case 3:
|
|
1355
|
+
i++;
|
|
1356
|
+
return [3 /*break*/, 1];
|
|
1357
|
+
case 4: return [2 /*return*/];
|
|
1358
|
+
}
|
|
1359
|
+
});
|
|
1360
|
+
});
|
|
1361
|
+
}
|
|
1332
1362
|
var publishPackage = function (pkg, test, info, publishVersion) {
|
|
1333
1363
|
return __awaiter(this, void 0, void 0, function () {
|
|
1334
|
-
var localPackageJson,
|
|
1364
|
+
var localPackageJson, envJsonPath;
|
|
1335
1365
|
return __generator(this, function (_a) {
|
|
1336
1366
|
switch (_a.label) {
|
|
1337
1367
|
case 0:
|
|
@@ -1351,42 +1381,24 @@ var publishPackage = function (pkg, test, info, publishVersion) {
|
|
|
1351
1381
|
return [2 /*return*/, chalk_1["default"].blue(pkg.packageName + ' should publish')];
|
|
1352
1382
|
}
|
|
1353
1383
|
console.log(chalk_1["default"].blue('publishing ' + pkg.packageName + ' ' + publishVersion));
|
|
1354
|
-
|
|
1355
|
-
envCmdFile = '';
|
|
1356
|
-
i = 0;
|
|
1357
|
-
_a.label = 1;
|
|
1384
|
+
return [4 /*yield*/, getEnvJsonPath()];
|
|
1358
1385
|
case 1:
|
|
1359
|
-
|
|
1360
|
-
return [
|
|
1361
|
-
|
|
1386
|
+
envJsonPath = _a.sent();
|
|
1387
|
+
return [2 /*return*/, (0, utils_1.execPromise)("cd ".concat(pkg.path, " && ").concat(envJsonPath ? "env-cmd -f ".concat(envJsonPath, " --use-shell \"") : '', "yarn version ").concat(publishVersion, " && yarn npm publish").concat(envJsonPath ? "\"" : ''), true, false, {}, true)
|
|
1388
|
+
.then(function (res) {
|
|
1389
|
+
if (res.indexOf('Aborted due to warnings') !== -1 ||
|
|
1390
|
+
res.indexOf('Could not publish') !== -1 ||
|
|
1391
|
+
res.indexOf("Couldn't publish") !== -1) {
|
|
1392
|
+
console.log(res);
|
|
1393
|
+
return chalk_1["default"].red(pkg.packageName + ' failed\n');
|
|
1394
|
+
}
|
|
1395
|
+
console.log(chalk_1["default"].green('Successfully published ' + pkg.path + ' ' + publishVersion));
|
|
1396
|
+
return chalk_1["default"].green(pkg.packageName + ' published ' + publishVersion + '\n');
|
|
1397
|
+
})["catch"](function (_a) {
|
|
1398
|
+
var error = _a.error, stdout = _a.stdout, stderr = _a.stderr;
|
|
1399
|
+
console.log(chalk_1["default"].red('Failed to publish: ' + error.message));
|
|
1400
|
+
return chalk_1["default"].red(pkg.packageName + ' failed to publish\n');
|
|
1362
1401
|
})];
|
|
1363
|
-
case 2:
|
|
1364
|
-
envFile = _a.sent();
|
|
1365
|
-
if (envFile) {
|
|
1366
|
-
//note: we're getting the actual contents here, so we could also use that more directly?
|
|
1367
|
-
envCmdFile = path + '.env.json';
|
|
1368
|
-
return [3 /*break*/, 4];
|
|
1369
|
-
}
|
|
1370
|
-
path += '../';
|
|
1371
|
-
_a.label = 3;
|
|
1372
|
-
case 3:
|
|
1373
|
-
i++;
|
|
1374
|
-
return [3 /*break*/, 1];
|
|
1375
|
-
case 4: return [2 /*return*/, (0, utils_1.execPromise)("cd ".concat(pkg.path, " && ").concat(envCmdFile ? "env-cmd -f ".concat(envCmdFile, " --use-shell \"") : '', "yarn version ").concat(publishVersion, " && yarn npm publish").concat(envCmdFile ? "\"" : ''), true, false, {}, true)
|
|
1376
|
-
.then(function (res) {
|
|
1377
|
-
if (res.indexOf('Aborted due to warnings') !== -1 ||
|
|
1378
|
-
res.indexOf('Could not publish') !== -1 ||
|
|
1379
|
-
res.indexOf("Couldn't publish") !== -1) {
|
|
1380
|
-
console.log(res);
|
|
1381
|
-
return chalk_1["default"].red(pkg.packageName + ' failed\n');
|
|
1382
|
-
}
|
|
1383
|
-
console.log(chalk_1["default"].green('Successfully published ' + pkg.path + ' ' + publishVersion));
|
|
1384
|
-
return chalk_1["default"].green(pkg.packageName + ' published ' + publishVersion + '\n');
|
|
1385
|
-
})["catch"](function (_a) {
|
|
1386
|
-
var error = _a.error, stdout = _a.stdout, stderr = _a.stderr;
|
|
1387
|
-
console.log(chalk_1["default"].red('Failed to publish: ' + error.message));
|
|
1388
|
-
return chalk_1["default"].red(pkg.packageName + ' failed to publish\n');
|
|
1389
|
-
})];
|
|
1390
1402
|
}
|
|
1391
1403
|
});
|
|
1392
1404
|
});
|