lincd-cli 0.2.19 → 0.2.20

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.
@@ -75,7 +75,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
75
75
  return (mod && mod.__esModule) ? mod : { "default": mod };
76
76
  };
77
77
  exports.__esModule = true;
78
- exports.executeCommandForPackage = exports.addCapacitor = exports.executeCommandForEachPackage = exports.buildUpdated = exports.publishUpdated = exports.buildPackage = exports.buildMetadata = exports.register = exports.createPackage = exports.createComponent = exports.createSetComponent = exports.createShape = exports.createOntology = exports.getLincdPackages = exports.buildAll = exports.developPackage = exports.createApp = void 0;
78
+ exports.executeCommandForPackage = exports.addCapacitor = exports.executeCommandForEachPackage = exports.buildUpdated = exports.publishPackage = exports.publishUpdated = exports.buildPackage = exports.buildMetadata = exports.register = exports.createPackage = exports.createComponent = exports.createSetComponent = exports.createShape = exports.createOntology = exports.getLincdPackages = exports.buildAll = exports.developPackage = exports.createApp = void 0;
79
79
  var path_1 = __importDefault(require("path"));
80
80
  var fs_extra_1 = __importDefault(require("fs-extra"));
81
81
  var utils_1 = require("./utils");
@@ -88,6 +88,7 @@ var env_cmd_1 = require("env-cmd");
88
88
  var JSONLDWriter_1 = require("lincd-jsonld/lib/utils/JSONLDWriter");
89
89
  var NameSpace_1 = require("lincd/lib/utils/NameSpace");
90
90
  var Prefix_1 = require("lincd/lib/utils/Prefix");
91
+ var get_env_vars_1 = require("env-cmd/dist/get-env-vars");
91
92
  var glob = require('glob');
92
93
  var variables = {};
93
94
  var open = require('open');
@@ -1274,7 +1275,7 @@ var publishUpdated = function (test) {
1274
1275
  return [2 /*return*/, chalk_1["default"].red(pckg.packageName + ' failed: ' + err_1.message)];
1275
1276
  case 4:
1276
1277
  if (shouldPublish) {
1277
- res = publishPackage(pckg, test, info, version);
1278
+ res = (0, exports.publishPackage)(pckg, test, info, version);
1278
1279
  if (pckg.packageName == 'browser-core') {
1279
1280
  browserCoreBuilt = true;
1280
1281
  }
@@ -1283,7 +1284,7 @@ var publishUpdated = function (test) {
1283
1284
  browserModule = packages.find(function (m) { return m.packageName == 'browser-core'; });
1284
1285
  return [2 /*return*/, Promise.resolve(res).then(function (previousResult) {
1285
1286
  log('# Automatically also publishing package browser-core');
1286
- return publishPackage(browserModule, test);
1287
+ return (0, exports.publishPackage)(browserModule, test);
1287
1288
  })];
1288
1289
  }
1289
1290
  return [2 /*return*/, res];
@@ -1329,38 +1330,68 @@ var publishUpdated = function (test) {
1329
1330
  };
1330
1331
  exports.publishUpdated = publishUpdated;
1331
1332
  var publishPackage = function (pkg, test, info, publishVersion) {
1332
- if (!publishVersion) {
1333
- // publishVersion = info ? getNextVersion(info.data.version) : '';
1334
- publishVersion = info ? getNextVersion(info.version) : '';
1335
- }
1336
- if (test) {
1337
- debugInfo('should publish ' + pkg.packageName + ' ' + publishVersion);
1338
- }
1339
- else {
1340
- console.log(chalk_1["default"].blue('publishing ' + pkg.packageName + ' ' + publishVersion));
1341
- }
1342
- if (!test) {
1343
- return (0, utils_1.execPromise)("cd ".concat(pkg.path, " && yarn version ").concat(publishVersion, " && yarn npm publish"), true, false, {}, true)
1344
- .then(function (res) {
1345
- if (res.indexOf('Aborted due to warnings') !== -1 ||
1346
- res.indexOf('Could not publish') !== -1 ||
1347
- res.indexOf("Couldn't publish") !== -1) {
1348
- console.log(res);
1349
- return chalk_1["default"].red(pkg.packageName + ' failed\n');
1333
+ return __awaiter(this, void 0, void 0, function () {
1334
+ var localPackageJson, path, envCmdFile, i, envFile;
1335
+ return __generator(this, function (_a) {
1336
+ switch (_a.label) {
1337
+ case 0:
1338
+ if (!pkg) {
1339
+ localPackageJson = (0, utils_1.getPackageJSON)();
1340
+ pkg = {
1341
+ path: process.cwd(),
1342
+ packageName: localPackageJson.name
1343
+ };
1344
+ }
1345
+ if (!publishVersion) {
1346
+ publishVersion = info ? getNextVersion(info.version) : 'patch';
1347
+ }
1348
+ if (test) {
1349
+ debugInfo('should publish ' + pkg.packageName + ' ' + publishVersion);
1350
+ //when testing what needs to be published
1351
+ return [2 /*return*/, chalk_1["default"].blue(pkg.packageName + ' should publish')];
1352
+ }
1353
+ console.log(chalk_1["default"].blue('publishing ' + pkg.packageName + ' ' + publishVersion));
1354
+ path = './';
1355
+ envCmdFile = '';
1356
+ i = 0;
1357
+ _a.label = 1;
1358
+ case 1:
1359
+ if (!(i <= 10)) return [3 /*break*/, 4];
1360
+ return [4 /*yield*/, (0, get_env_vars_1.getEnvFile)({ filePath: path + '.env.json' })["catch"](function (err) {
1361
+ return null;
1362
+ })];
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
+ })];
1350
1390
  }
1351
- console.log(chalk_1["default"].green('Successfully published ' + pkg.path + ' ' + publishVersion));
1352
- return chalk_1["default"].green(pkg.packageName + ' published ' + publishVersion + '\n');
1353
- })["catch"](function (_a) {
1354
- var error = _a.error, stdout = _a.stdout, stderr = _a.stderr;
1355
- console.log(chalk_1["default"].red('Failed to publish: ' + error.message));
1356
- return chalk_1["default"].red(pkg.packageName + ' failed to publish\n');
1357
1391
  });
1358
- }
1359
- else {
1360
- //when testing what needs to be published
1361
- return chalk_1["default"].blue(pkg.packageName + ' should publish');
1362
- }
1392
+ });
1363
1393
  };
1394
+ exports.publishPackage = publishPackage;
1364
1395
  var buildUpdated = function (back, target, target2, test) {
1365
1396
  if (test === void 0) { test = false; }
1366
1397
  return __awaiter(this, void 0, void 0, function () {
package/lib/cli.js CHANGED
@@ -82,6 +82,9 @@ program.command('build-metadata').action(function () {
82
82
  program.command('publish-updated').action(function () {
83
83
  return (0, cli_methods_1.publishUpdated)();
84
84
  });
85
+ program.command('publish [version]').action(function (version) {
86
+ return (0, cli_methods_1.publishPackage)(null, false, null, version);
87
+ });
85
88
  program.command('status').action(function () {
86
89
  //log which packages need to be published
87
90
  return (0, cli_methods_1.publishUpdated)(true).then(function () {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lincd-cli",
3
- "version": "0.2.19",
3
+ "version": "0.2.20",
4
4
  "description": "Command line tools for the lincd.js library",
5
5
  "main": "lib/index.js",
6
6
  "scripts": {