lincd-cli 0.2.7 → 0.2.9

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.
@@ -49,6 +49,7 @@
49
49
  "react-router-dom": "^6.3.0"
50
50
  },
51
51
  "devDependencies": {
52
+ "@types/node": "^18.11.10",
52
53
  "@types/react": "^18.0.17",
53
54
  "@types/react-dom": "^18.0.6",
54
55
  "env-cmd": "^10.1.0",
package/lib/cli.js CHANGED
@@ -225,12 +225,11 @@ function debugInfo() {
225
225
  // console.log(gruntConfig);
226
226
  // process.exit();
227
227
  // }
228
- // if(gruntConfig.analyse === true)
229
- // {
230
- // messages.forEach((message) => {
231
- // console.log(chalk.cyan('Info: ') + message);
232
- // });
233
- // }
228
+ if (gruntConfig && gruntConfig.analyse === true) {
229
+ messages.forEach(function (message) {
230
+ console.log(chalk.cyan('Info: ') + message);
231
+ });
232
+ }
234
233
  }
235
234
  function warn() {
236
235
  var messages = [];
@@ -1201,11 +1200,14 @@ var publishUpdated = function (test) {
1201
1200
  var browserCoreBuilt = false;
1202
1201
  var p = Promise.resolve('');
1203
1202
  var packagesLeft = packages.length;
1204
- console.log('Checking which packages need to be published by comparing last published date with last git commit');
1203
+ var results = [];
1204
+ log('Checking which packages need to be published by comparing last published date with last git commit');
1205
+ // p = Promise.all(packages.map((pckg) => {
1205
1206
  packages.forEach(function (pckg) {
1206
- p = p.then(function (previousResult) {
1207
- progressUpdate(packagesLeft-- + ' packages left. Now checking ' + pckg.packageName);
1208
- debugInfo('# Checking package ' + pckg.packageName);
1207
+ p = p
1208
+ .then(function (previousResult) {
1209
+ // progressUpdate(packagesLeft-- + ' packages left. Now checking ' + pckg.packageName);
1210
+ // log('# Checking package ' + pckg.packageName);
1209
1211
  // log('# Requesting ' + 'yarn info '+pkg.packageName+' --json');
1210
1212
  // return execPromise('yarn info '+pkg.packageName+' --json').then((output:string) => {
1211
1213
  // console.log("Will be requesting npm view from this current working directory:\n"+process.cwd());
@@ -1216,36 +1218,32 @@ var publishUpdated = function (test) {
1216
1218
  if (pack.private) {
1217
1219
  shouldPublish = false;
1218
1220
  debugInfo(chalk.blue('--> is private, skipping'));
1219
- return previousResult + ' ' + chalk.gray(pckg.packageName + ' is private\n');
1221
+ return chalk.gray(pckg.packageName + ' is private');
1222
+ // return previousResult + ' ' + chalk.gray(pckg.packageName + ' is private\n');
1220
1223
  }
1221
- return execPromise('yarn info ' + pckg.packageName + ' --json')
1224
+ return execPromise('npm info ' + pckg.packageName + ' --json')
1222
1225
  .then(function (output) { return __awaiter(_this, void 0, void 0, function () {
1223
- var info, lastPublish, lastPublishDate, lastCommit, res, browserModule;
1226
+ var info, lastPublish, lastPublishDate, lastCommit, err_1, res, browserModule;
1224
1227
  return __generator(this, function (_a) {
1225
1228
  switch (_a.label) {
1226
1229
  case 0:
1227
- try {
1228
- if (output == '') {
1229
- debugInfo('No response (empty) from `yarn info`. This package was probably not published before');
1230
- // throw new Error('Empty response from `yarn info`. This pkg was probably not published before');
1231
- // return;
1232
- shouldPublish = true;
1233
- //don't patch the version number (default, see above), use the current version
1234
- version = pack.version;
1235
- }
1236
- else {
1237
- info = JSON.parse(output);
1238
- }
1239
- // var stats = fs.statSync(path.join(packageDirectory));
1240
- // var files = fs.readdirSync(path.join(packageDirectory,'src'));
1230
+ _a.trys.push([0, 3, , 4]);
1231
+ if (output == '' || output.includes('E404')) {
1232
+ debugInfo('Empty or 404 response from `npm info`. This package was probably not published before');
1233
+ // throw new Error('Empty response from `yarn info`. This pkg was probably not published before');
1234
+ // return;
1235
+ shouldPublish = true;
1236
+ //don't patch the version number (default, see above), use the current version
1237
+ version = pack.version;
1241
1238
  }
1242
- catch (err) {
1243
- chalk.red(pckg.packageName + ' failed: ' + err.message + '\n');
1244
- console.warn('Returned JSON from npm: ' + output);
1245
- return [2 /*return*/, previousResult + ' ' + chalk.red(pckg.packageName + ' failed: ' + err.message + '\n')];
1239
+ else {
1240
+ info = JSON.parse(output);
1246
1241
  }
1247
1242
  if (!info) return [3 /*break*/, 2];
1248
- lastPublish = info.data.time[info.data.version];
1243
+ lastPublish = void 0;
1244
+ //yarn:
1245
+ // let lastPublish = info.data.time[info.data.version];
1246
+ lastPublish = info.time[info.version];
1249
1247
  lastPublishDate = new Date(lastPublish);
1250
1248
  return [4 /*yield*/, getLastCommitTime(pckg.path)];
1251
1249
  case 1:
@@ -1253,25 +1251,39 @@ var publishUpdated = function (test) {
1253
1251
  if (!lastCommit) {
1254
1252
  shouldPublish = false;
1255
1253
  debugInfo('Could not determine last git commit');
1256
- return [2 /*return*/, previousResult + ' ' + chalk.red(pckg.packageName + ' - could not determine last commit\n')];
1254
+ // return previousResult + ' ' + chalk.red(pckg.packageName + ' - could not determine last commit\n');
1255
+ return [2 /*return*/, chalk.red(pckg.packageName + ' - could not determine last commit')];
1257
1256
  }
1258
1257
  else {
1259
1258
  //NOTE: removed lastModified, because switching branches will say that the file was modified and cause everything to publish
1260
1259
  //SO: now you NEED TO commit before it picks up that you should publish
1261
1260
  shouldPublish = lastPublishDate.getTime() < lastCommit.getTime();
1262
- if (shouldPublish) {
1263
- debugInfo(lastPublishDate.toDateString() +
1264
- ' ' +
1265
- lastPublishDate.toTimeString() +
1266
- ' published ' +
1267
- info.data.version);
1268
- debugInfo(lastCommit.toDateString() + ' ' + new Date(lastCommit).toTimeString() + ' source last committed');
1269
- }
1261
+ // if (shouldPublish) {
1262
+ // log(
1263
+ // lastPublishDate.toDateString() +
1264
+ // ' ' +
1265
+ // lastPublishDate.toTimeString() +
1266
+ // ' published ' +
1267
+ // info.version,
1268
+ // );
1269
+ // log(
1270
+ // lastCommit.toDateString() + ' ' + new Date(lastCommit).toTimeString() + ' source last committed',
1271
+ // );
1272
+ // }
1270
1273
  }
1271
1274
  _a.label = 2;
1272
- case 2:
1275
+ case 2: return [3 /*break*/, 4];
1276
+ case 3:
1277
+ err_1 = _a.sent();
1278
+ // var stats = fs.statSync(path.join(packageDirectory));
1279
+ // var files = fs.readdirSync(path.join(packageDirectory,'src'));
1280
+ console.log(chalk.red(pckg.packageName + ' failed: ' + err_1.message + '\n'));
1281
+ console.warn('Returned JSON from npm: ' + output);
1282
+ // return previousResult + ' ' + chalk.red(pckg.packageName + ' failed: ' + err.message + '\n');
1283
+ return [2 /*return*/, chalk.red(pckg.packageName + ' failed: ' + err_1.message)];
1284
+ case 4:
1273
1285
  if (shouldPublish) {
1274
- res = publishPackage(pckg, previousResult, test, info, version);
1286
+ res = publishPackage(pckg, test, info, version);
1275
1287
  if (pckg.packageName == 'browser-core') {
1276
1288
  browserCoreBuilt = true;
1277
1289
  }
@@ -1280,33 +1292,54 @@ var publishUpdated = function (test) {
1280
1292
  browserModule = packages.find(function (m) { return m.packageName == 'browser-core'; });
1281
1293
  return [2 /*return*/, Promise.resolve(res).then(function (previousResult) {
1282
1294
  log('# Automatically also publishing package browser-core');
1283
- return publishPackage(browserModule, previousResult, test);
1295
+ return publishPackage(browserModule, test);
1284
1296
  })];
1285
1297
  }
1286
1298
  return [2 /*return*/, res];
1287
1299
  }
1288
- return [2 /*return*/, previousResult];
1300
+ // return previousResult + ' ' + chalk.green(pckg.packageName + ' latest version is up to date\n');
1301
+ return [2 /*return*/, chalk.green(pckg.packageName + ' latest version is up to date')];
1289
1302
  }
1290
1303
  });
1291
1304
  }); })["catch"](function (_a) {
1292
1305
  var error = _a.error, stdout = _a.stdout, stderr = _a.stderr;
1293
- console.log(error.message);
1294
- return previousResult + ' ' + chalk.red(pckg.packageName + ' failed\n');
1306
+ if (error) {
1307
+ console.log(error.message);
1308
+ }
1309
+ if (stdout) {
1310
+ console.log(stderr);
1311
+ }
1312
+ if (stderr) {
1313
+ console.log(stderr);
1314
+ }
1315
+ // return previousResult + ' ' + chalk.red(pckg.packageName + ' failed\n');
1316
+ console.warn(chalk.red(pckg.packageName + ' failed'));
1317
+ return chalk.red(pckg.packageName + ' failed');
1295
1318
  });
1319
+ })
1320
+ .then(function (res) {
1321
+ log(res);
1322
+ results.push(res);
1323
+ })["catch"](function (err) {
1324
+ console.warn(chalk.red(pckg.packageName + ' failed: ' + err.toString()));
1325
+ results.push(chalk.red(pckg.packageName + ' failed: ' + err.toString()));
1296
1326
  });
1297
1327
  });
1298
- return p.then(function (messages) {
1299
- if (messages == '') {
1300
- console.log('All published packages are already up-to-date.');
1301
- }
1302
- else {
1303
- console.log('Summary: \n' + messages);
1304
- }
1328
+ return p.then(function () {
1329
+ // if (messages == '')
1330
+ // {
1331
+ // console.log('All published packages are already up-to-date.');
1332
+ // }
1333
+ // else
1334
+ // {
1335
+ console.log('Summary: \n' + results.join('\n'));
1336
+ // }
1305
1337
  });
1306
1338
  };
1307
- var publishPackage = function (pkg, previousResult, test, info, publishVersion) {
1339
+ var publishPackage = function (pkg, test, info, publishVersion) {
1308
1340
  if (!publishVersion) {
1309
- publishVersion = info ? getNextVersion(info.data.version) : '';
1341
+ // publishVersion = info ? getNextVersion(info.data.version) : '';
1342
+ publishVersion = info ? getNextVersion(info.version) : '';
1310
1343
  }
1311
1344
  if (test) {
1312
1345
  debugInfo('should publish ' + pkg.packageName + ' ' + publishVersion);
@@ -1315,25 +1348,25 @@ var publishPackage = function (pkg, previousResult, test, info, publishVersion)
1315
1348
  console.log(chalk.blue('publishing ' + pkg.packageName + ' ' + publishVersion));
1316
1349
  }
1317
1350
  if (!test) {
1318
- return execPromise("cd ".concat(pkg.path, " && yarn publish").concat(publishVersion ? ' --new-version ' + publishVersion : ''), true, false, {}, true)
1351
+ return execPromise("cd ".concat(pkg.path, " && yarn version ").concat(publishVersion, " && yarn npm publish"), true, false, {}, true)
1319
1352
  .then(function (res) {
1320
1353
  if (res.indexOf('Aborted due to warnings') !== -1 ||
1321
1354
  res.indexOf('Could not publish') !== -1 ||
1322
1355
  res.indexOf("Couldn't publish") !== -1) {
1323
1356
  console.log(res);
1324
- return previousResult + ' ' + chalk.red(pkg.packageName + ' failed\n');
1357
+ return chalk.red(pkg.packageName + ' failed\n');
1325
1358
  }
1326
1359
  console.log(chalk.green('Successfully published ' + pkg.path + ' ' + publishVersion));
1327
- return previousResult + ' ' + chalk.green(pkg.packageName + ' published ' + publishVersion + '\n');
1360
+ return chalk.green(pkg.packageName + ' published ' + publishVersion + '\n');
1328
1361
  })["catch"](function (_a) {
1329
1362
  var error = _a.error, stdout = _a.stdout, stderr = _a.stderr;
1330
1363
  console.log(chalk.red('Failed to publish: ' + error.message));
1331
- return previousResult + ' ' + chalk.red(pkg.packageName + ' failed to publish\n');
1364
+ return chalk.red(pkg.packageName + ' failed to publish\n');
1332
1365
  });
1333
1366
  }
1334
1367
  else {
1335
1368
  //when testing what needs to be published
1336
- return previousResult + ' ' + chalk.blue(pkg.packageName + ' should publish\n');
1369
+ return chalk.blue(pkg.packageName + ' should publish');
1337
1370
  }
1338
1371
  };
1339
1372
  var buildUpdated = function (back, target, target2, test) {
@@ -118,8 +118,8 @@ function setupGrunt(grunt, moduleName, config) {
118
118
  // log('setting grunt config');
119
119
  grunt.initConfig({
120
120
  exec: {
121
- 'build-lib': 'tsc --pretty',
122
- 'build-lib-es5': 'tsc --pretty -p tsconfig-es5.json',
121
+ 'build-lib': 'yarn exec tsc --pretty',
122
+ 'build-lib-es5': 'yarn exec tsc --pretty -p tsconfig-es5.json',
123
123
  beforeBuildCommand: config.beforeBuildCommand,
124
124
  'server-dev': 'tsc -w',
125
125
  test: 'tsc -w',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lincd-cli",
3
- "version": "0.2.7",
3
+ "version": "0.2.9",
4
4
  "description": "Command line tools for the lincd.js library",
5
5
  "main": "lib/index.js",
6
6
  "scripts": {
@@ -35,7 +35,7 @@
35
35
  "@babel/preset-react": "^7.18.6",
36
36
  "@babel/preset-typescript": "^7.18.6",
37
37
  "@lodder/grunt-postcss": "^3.1.1",
38
- "@types/node": "^17.0.14",
38
+ "@types/node": "^18.11.10",
39
39
  "@types/react": "^18.0.17",
40
40
  "@types/react-dom": "^18.0.6",
41
41
  "babel-loader": "^8.2.5",
@@ -58,14 +58,14 @@
58
58
  "grunt-webpack": "^5.0.0",
59
59
  "license-info-webpack-plugin": "^3.0.0",
60
60
  "lincd": "^0.5",
61
- "lincd-jsonld": "^0.1.8",
61
+ "lincd-jsonld": "^0.1.13",
62
62
  "load-grunt-tasks": "^5.1.0",
63
63
  "mini-css-extract-plugin": "^2.6.1",
64
64
  "open": "^8.4.0",
65
65
  "postcss": "^8.4.17",
66
66
  "postcss-import": "^15.0.0",
67
67
  "postcss-loader": "^7.0.1",
68
- "postcss-modules": "^5.0.0",
68
+ "postcss-modules": "^6.0.0",
69
69
  "postcss-nested": "^5.0.6",
70
70
  "postcss-scss": "^4.0.5",
71
71
  "require-extensions": "^0.0.4",