@eui/tools 6.11.26 → 6.11.28

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.26
1
+ 6.11.28
package/CHANGELOG.md CHANGED
@@ -1,3 +1,21 @@
1
+ ## 6.11.28 (2023-06-06)
2
+
3
+ ##### Bug Fixes
4
+
5
+ * **other:**
6
+ * fetching remote metadata issue when no remotes existing on local project - EUI-7121 [EUI-7121](https://webgate.ec.europa.eu/CITnet/jira/browse/EUI-7121) ([67d990f6](https://webgate.ec.europa.eu/CITnet/stash/scm/csdr/eui-tools.git/commits/67d990f635d9d6c2e0b8e89a6b10e025ee70b55b))
7
+
8
+ * * *
9
+ * * *
10
+ ## 6.11.27 (2023-06-05)
11
+
12
+ ##### Bug Fixes
13
+
14
+ * **other:**
15
+ * fetch remotes config prior to remotes metadata extraction - EUI-7121 [EUI-7121](https://webgate.ec.europa.eu/CITnet/jira/browse/EUI-7121) ([311a71af](https://webgate.ec.europa.eu/CITnet/stash/scm/csdr/eui-tools.git/commits/311a71affb35768e8cff04c3edd7ec97cd2d58fa))
16
+
17
+ * * *
18
+ * * *
1
19
  ## 6.11.26 (2023-06-05)
2
20
 
3
21
  ##### Chores
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eui/tools",
3
- "version": "6.11.26",
3
+ "version": "6.11.28",
4
4
  "tag": "latest",
5
5
  "license": "EUPL-1.1",
6
6
  "description": "eUI common tools and scripts",
@@ -5,6 +5,7 @@ const _ = require('lodash');
5
5
 
6
6
  const tools = require('../../tools');
7
7
  const configUtils = require('../../../csdr/config/config-utils');
8
+ const initUtils = require('../../../csdr/init/init-utils');
8
9
 
9
10
  const { debug } = tools.getArgs();
10
11
 
@@ -630,47 +631,62 @@ module.exports.extractRemotesMetadata = (project) => {
630
631
  tools.logTitle('Extracting remotes-metadata.json for known participant remotes');
631
632
 
632
633
  const projectAssetsPath = path.join(process.cwd(), project.folder, 'src', 'assets');
633
-
634
- const finalRemotesDefsFile = path.join(projectAssetsPath, 'remotes-metadata.json');
635
634
  const openidConfigFile = path.join(projectAssetsPath, 'openid-login-config.json');
635
+ const finalRemotesDefsFile = path.join(projectAssetsPath, 'remotes-metadata.json');
636
636
 
637
- let remoteMetadataJSON = tools.getJsonFileContent(finalRemotesDefsFile);
638
- const openidConfigJSON = tools.getJsonFileContent(openidConfigFile);
637
+ if (!tools.isFileExists(finalRemotesDefsFile)) {
638
+ tools.logInfo('...remotes-metadata.json not found / not previously generated ... skipping');
639
+ return;
640
+ }
639
641
 
640
- remoteMetadataJSON.forEach((r) => {
641
- tools.logInfo(`Fetching remote info for : ${r}`);
642
+ return Promise.resolve()
643
+ .then(() => {
644
+ return initUtils.remotes.cloneRemotesConfig();
645
+ })
642
646
 
643
- let remote;
644
- if (configUtils.remotes.isVirtualRemote(r)) {
645
- remote = configUtils.remotes.getRemote(r);
646
- } else {
647
- remote = configUtils.packages.getPackage(r, true);
648
- }
647
+ .then(() => {
648
+ let remoteMetadataJSON = tools.getJsonFileContent(finalRemotesDefsFile);
649
+ const openidConfigJSON = tools.getJsonFileContent(openidConfigFile);
649
650
 
650
- if (remote.build && remote.build.hasParticipants) {
651
- let participantsList;
652
- if (remote.euiVersion === '15.x') {
653
- participantsList = openidConfigJSON.modules[remote.build.configModuleName].participants_v15
654
- } else {
655
- participantsList = openidConfigJSON.modules[remote.build.configModuleName].participants
656
- }
657
- if (participantsList) {
658
- let participantRemotes = [];
659
- Object.keys(participantsList).forEach((p) => {
660
- participantRemotes.push(participantsList[p].moduleId);
661
- });
662
- tools.logInfo('Found participant remotes : ');
663
- console.log(participantRemotes);
664
-
665
- remoteMetadataJSON = [...remoteMetadataJSON, ...participantRemotes];
666
- }
667
- }
668
- })
651
+ remoteMetadataJSON.forEach((r) => {
652
+ tools.logInfo(`Fetching remote info for : ${r}`);
653
+
654
+ let remote;
655
+ if (configUtils.remotes.isVirtualRemote(r)) {
656
+ remote = configUtils.remotes.getRemote(r);
657
+ } else {
658
+ remote = configUtils.packages.getPackage(r, true);
659
+ }
660
+
661
+ if (remote.build && remote.build.hasParticipants) {
662
+ let participantsList;
663
+ if (remote.euiVersion === '15.x') {
664
+ participantsList = openidConfigJSON.modules[remote.build.configModuleName].participants_v15
665
+ } else {
666
+ participantsList = openidConfigJSON.modules[remote.build.configModuleName].participants
667
+ }
668
+ if (participantsList) {
669
+ let participantRemotes = [];
670
+ Object.keys(participantsList).forEach((p) => {
671
+ participantRemotes.push(participantsList[p].moduleId);
672
+ });
673
+ tools.logInfo('Found participant remotes : ');
674
+ console.log(participantRemotes);
669
675
 
670
- remoteMetadataJSON = tools.removeArrayDuplicates(remoteMetadataJSON);
676
+ remoteMetadataJSON = [...remoteMetadataJSON, ...participantRemotes];
677
+ }
678
+ }
679
+ })
671
680
 
672
- tools.logInfo('Final remotes metadata list found :');
673
- console.log(remoteMetadataJSON);
681
+ remoteMetadataJSON = tools.removeArrayDuplicates(remoteMetadataJSON);
682
+
683
+ tools.logInfo('Final remotes metadata list found :');
684
+ console.log(remoteMetadataJSON);
685
+
686
+ return tools.writeJsonFileSync(finalRemotesDefsFile, remoteMetadataJSON);
687
+ })
674
688
 
675
- tools.writeJsonFileSync(finalRemotesDefsFile, remoteMetadataJSON);
689
+ .catch((e) => {
690
+ throw e;
691
+ });
676
692
  }