@eui/tools 6.11.21 → 6.11.23

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.11.21
1
+ 6.11.23
package/CHANGELOG.md CHANGED
@@ -1,3 +1,25 @@
1
+ ## 6.11.23 (2023-05-31)
2
+
3
+ ##### Chores
4
+
5
+ * **other:**
6
+ * adapted pre-build translations compilation tool for handling additional folders through config - EUI-7121 [EUI-7121](https://webgate.ec.europa.eu/CITnet/jira/browse/EUI-7121) ([183da80a](https://webgate.ec.europa.eu/CITnet/stash/scm/csdr/eui-tools.git/commits/183da80a893ec264306290f754aa65c2945e9fd8))
7
+
8
+ * * *
9
+ * * *
10
+ ## 6.11.22 (2023-05-15)
11
+
12
+ ##### Chores
13
+
14
+ * **other:**
15
+ * prevent hotfix for dev/tst releases of remotes - added gates for styles audit (v16+) - EUI-7121 [EUI-7121](https://webgate.ec.europa.eu/CITnet/jira/browse/EUI-7121) ([4e85e2a5](https://webgate.ec.europa.eu/CITnet/stash/scm/csdr/eui-tools.git/commits/4e85e2a50b88ff889e15eedcb22276a7ef7c6a5e))
16
+ ##### Bug Fixes
17
+
18
+ * **other:**
19
+ * styles gates values comparison - EUI-7121 [EUI-7121](https://webgate.ec.europa.eu/CITnet/jira/browse/EUI-7121) ([3fb7a751](https://webgate.ec.europa.eu/CITnet/stash/scm/csdr/eui-tools.git/commits/3fb7a751ab2f15b395de30f9a24102902f1b9cb2))
20
+
21
+ * * *
22
+ * * *
1
23
  ## 6.11.21 (2023-05-11)
2
24
 
3
25
  ##### Chores
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eui/tools",
3
- "version": "6.11.21",
3
+ "version": "6.11.23",
4
4
  "tag": "latest",
5
5
  "license": "EUPL-1.1",
6
6
  "description": "eUI common tools and scripts",
@@ -7,6 +7,7 @@ const glob = require('glob');
7
7
  // LOCAL
8
8
  const tools = require('../../utils/tools');
9
9
  const notificationUtils = require('../../utils/notification/notification-utils');
10
+ const configUtils = require('../config/config-utils');
10
11
 
11
12
 
12
13
  const runStylesAudit = module.exports.runStylesAudit = (pkg, customPath) => {
@@ -371,13 +372,13 @@ const runStylesAudit = module.exports.runStylesAudit = (pkg, customPath) => {
371
372
  description: 'material component usage found in HTML',
372
373
  value: report.material.count,
373
374
  status: (report.material.count !== 0) ? 'CRITICAL' : 'OK',
374
- comment: (report.material.count !== 0) ? 'Usage of material should be avoided' : null
375
+ comment: (report.material.count !== 0) ? 'Usage of material should be avoided - this will be blocking as of eUI 16' : null
375
376
  }
376
377
  report.finalReport['primeng'] = {
377
378
  description: 'PrimeNG components usage found in HTML',
378
379
  value: report.primeng.count,
379
380
  status: (report.primeng.count !== 0) ? 'CRITICAL' : 'OK',
380
- comment: (report.primeng.count !== 0) ? 'Remove any PrimeNG usage, deprecated in eUI' : null
381
+ comment: (report.primeng.count !== 0) ? 'Remove any PrimeNG usage, deprecated in eUI - this will be blocking as of eUI 16' : null
381
382
  }
382
383
 
383
384
  // IMPROVE ONLY
@@ -445,16 +446,14 @@ module.exports.audit = (pkg) => {
445
446
 
446
447
  tools.logTitle('Audit package styles');
447
448
 
448
- return Promise.resolve()
449
- .then(() => {
450
-
451
- const report = runStylesAudit(pkg);
452
-
453
- if (!report) {
454
- return;
455
- }
449
+ const report = runStylesAudit(pkg);
456
450
 
451
+ if (!report) {
452
+ return;
453
+ }
457
454
 
455
+ return Promise.resolve()
456
+ .then(() => {
458
457
  // FINAL REPORT
459
458
 
460
459
  let finalReportMessage = `*STYLES AUDIT REPORT for ${pkg.name}:*\n\n`;
@@ -482,10 +481,60 @@ module.exports.audit = (pkg) => {
482
481
  package: pkg,
483
482
  text: finalReportMessage
484
483
  });
484
+ })
485
485
 
486
- })
487
- .catch((e) => {
488
- console.log(e);
486
+ .then(() => {
487
+ // getting config options for gates defined
488
+ const configOptions = configUtils.global.getConfigOptions();
489
+
490
+ // getting local csdr euiVersion
491
+ const euiVersion = configUtils.global.getLocalEuiVersion();
492
+
493
+ // if eUI version not found, no action
494
+ if (!euiVersion) {
495
+ return;
496
+ }
497
+
498
+ // getting gates for euiVersion found
499
+ const gates = configOptions.AUDIT_STYLES_GATES[euiVersion];
500
+
501
+ tools.logTitle(`Checking audit styles gates for local euiVersion : ${euiVersion}`);
502
+
503
+ // if no gates found for corresponding version, no action
504
+ if (!gates) {
505
+ tools.logInfo('No gates found for local eUI version...skipping');
506
+ return;
507
+ }
508
+
509
+ tools.logInfo(`Gates found : ${JSON.stringify(gates)}`);
510
+
511
+ // checking gates level if any
512
+ let gatesPassed = true;
513
+
514
+ Object.keys(report.finalReport).forEach((styleCategory) => {
515
+ tools.logInfo(`Checking audit styles category : ${styleCategory} - item found ${report.finalReport[styleCategory].value}`);
516
+
517
+ if (gates[styleCategory] === undefined) {
518
+ tools.logInfo(`No gates found for category`);
519
+ tools.logInfo(`===> PASSED`);
520
+ } else {
521
+ tools.logInfo(`Gates found for category maxium allowed : ${gates[styleCategory]}`);
522
+ if (report.finalReport[styleCategory].value > gates[styleCategory]) {
523
+ tools.logError(`===> FAILED`);
524
+ gatesPassed = false;
525
+ } else {
526
+ tools.logInfo(`===> PASSED`);
527
+ }
528
+ }
529
+ })
530
+
531
+ if (!gatesPassed) {
532
+ throw new Error('AUDIT_STYLES_GATES_FAILED');
533
+ }
534
+ })
535
+
536
+ .catch((e) => {
537
+ throw e;
489
538
  })
490
539
 
491
540
  }
@@ -236,6 +236,7 @@ module.exports.getConfigOptions = () => {
236
236
  MSTEAMS_CHANNELS_EMAILS: null,
237
237
  API_HOST: null,
238
238
  AUDIT_DEPENDENCIES_GATES: null,
239
+ AUDIT_STYLES_GATES: null
239
240
  }
240
241
 
241
242
  // getting devops metadata options
@@ -374,6 +375,19 @@ module.exports.getConfigOptions = () => {
374
375
  })
375
376
  }
376
377
  }
378
+
379
+ if (audit.styles) {
380
+ if (audit.styles.gates) {
381
+ configOptions.AUDIT_STYLES_GATES = [];
382
+ Object.keys(audit.styles.gates).forEach((v) => {
383
+ const gatesForVersion = audit.styles.gates[v];
384
+ configOptions.AUDIT_STYLES_GATES[v] = {
385
+ "material": gatesForVersion.material,
386
+ "primeng": gatesForVersion.primeng
387
+ };
388
+ })
389
+ }
390
+ }
377
391
  }
378
392
 
379
393
 
@@ -262,6 +262,10 @@ module.exports.getPackageVersionsByMajor = (pkg, major, isMaster) => {
262
262
  tools.logInfo(`----> ${versions.length} metadata versions non-master release for major`);
263
263
  }
264
264
 
265
+ tools.logInfo('----> exluding hotfix package versions type');
266
+ versions = versions.filter(v => !v.hotfix);
267
+ tools.logInfo(`----> ${versions.length} metadata versions excluding hotfix version type`);
268
+
265
269
  return versions;
266
270
  }
267
271
  }
@@ -103,12 +103,6 @@ module.exports.run = () => {
103
103
  .then(() => {
104
104
  return innerUi.install(pkg, branches.isMaster);
105
105
  })
106
- // CHECK STYLES USAGE
107
- .then(() => {
108
- if (!pkg.build || (pkg.build && !pkg.build.skipAudit)) {
109
- return auditUtils.styles.audit(pkg);
110
- }
111
- })
112
106
 
113
107
  // AUDIT DEPENDENCIES
114
108
  .then(() => {
@@ -8,6 +8,7 @@ const execa = require('execa');
8
8
  const tools = require('../../tools');
9
9
  const notificationUtils = require('../../notification/notification-utils');
10
10
  const cleanUtils = require('../../clean/clean-utils');
11
+ const auditUtils = require('../../../csdr/audit/audit-utils');
11
12
 
12
13
  module.exports.build = (pkg, isMaster) => {
13
14
 
@@ -16,7 +17,7 @@ module.exports.build = (pkg, isMaster) => {
16
17
  const ng = path.resolve(process.cwd(), 'node_modules', '@angular', 'cli', 'bin', 'ng');
17
18
 
18
19
  // FETCH ARGS
19
- let { deps, skipClean, skipLint, skipTest, skipCompile, skipDoc, build } = pkg.build? {...pkg.build, ...tools.getArgs()} : tools.getArgs();
20
+ let { deps, skipClean, skipLint, skipTest, skipCompile, skipDoc, build, skipAudit } = pkg.build? {...pkg.build, ...tools.getArgs()} : tools.getArgs();
20
21
 
21
22
  return Promise.resolve()
22
23
  .then(() => {
@@ -86,6 +87,12 @@ module.exports.build = (pkg, isMaster) => {
86
87
  if (!skipTest) {
87
88
  tools.logSuccess();
88
89
  }
90
+
91
+ if (!skipAudit) {
92
+ return auditUtils.styles.audit(pkg);
93
+ }
94
+ })
95
+ .then(() => {
89
96
  if (!skipCompile) {
90
97
  tools.logInfo('Bundling package...');
91
98
  let args = ['--max_old_space_size=8096', ng, 'build', pkg.name];
@@ -72,7 +72,7 @@ module.exports.generate = (inputScopes = '', inputPkg) => {
72
72
  tools.logInfo(`langs: ${langs}`);
73
73
  tools.logInfo(`dest folder: ${destFolder}`);
74
74
  tools.logInfo(`total packages: ${packages.length}`);
75
- tools.logInfo(packages);
75
+ tools.logInfo(JSON.stringify(packages, null, 1));
76
76
  })
77
77
 
78
78
  .then(() => {
@@ -88,25 +88,16 @@ module.exports.generate = (inputScopes = '', inputPkg) => {
88
88
  addTranslation(file, lang);
89
89
 
90
90
  // Add module translations
91
- packages.forEach((pkg) => {
91
+ packages.forEach((pkgDeps) => {
92
92
  let baseI18nPath = 'i18n';
93
93
  if (pkg.scope === '@eui') {
94
94
  baseI18nPath = 'i18n-eui';
95
95
  }
96
- file = path.join(pkg.folder, `assets/${baseI18nPath}/${lang}.json`);
97
-
98
- tools.logInfo(`Adding translations from ${pkg.folder}`);
99
- if (tools.isFileExists(file)) {
100
- tools.logInfo(`${file} found...adding`);
101
- addTranslation(file, lang)
102
- } else {
103
- file = path.join(pkg.folder, `assets/i18n/${lang}.json`);
104
- if (tools.isFileExists(file)) {
105
- tools.logInfo(`${file} found...adding`);
106
- addTranslation(file, lang)
107
- } else {
108
- tools.logInfo(`${file} not found...skipping`);
109
- }
96
+ processTranslationsFolder(pkgDeps, baseI18nPath, lang);
97
+
98
+ // process additional translation folders if set as option in config
99
+ if (pkg.build && pkg.build.translationAdditionalFolders) {
100
+ processTranslationsFolder(pkgDeps, pkg.build.translationAdditionalFolders, lang);
110
101
  }
111
102
  });
112
103
 
@@ -138,6 +129,26 @@ module.exports.generate = (inputScopes = '', inputPkg) => {
138
129
  }
139
130
  }
140
131
  }
132
+
133
+ function processTranslationsFolder(pkg, folder, lang) {
134
+ tools.logInfo(`------>Scanning ${folder}`);
135
+
136
+ let file = path.join(pkg.folder, `assets/${folder}/${lang}.json`);
137
+
138
+ tools.logInfo(`Adding translations from ${pkg.folder}`);
139
+ if (tools.isFileExists(file)) {
140
+ tools.logInfo(`${file} found...adding`);
141
+ addTranslation(file, lang)
142
+ } else {
143
+ file = path.join(pkg.folder, `assets/i18n/${lang}.json`);
144
+ if (tools.isFileExists(file)) {
145
+ tools.logInfo(`${file} found...adding`);
146
+ addTranslation(file, lang)
147
+ } else {
148
+ tools.logInfo(`${file} not found...skipping`);
149
+ }
150
+ }
151
+ }
141
152
  })
142
153
  .catch((e) => {
143
154
  throw e;