@eui/tools 6.12.20 → 6.12.22

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.20
1
+ 6.12.22
package/CHANGELOG.md CHANGED
@@ -1,3 +1,21 @@
1
+ ## 6.12.22 (2023-06-26)
2
+
3
+ ##### Bug Fixes
4
+
5
+ * **other:**
6
+ * ag-grid license injection race condition - EUI-7121 [EUI-7121](https://webgate.ec.europa.eu/CITnet/jira/browse/EUI-7121) ([7337d6ed](https://webgate.ec.europa.eu/CITnet/stash/scm/csdr/eui-tools.git/commits/7337d6eddba6419f0aa6405abef3a2e03cd4ffdf))
7
+
8
+ * * *
9
+ * * *
10
+ ## 6.12.21 (2023-06-26)
11
+
12
+ ##### Chores
13
+
14
+ * **other:**
15
+ * disable non-existing route for playground - EUI-7121 [EUI-7121](https://webgate.ec.europa.eu/CITnet/jira/browse/EUI-7121) ([62f8497d](https://webgate.ec.europa.eu/CITnet/stash/scm/csdr/eui-tools.git/commits/62f8497d3cdc4fbc5d558c28510aef639f7c8618))
16
+
17
+ * * *
18
+ * * *
1
19
  ## 6.12.20 (2023-06-25)
2
20
 
3
21
  ##### Chores
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eui/tools",
3
- "version": "6.12.20",
3
+ "version": "6.12.22",
4
4
  "tag": "latest",
5
5
  "license": "EUPL-1.1",
6
6
  "description": "eUI common tools and scripts",
@@ -196,6 +196,30 @@ module.exports.generateVirtualRemote = (remoteName, cloneRemote = true) => {
196
196
  // license token is replaced at post-install, we get it from the remote root UI pkg assets at specific location
197
197
  if (remote.skeletonConfig.aggridLicenseInjection) {
198
198
  tools.copy(optionAgGridPath, remoteSrcPath);
199
+
200
+ const rootPkgLicensePath = path.join(
201
+ remote.paths.repoNodeModules,
202
+ remote.skeletonConfig.rootNpmPkg,
203
+ 'assets', 'ag-grid-license', 'license.json'
204
+ );
205
+
206
+ if (!tools.isFileExists(rootPkgLicensePath)) {
207
+ throw 'NO_LICENSE_FILE_FOUND';
208
+ }
209
+
210
+ const licenseJSON = tools.getJsonFileContent(rootPkgLicensePath);
211
+ const license = licenseJSON.license;
212
+ tools.logInfo(`license key found : ${license}`);
213
+
214
+ const mainTsPath = path.join(remote.paths.src, 'main.ts');
215
+ console.log(`replacing in ${mainTsPath}`);
216
+ tools.replaceInFileSync(mainTsPath, 'LICENSE_KEY_VALUE', license);
217
+
218
+ tools.logInfo('main.ts content after replacement : ');
219
+ const mainTsContent = tools.getFileContent(mainTsPath);
220
+ console.log(mainTsContent);
221
+
222
+ tools.logSuccess('OK => main.ts replaced');
199
223
  }
200
224
 
201
225
  // if options, all options are checked and default modules defs are injected following certain conditions
@@ -39,10 +39,6 @@ module.exports.installRemote = (pkg, envTarget, compositeType) => {
39
39
  deps = outputDeps;
40
40
  })
41
41
 
42
- .then(() => {
43
- return innerRemotes.postInstall(pkg);
44
- })
45
-
46
42
  // returning metadata dependencies
47
43
  .then(() => {
48
44
  return deps;
@@ -171,49 +171,3 @@ module.exports.installDeps = (pkg, envTarget, compositeType) => {
171
171
  throw e;
172
172
  })
173
173
  }
174
-
175
-
176
- module.exports.postInstall = (pkg) => {
177
- tools.logTitle('Executing post-install for remote skeleton replacement fetched from root UI package');
178
-
179
- if (!pkg.fullSkeletonSources) {
180
- return;
181
- }
182
-
183
- if (!pkg.skeletonConfig) {
184
- return;
185
- }
186
-
187
- if (pkg.skeletonConfig.aggridLicenseInjection) {
188
- return Promise.resolve()
189
- .then(() => {
190
- const rootPkgLicensePath = path.join(
191
- pkg.paths.repoNodeModules,
192
- pkg.skeletonConfig.rootNpmPkg,
193
- 'assets', 'ag-grid-license', 'license.json'
194
- );
195
-
196
- if (!tools.isFileExists(rootPkgLicensePath)) {
197
- throw 'NO_LICENSE_FILE_FOUND';
198
- }
199
-
200
- const licenseJSON = tools.getJsonFileContent(rootPkgLicensePath);
201
- const license = licenseJSON.license;
202
- tools.logInfo(`license key found : ${license}`);
203
-
204
- const mainTsPath = path.join(pkg.paths.src, 'main.ts');
205
- console.log(`replacing in ${mainTsPath}`);
206
- tools.replaceInFileSync(mainTsPath, 'LICENSE_KEY_VALUE', license);
207
-
208
- tools.logInfo('main.ts content after replacement : ');
209
- const mainTsContent = tools.getFileContent(mainTsPath);
210
- console.log(mainTsContent);
211
-
212
- tools.logSuccess('OK => main.ts replaced');
213
- })
214
-
215
- .catch((e) => {
216
- throw e;
217
- })
218
- }
219
- }
@@ -496,6 +496,25 @@ const processRoutesConfig = (project, envTarget, build, routesFile, routesFileCo
496
496
  return routeDef;
497
497
  };
498
498
 
499
+ const getRouteDefFromMenuLink = (link) => {
500
+ let routeDef = null;
501
+
502
+ if (link.url) {
503
+ routeDefsBaseJSON.forEach((r) => {
504
+ if (r.menuLinkDefs && r.menuLinkDefs.length > 0) {
505
+ r.menuLinkDefs.forEach((md) => {
506
+ if (md.url === link.url) {
507
+ routeDef = r;
508
+ return;
509
+ }
510
+ });
511
+ }
512
+ });
513
+ }
514
+
515
+ return routeDef;
516
+ };
517
+
499
518
  // inner method for checking based on the "allowedEnvs" option provided on the links definition if the link has to be added
500
519
  // to the links list
501
520
 
@@ -567,7 +586,62 @@ const processRoutesConfig = (project, envTarget, build, routesFile, routesFileCo
567
586
 
568
587
  tools.logInfo(`Links generated : ${linksGenerated.length} found`);
569
588
 
570
- tools.writeJsonFileSync(path.join(projectAssetsPath, 'route-defs-links.json'), linksGenerated);
589
+ // checking if in playground route mode (local dev), in this case we mark the non-existing routes
590
+ // as disabled locally
591
+ let finalLinksGenerated = [];
592
+ if (project.externalRoutesSources.routesFilenameTemplate.indexOf('playground') > 0) {
593
+ tools.logInfo('Disabling non-active routes for playground');
594
+
595
+ linksGenerated.forEach((link) => {
596
+ let newLink = link;
597
+
598
+ if (link.parentId) {
599
+ let newLinkChildren = [];
600
+
601
+ link.children.forEach((subLink) => {
602
+ const defRoute = getRouteDefFromMenuLink(subLink);
603
+
604
+ if (defRoute) {
605
+ const routePathInInputRoutes = mergedRoutes.filter(r => r.path === defRoute.path)[0];
606
+
607
+ if (!routePathInInputRoutes) {
608
+ subLink.disabled = true;
609
+
610
+ } else {
611
+ tools.logInfo(`[${subLink.url}] --> route found in input routes - enabled`);
612
+ }
613
+ }
614
+ newLinkChildren.push(subLink);
615
+ });
616
+ newLink.children = newLinkChildren;
617
+
618
+ const enabledChildren = newLink.children.filter(c => !c.disabled);
619
+ if (enabledChildren.length === 0) {
620
+ newLink.disabled = true;
621
+ }
622
+
623
+ } else {
624
+ const defRoute = getRouteDefFromMenuLink(link);
625
+
626
+ if (defRoute) {
627
+ const routePathInInputRoutes = mergedRoutes.filter(r => r.path === defRoute.path)[0];
628
+
629
+ if (!routePathInInputRoutes) {
630
+ newLink.disabled = true;
631
+ } else {
632
+ tools.logInfo(`[${link.url}] --> route found in input routes - enabled`);
633
+ }
634
+ }
635
+ }
636
+
637
+ finalLinksGenerated.push(newLink);
638
+ });
639
+
640
+ } else {
641
+ finalLinksGenerated = linksGenerated;
642
+ }
643
+
644
+ tools.writeJsonFileSync(path.join(projectAssetsPath, 'route-defs-links.json'), finalLinksGenerated);
571
645
 
572
646
  // getting routes content for replacement
573
647