@eui/tools 6.12.31 → 6.12.33

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.12.31
1
+ 6.12.33
package/CHANGELOG.md CHANGED
@@ -1,3 +1,21 @@
1
+ ## 6.12.33 (2023-07-26)
2
+
3
+ ##### Chores
4
+
5
+ * **other:**
6
+ * integrate workspaces links generation on pre-build route replacement - MWP-9751 [MWP-9751](https://webgate.ec.europa.eu/CITnet/jira/browse/MWP-9751) ([6ee4edc3](https://webgate.ec.europa.eu/CITnet/stash/scm/csdr/eui-tools.git/commits/6ee4edc307230443351043877d1d529bb1e199c5))
7
+
8
+ * * *
9
+ * * *
10
+ ## 6.12.32 (2023-07-24)
11
+
12
+ ##### Chores
13
+
14
+ * **other:**
15
+ * added mywp-shared audit checks for no sub-entry usage - bypass style audit with disabled feature - EUI-7121 [EUI-7121](https://webgate.ec.europa.eu/CITnet/jira/browse/EUI-7121) ([03bf262e](https://webgate.ec.europa.eu/CITnet/stash/scm/csdr/eui-tools.git/commits/03bf262e20662030ab31a5bbecaf5932b0f282f9))
16
+
17
+ * * *
18
+ * * *
1
19
  ## 6.12.31 (2023-07-24)
2
20
 
3
21
  ##### Chores
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eui/tools",
3
- "version": "6.12.31",
3
+ "version": "6.12.33",
4
4
  "tag": "latest",
5
5
  "license": "EUPL-1.1",
6
6
  "description": "eUI common tools and scripts",
@@ -93,6 +93,7 @@ const runStylesAudit = (module.exports.runStylesAudit = (pkg, customPath) => {
93
93
  htmlFilesCount: 0,
94
94
  htmlLinesCount: 0,
95
95
  scssLinescount: 0,
96
+ stylesAuditDisabledCount: 0,
96
97
  tsOver500: {
97
98
  count: 0,
98
99
  files: [],
@@ -153,6 +154,10 @@ const runStylesAudit = (module.exports.runStylesAudit = (pkg, customPath) => {
153
154
  count: 0,
154
155
  indices: []
155
156
  },
157
+ mywpSharedAll: {
158
+ count: 0,
159
+ indices: []
160
+ },
156
161
  finalReport: {},
157
162
  };
158
163
 
@@ -175,6 +180,11 @@ const runStylesAudit = (module.exports.runStylesAudit = (pkg, customPath) => {
175
180
  const fileContent = tools.getFileContent(filePath).trim();
176
181
  const linesCount = fileContent.split('\n').length;
177
182
 
183
+ if (fileContent.indexOf('styles-audit-disabled') !== -1) {
184
+ report.stylesAuditDisabledCount++;
185
+ return;
186
+ }
187
+
178
188
  if (fileContent === '') {
179
189
  report.scssEmptyFiles++;
180
190
  }
@@ -255,6 +265,11 @@ const runStylesAudit = (module.exports.runStylesAudit = (pkg, customPath) => {
255
265
  const fileContent = tools.getFileContent(filePath);
256
266
  const linesCount = fileContent.split('\n').length;
257
267
 
268
+ if (fileContent.indexOf('styles-audit-disabled') !== -1) {
269
+ report.stylesAuditDisabledCount++;
270
+ return;
271
+ }
272
+
258
273
  report.htmlLinesCount += linesCount;
259
274
 
260
275
  let result,
@@ -286,6 +301,11 @@ const runStylesAudit = (module.exports.runStylesAudit = (pkg, customPath) => {
286
301
  const fileContent = tools.getFileContent(filePath);
287
302
  const linesCount = fileContent.split('\n').length;
288
303
 
304
+ if (fileContent.indexOf('styles-audit-disabled') !== -1) {
305
+ report.stylesAuditDisabledCount++;
306
+ return;
307
+ }
308
+
289
309
  if (linesCount > 500) {
290
310
  report.tsOver500.count++;
291
311
  report.tsOver500.files.push(file);
@@ -324,6 +344,14 @@ const runStylesAudit = (module.exports.runStylesAudit = (pkg, customPath) => {
324
344
  }
325
345
  report.allModules.count += allModulesIndices.length;
326
346
  report.allModules.indices = [...report.allModules.indices, ...generateIndicesContent(allModulesIndices, file, fileContent)];
347
+
348
+ let mywpSharedAllIndices = [];
349
+ regex = /\@mywp\/shared'|\@mywp\/shared"/gi;
350
+ while ((result = regex.exec(fileContent))) {
351
+ mywpSharedAllIndices.push(result.index);
352
+ }
353
+ report.mywpSharedAll.count += mywpSharedAllIndices.length;
354
+ report.mywpSharedAll.indices = [...report.mywpSharedAll.indices, ...generateIndicesContent(mywpSharedAllIndices, file, fileContent)];
327
355
  });
328
356
 
329
357
  // Analyzing 3rd party dependencies usage
@@ -403,6 +431,15 @@ const runStylesAudit = (module.exports.runStylesAudit = (pkg, customPath) => {
403
431
  };
404
432
  }
405
433
 
434
+ if (report.stylesAuditDisabledCount !==0) {
435
+ report.finalReport['stylesAuditDisabledCount'] = {
436
+ description: 'audit disabled count',
437
+ value: report.stylesAuditDisabledCount,
438
+ status: report.stylesAuditDisabledCount !== 0 ? 'IMPROVE': 'OK',
439
+ comment : report.stylesAuditDisabledCount !==0 ? 'If not done yet, files to be checked by eUI team': null,
440
+ }
441
+ }
442
+
406
443
  // BALANCED - styles content
407
444
 
408
445
  if (report.scssFilesCount !== 0) {
@@ -492,6 +529,12 @@ const runStylesAudit = (module.exports.runStylesAudit = (pkg, customPath) => {
492
529
  status: report.allModules.count !== 0 ? 'CRITICAL' : 'OK',
493
530
  comment: report.allModules.count !== 0 ? 'Use only tree-shakable eUI module imports (as of 15+)' : null,
494
531
  };
532
+ report.finalReport['mywpSharedAll'] = {
533
+ description: 'Usage of @mywp/shared import without sub-entry',
534
+ value: report.mywpSharedAll.count,
535
+ status: report.mywpSharedAll.count !== 0 ? 'CRITICAL' : 'OK',
536
+ comment: report.mywpSharedAll.count !== 0 ? 'use only import of @mywp/shared/SUB_ENTRY (as of 16+)' : null,
537
+ };
495
538
 
496
539
  // IMPROVE ONLY
497
540
 
@@ -106,6 +106,11 @@ const injectRoutesConfig = (project) => {
106
106
 
107
107
  tools.logInfo(`${routesConfigPath} - injecting in ${project.paths.assetsPath}`);
108
108
  tools.copydir(routesConfigPath, project.paths.assetsPath);
109
+
110
+ const workspacesConfigPath = path.join(pkgAssetsPath, project.externalRoutesSources.workspacesConfigAssetsPath);
111
+ tools.logInfo(`${workspacesConfigPath} - injecting in ${project.paths.assetsPath}`);
112
+ tools.copydir(workspacesConfigPath, project.paths.assetsPath);
113
+
109
114
  };
110
115
 
111
116
 
@@ -418,6 +423,8 @@ const generateLinks = (project, routes, envTargetFinal) => {
418
423
  const routeDefsBaseLinksJSON = require(path.join(project.paths.assetsPath, routeDefsBaseLinksFileName));
419
424
  const routeDefsBaseFilename = 'route-defs-base.json';
420
425
  const routeDefsBaseJSON = require(path.join(project.paths.assetsPath, routeDefsBaseFilename));
426
+ const workspaceDefsBaseFilename = 'workspace-defs-base.json';
427
+ const workspaceDefsBaseJSON = require(path.join(project.paths.assetsPath, workspaceDefsBaseFilename));
421
428
 
422
429
  const getRouteMenuDef = (link) => {
423
430
  let routeDef = null;
@@ -476,11 +483,36 @@ const generateLinks = (project, routes, envTargetFinal) => {
476
483
  }
477
484
  };
478
485
 
486
+ // global links combining routes links and workspaces links
487
+ let workspaceLinks = [];
488
+
489
+ // Combining workspaces definitions with base links definitions
490
+
491
+ workspaceDefsBaseJSON.forEach((wp) => {
492
+ if (wp.baseLinkDefs) {
493
+ wp.baseLinkDefs.forEach((wpLink) => {
494
+ workspaceLinks.push({
495
+ ...wpLink,
496
+ workspace: wp.id
497
+ });
498
+ });
499
+ }
500
+ });
501
+
502
+ tools.logInfo('Workspaces links generated :');
503
+ console.log(workspaceLinks);
504
+
505
+ const globalLinks = [
506
+ ...routeDefsBaseLinksJSON,
507
+ ...workspaceLinks,
508
+ ];
509
+
510
+
479
511
  // processing each link and matching route from routes base data definitions
480
512
 
481
513
  const linksGenerated = [];
482
514
 
483
- routeDefsBaseLinksJSON.forEach((link) => {
515
+ globalLinks.forEach((link) => {
484
516
  let newLink = null;
485
517
 
486
518
  if (link.parentId) {