@eui/tools 6.12.30 → 6.12.31

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.30
1
+ 6.12.31
package/CHANGELOG.md CHANGED
@@ -1,3 +1,12 @@
1
+ ## 6.12.31 (2023-07-24)
2
+
3
+ ##### Chores
4
+
5
+ * **other:**
6
+ * adapted routes replacement generation for workspaces refactoring - EUI-7121 [EUI-7121](https://webgate.ec.europa.eu/CITnet/jira/browse/EUI-7121) ([35c997f9](https://webgate.ec.europa.eu/CITnet/stash/scm/csdr/eui-tools.git/commits/35c997f94958ce10d4064017f3cd0a9604a18351))
7
+
8
+ * * *
9
+ * * *
1
10
  ## 6.12.30 (2023-07-21)
2
11
 
3
12
  ##### Chores
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eui/tools",
3
- "version": "6.12.30",
3
+ "version": "6.12.31",
4
4
  "tag": "latest",
5
5
  "license": "EUPL-1.1",
6
6
  "description": "eUI common tools and scripts",
@@ -428,6 +428,7 @@ const generateLinks = (project, routes, envTargetFinal) => {
428
428
  r.menuLinkDefs.forEach((md) => {
429
429
  if (md.url === link.url) {
430
430
  routeDef = md;
431
+ routeDef.path = r.path;
431
432
  if (link.id) {
432
433
  routeDef.id = link.id;
433
434
  }
@@ -440,26 +441,11 @@ const generateLinks = (project, routes, envTargetFinal) => {
440
441
  if (link.dashboardWidgetDisabled) {
441
442
  routeDef.dashboardWidgetDisabled = link.dashboardWidgetDisabled;
442
443
  }
443
- return;
444
- }
445
- });
446
- }
447
- });
448
- }
449
-
450
- return routeDef;
451
- };
452
-
453
- const getRouteDefFromMenuLink = (link) => {
454
- let routeDef = null;
444
+ if (link.alwaysDisplayed) {
445
+ routeDef.alwaysDisplayed = link.alwaysDisplayed;
446
+ }
455
447
 
456
- if (link.url) {
457
- routeDefsBaseJSON.forEach((r) => {
458
- if (r.menuLinkDefs && r.menuLinkDefs.length > 0) {
459
- r.menuLinkDefs.forEach((md) => {
460
- if (md.url === link.url) {
461
- routeDef = r;
462
- return;
448
+ return;
463
449
  }
464
450
  });
465
451
  }
@@ -495,7 +481,7 @@ const generateLinks = (project, routes, envTargetFinal) => {
495
481
  const linksGenerated = [];
496
482
 
497
483
  routeDefsBaseLinksJSON.forEach((link) => {
498
- let newLink;
484
+ let newLink = null;
499
485
 
500
486
  if (link.parentId) {
501
487
  if (isLinkAllowed(link)) {
@@ -507,6 +493,16 @@ const generateLinks = (project, routes, envTargetFinal) => {
507
493
  const defRoute = getRouteMenuDef(subLink);
508
494
 
509
495
  if (defRoute) {
496
+ if (project.externalRoutesSources.routesFilenameTemplate.indexOf('playground') > 0) {
497
+ const routePathInInputRoutes = routes.filter(r => r.angularRouteDef.path === defRoute.path)[0];
498
+
499
+ if (!routePathInInputRoutes) {
500
+ defRoute.disabled = true;
501
+
502
+ } else {
503
+ tools.logInfo(`[${defRoute.url}] --> route found in input routes - enabled`);
504
+ }
505
+ }
510
506
  newLink.children.push(defRoute);
511
507
  }
512
508
  }
@@ -517,13 +513,18 @@ const generateLinks = (project, routes, envTargetFinal) => {
517
513
  const defRoute = getRouteMenuDef(link);
518
514
 
519
515
  if (defRoute) {
520
- newLink = defRoute;
521
- } else {
522
- newLink = link;
523
- }
516
+ if (project.externalRoutesSources.routesFilenameTemplate.indexOf('playground') > 0) {
517
+ const routePathInInputRoutes = routes.filter(r => r.angularRouteDef.path === defRoute.path)[0];
524
518
 
525
- if (link.alwaysDisplayed) {
526
- newLink.alwaysDisplayed = true;
519
+ if (!routePathInInputRoutes) {
520
+ defRoute.disabled = true;
521
+ } else {
522
+ tools.logInfo(`[${defRoute.url}] --> route found in input routes - enabled`);
523
+ }
524
+ }
525
+ newLink = {...defRoute};
526
+ } else {
527
+ newLink = {...link};
527
528
  }
528
529
  }
529
530
  }
@@ -531,71 +532,16 @@ const generateLinks = (project, routes, envTargetFinal) => {
531
532
  if (newLink) {
532
533
  linksGenerated.push(newLink);
533
534
  }
534
-
535
- if (debug) {
536
- console.log('Links generated');
537
- console.log(JSON.stringify(linksGenerated));
538
- }
539
535
  });
540
536
 
541
- tools.logInfo(`Links generated : ${linksGenerated.length} found`);
542
-
543
- // checking if in playground route mode (local dev), in this case we mark the non-existing routes
544
- // as disabled locally
545
- let finalLinksGenerated = [];
546
- if (project.externalRoutesSources.routesFilenameTemplate.indexOf('playground') > 0) {
547
- tools.logInfo('Disabling non-active routes for playground');
548
-
549
- linksGenerated.forEach((link) => {
550
- let newLink = link;
551
-
552
- if (link.parentId) {
553
- let newLinkChildren = [];
554
-
555
- link.children.forEach((subLink) => {
556
- const defRoute = getRouteDefFromMenuLink(subLink);
557
-
558
- if (defRoute) {
559
- const routePathInInputRoutes = routes.filter(r => r.angularRouteDef.path === defRoute.path)[0];
560
-
561
- if (!routePathInInputRoutes) {
562
- subLink.disabled = true;
563
-
564
- } else {
565
- tools.logInfo(`[${subLink.url}] --> route found in input routes - enabled`);
566
- }
567
- }
568
- newLinkChildren.push(subLink);
569
- });
570
- newLink.children = newLinkChildren;
571
-
572
- const enabledChildren = newLink.children.filter(c => !c.disabled);
573
- if (enabledChildren.length === 0) {
574
- newLink.disabled = true;
575
- }
576
-
577
- } else {
578
- const defRoute = getRouteDefFromMenuLink(link);
579
-
580
- if (defRoute) {
581
- const routePathInInputRoutes = routes.filter(r => r.angularRouteDef.path === defRoute.path)[0];
537
+ // if (debug) {
538
+ // console.log('Links generated');
539
+ // console.log(linksGenerated);
540
+ // }
582
541
 
583
- if (!routePathInInputRoutes) {
584
- newLink.disabled = true;
585
- } else {
586
- tools.logInfo(`[${link.url}] --> route found in input routes - enabled`);
587
- }
588
- }
589
- }
590
-
591
- finalLinksGenerated.push(newLink);
592
- });
593
-
594
- } else {
595
- finalLinksGenerated = linksGenerated;
596
- }
542
+ tools.logInfo(`Links generated : ${linksGenerated.length} found`);
597
543
 
598
- tools.writeJsonFileSync(path.join(project.paths.assetsPath, 'route-defs-links.json'), finalLinksGenerated);
544
+ tools.writeJsonFileSync(path.join(project.paths.assetsPath, 'route-defs-links.json'), linksGenerated);
599
545
  }
600
546
 
601
547