@eui/tools 6.1.1 → 6.1.2

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.
@@ -1 +1 @@
1
- 6.1.1
1
+ 6.1.2
package/CHANGELOG.md CHANGED
@@ -1,3 +1,13 @@
1
+ ## 6.1.2 (2022-11-06)
2
+
3
+ ##### Bug Fixes
4
+
5
+ * **other:**
6
+ * slack not rendering certain emoji - MWP-6448 [MWP-6448](https://webgate.ec.europa.eu/CITnet/jira/browse/MWP-6448) ([ec2cdeb7](https://webgate.ec.europa.eu/CITnet/stash/scm/csdr/eui-tools.git/commits/ec2cdeb7f6d506b40649e8ab98952b7eb0203e46))
7
+ * styles auditing only for UI packages - EUI-6448 [EUI-6448](https://webgate.ec.europa.eu/CITnet/jira/browse/EUI-6448) ([265671d9](https://webgate.ec.europa.eu/CITnet/stash/scm/csdr/eui-tools.git/commits/265671d9c756e84771fc2df61d5993957246a268))
8
+
9
+ * * *
10
+ * * *
1
11
  ## 6.1.1 (2022-11-06)
2
12
 
3
13
  ##### Chores
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eui/tools",
3
- "version": "6.1.1",
3
+ "version": "6.1.2",
4
4
  "tag": "latest",
5
5
  "license": "EUPL-1.1",
6
6
  "description": "eUI common tools and scripts",
@@ -337,79 +337,86 @@ const runStylesAudit = module.exports.runStylesAudit = (pkg) => {
337
337
 
338
338
  // CRITICAL ONLY
339
339
 
340
- report.finalReport['inlineStyles'] = {
341
- description: 'inline styles found in HTML',
342
- value: report.inlineStyles.count,
343
- status: (report.inlineStyles.count !== 0) ? 'CRITICAL' : 'OK',
344
- comment: (report.inlineStyles.count !== 0) ? 'No inline styles should be present in html, usage classes with scss / eUI utilities instead' : null
345
- }
346
- report.finalReport['material'] = {
347
- description: 'material component usage found in HTML',
348
- value: report.material.count,
349
- status: (report.material.count !== 0) ? 'CRITICAL' : 'OK',
350
- comment: (report.material.count !== 0) ? 'Usage of material should be avoided' : null
351
- }
352
- report.finalReport['primeng'] = {
353
- description: 'PrimeNG components usage found in HTML',
354
- value: report.primeng.count,
355
- status: (report.primeng.count !== 0) ? 'CRITICAL' : 'OK',
356
- comment: (report.primeng.count !== 0) ? 'Remove any PrimeNG usage, deprecated in eUI' : null
357
- }
358
-
340
+ if (report.htmlLinesCount !== 0) {
341
+ report.finalReport['inlineStyles'] = {
342
+ description: 'inline styles found in HTML',
343
+ value: report.inlineStyles.count,
344
+ status: (report.inlineStyles.count !== 0) ? 'CRITICAL' : 'OK',
345
+ comment: (report.inlineStyles.count !== 0) ? 'No inline styles should be present in html, usage classes with scss / eUI utilities instead' : null
346
+ }
347
+ report.finalReport['material'] = {
348
+ description: 'material component usage found in HTML',
349
+ value: report.material.count,
350
+ status: (report.material.count !== 0) ? 'CRITICAL' : 'OK',
351
+ comment: (report.material.count !== 0) ? 'Usage of material should be avoided' : null
352
+ }
353
+ report.finalReport['primeng'] = {
354
+ description: 'PrimeNG components usage found in HTML',
355
+ value: report.primeng.count,
356
+ status: (report.primeng.count !== 0) ? 'CRITICAL' : 'OK',
357
+ comment: (report.primeng.count !== 0) ? 'Remove any PrimeNG usage, deprecated in eUI' : null
358
+ }
359
359
 
360
+ // IMPROVE ONLY
360
361
 
361
- // IMPROVE ONLY
362
+ report.finalReport['uxCmp'] = {
363
+ description: 'eUI ux- components usage found in HTML',
364
+ value: report.uxCmp.count,
365
+ status: (report.uxCmp.count !== 0) ? 'IMPROVE' : 'OK',
366
+ comment: (report.uxCmp.count !== 0) ? 'Replace by "eui-" components whenever possible, to ensure future proof migration' : null
367
+ }
362
368
 
363
- report.finalReport['uxCmp'] = {
364
- description: 'eUI ux- components usage found in HTML',
365
- value: report.uxCmp.count,
366
- status: (report.uxCmp.count !== 0) ? 'IMPROVE' : 'OK',
367
- comment: (report.uxCmp.count !== 0) ? 'Replace by "eui-" components whenever possible, to ensure future proof migration' : null
369
+ report.finalReport['tsOver500'] = {
370
+ description: 'TS file containing more than 500 lines',
371
+ value: report.tsOver500.count,
372
+ status: (report.tsOver500.count !== 0) ? 'IMPROVE' : 'OK',
373
+ comment: (report.tsOver500.count !== 0) ? 'Split TS files into multiple ones for readability' : null
374
+ }
368
375
  }
369
376
 
370
- report.finalReport['tsOver500'] = {
371
- description: 'TS file containing more than 500 lines',
372
- value: report.tsOver500.count,
373
- status: (report.tsOver500.count !== 0) ? 'IMPROVE' : 'OK',
374
- comment: (report.tsOver500.count !== 0) ? 'Split TS files into multiple ones for readability' : null
375
- }
376
377
 
377
378
 
378
- // Calculating score
379
+ if (Object.keys(report.finalReport).length === 0) {
380
+ tools.logInfo('No sources to audit...skipping');
381
+ return null;
379
382
 
380
- let score = 0, total = 0;
383
+ } else {
384
+ // Calculating score
381
385
 
382
- Object.entries(report.finalReport).forEach((v) => {
383
- total++;
386
+ let score = 0, total = 0;
384
387
 
385
- switch(v[1].status) {
386
- case 'OK':
387
- score++;
388
- break;
389
- case 'IMPROVE':
390
- score+=0.5;
391
- break;
392
- }
393
- });
388
+ Object.entries(report.finalReport).forEach((v) => {
389
+ total++;
390
+
391
+ switch(v[1].status) {
392
+ case 'OK':
393
+ score++;
394
+ break;
395
+ case 'IMPROVE':
396
+ score+=0.5;
397
+ break;
398
+ }
399
+ });
394
400
 
395
- report.score = score;
396
- report.total = total;
397
- report.pcScore = Math.floor(100 * score / total);
401
+ report.score = score;
402
+ report.total = total;
403
+ report.pcScore = Math.floor(100 * score / total);
398
404
 
399
405
 
400
- // return JSON report
406
+ // return JSON report
401
407
 
402
- tools.logInfo('STATS report');
403
- console.log(JSON.stringify(report, null, 2));
408
+ tools.logInfo('STATS report');
409
+ console.log(JSON.stringify(report, null, 2));
404
410
 
405
- return report;
411
+ return report;
412
+ }
406
413
  }
407
414
 
408
415
 
409
416
 
410
417
 
411
418
  module.exports.audit = (pkg) => {
412
- if (pkg.remote) {
419
+ if (pkg.remote && pkg.name.indexOf('-ui') === -1) {
413
420
  return;
414
421
  }
415
422
 
@@ -420,6 +427,11 @@ module.exports.audit = (pkg) => {
420
427
 
421
428
  const report = runStylesAudit(pkg);
422
429
 
430
+ if (!report) {
431
+ return;
432
+ }
433
+
434
+
423
435
  // FINAL REPORT
424
436
 
425
437
  let finalReportMessage = `*STYLES AUDIT REPORT for ${pkg.name}:*\n\n`;
@@ -432,10 +444,10 @@ module.exports.audit = (pkg) => {
432
444
  } else if (v[1].status === 'IMPROVE') {
433
445
  statusEmoji = ':warning:';
434
446
  } else {
435
- statusEmoji = ':white_tick:';
447
+ statusEmoji = ':large_green_circle:';
436
448
  }
437
449
 
438
- finalReportMessage += `:black_small_square: ${statusEmoji} *${v[1].description}*: found *${v[1].value}* - status: *${v[1].status}* ${(v[1].comment) ? '==> ' + v[1].comment : ''}\n`;
450
+ finalReportMessage += `${statusEmoji} *${v[1].description}*: found *${v[1].value}* - status: *${v[1].status}* ${(v[1].comment) ? '==> ' + v[1].comment : ''}\n`;
439
451
  });
440
452
 
441
453
  finalReportMessage +=`\neUI compliance score : *${report.score}* out of *${report.total}* *(${report.pcScore}%)*`;