@eui/tools 6.9.4 → 6.9.6

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.
package/.prettierrc.json CHANGED
@@ -12,7 +12,7 @@
12
12
  "requirePragma": false,
13
13
  "semi": true,
14
14
  "singleQuote": false,
15
- "tabWidth": 4,
15
+ "tabWidth": 2,
16
16
  "trailingComma": "es5",
17
17
  "useTabs": false,
18
18
  "vueIndentScriptAndStyle": false
@@ -1 +1 @@
1
- 6.9.4
1
+ 6.9.6
package/CHANGELOG.md CHANGED
@@ -1,3 +1,21 @@
1
+ ## 6.9.6 (2023-03-21)
2
+
3
+ ##### Chores
4
+
5
+ * **other:**
6
+ * routes config v2 - added multiple remote entries based on eUI version for multiple envs targets - MWP-9204 [MWP-9204](https://webgate.ec.europa.eu/CITnet/jira/browse/MWP-9204) ([fb5b9b9f](https://webgate.ec.europa.eu/CITnet/stash/scm/csdr/eui-tools.git/commits/fb5b9b9f768c727374d0cd0a463097de00fcbcb0))
7
+
8
+ * * *
9
+ * * *
10
+ ## 6.9.5 (2023-03-20)
11
+
12
+ ##### Chores
13
+
14
+ * **other:**
15
+ * check internally for virtual remotes pkg type build - added skipLock for progressively remove locking of build pkg - MWP-9204 [MWP-9204](https://webgate.ec.europa.eu/CITnet/jira/browse/MWP-9204) ([be418e4a](https://webgate.ec.europa.eu/CITnet/stash/scm/csdr/eui-tools.git/commits/be418e4acd732c8b251f93423cbf837d62b2ec80))
16
+
17
+ * * *
18
+ * * *
1
19
  ## 6.9.4 (2023-03-16)
2
20
 
3
21
  ##### Chores
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eui/tools",
3
- "version": "6.9.4",
3
+ "version": "6.9.6",
4
4
  "tag": "latest",
5
5
  "license": "EUPL-1.1",
6
6
  "description": "eUI common tools and scripts",
package/sandbox.js CHANGED
@@ -1212,11 +1212,22 @@ const versionUtils = require('./scripts/csdr/version/version-utils');
1212
1212
  // console.log(config);
1213
1213
  // })
1214
1214
 
1215
+ // Promise.resolve()
1216
+ // .then(() => {
1217
+ // const prjName = 'my-workplace-host-playground';
1218
+ // const project = configUtils.projects.getCsdrProject(prjName);
1219
+ // return preBuildUtils.projects.preBuild(project, 'TST', true, 'TST');
1220
+ // })
1221
+ // .catch((e) => {
1222
+ // console.log(e);
1223
+ // })
1224
+
1215
1225
  Promise.resolve()
1216
1226
  .then(() => {
1217
- const prjName = 'my-workplace-host-playground';
1218
- const project = configUtils.projects.getCsdrProject(prjName);
1219
- return preBuildUtils.projects.preBuild(project, 'TST', true, 'TST');
1227
+ const pkgName = 'ppgms-core-eui10-remote-el-ui-not';
1228
+ const remote = configUtils.remotes.isVirtualRemote(pkgName);
1229
+
1230
+ console.log(remote);
1220
1231
  })
1221
1232
  .catch((e) => {
1222
1233
  console.log(e);
@@ -58,6 +58,16 @@ module.exports.getRemote = (remoteName) => {
58
58
  }
59
59
 
60
60
 
61
+ module.exports.isVirtualRemote = (remoteName) => {
62
+ const remotesConfig = require(path.join(process.cwd(), '.csdr', '.euirc-csdr-remotes.json'));
63
+ const remoteConfig = remotesConfig[remoteName];
64
+
65
+ return remoteConfig !== undefined;
66
+ }
67
+
68
+
69
+
70
+
61
71
  module.exports.getCsdrRemotes = (hostName, euiVersion) => {
62
72
 
63
73
  const hostNameFilterFn = (r) => {
@@ -1,6 +1,7 @@
1
1
  'use strict';
2
2
 
3
3
  const tools = require('../../utils/tools');
4
+ const configUtils = require('../../csdr/config/config-utils');
4
5
 
5
6
  // inner modules
6
7
  const innerInitProject = require('./init-project');
@@ -12,7 +13,7 @@ const innerInitCustom = require('./init-custom');
12
13
  // Getting arguments if they are provided for the CI/CD pipeline
13
14
  const {
14
15
  project, team, pkg, branch, configOnly, skipClone, skipInstall, reset, pkgOnly, prjOnly,
15
- build, containerOnly, skipAppContainers, remote, euiVersion, remoteOnly, remoteBuild, virtual, custom
16
+ build, containerOnly, skipAppContainers, remote, euiVersion, remoteOnly, virtual, custom
16
17
  } = tools.getArgs();
17
18
 
18
19
 
@@ -23,7 +24,6 @@ module.exports.init = () => {
23
24
  team: team || 'all',
24
25
  pkg: pkg || null,
25
26
  remote: remote || null,
26
- remoteBuild: remoteBuild || false,
27
27
  virtual: virtual || false,
28
28
  euiVersion: euiVersion || null,
29
29
  branch: branch || 'develop',
@@ -42,18 +42,17 @@ module.exports.init = () => {
42
42
  // converting inputs args
43
43
  initialResponse.branch = tools.convertStringArg(initialResponse.branch, 'develop');
44
44
  initialResponse.euiVersion = tools.convertStringArg(initialResponse.euiVersion);
45
- initialResponse.remoteBuild = tools.convertBooleanArg(initialResponse.remoteBuild);
46
- initialResponse.virtual = tools.convertBooleanArg(initialResponse.virtual);
47
-
48
45
 
49
46
  // setting project to null if forced to NONE
50
47
  if (initialResponse.project === 'NONE') {
51
48
  initialResponse.project = null;
52
49
  }
53
50
 
54
- // swapping to remote build if virtual remote is pass to default gitlab call
55
- if (initialResponse.remoteBuild && initialResponse.pkg && initialResponse.virtual) {
51
+ // checking if provided PKG (from gitlab) is a virtual remote (new remote kind as of v15 (and sedia v10))
52
+ const isVirtualRemote = configUtils.remotes.isVirtualRemote(initialResponse.pkg);
53
+ if (isVirtualRemote) {
56
54
  initialResponse.remote = initialResponse.pkg;
55
+ initialResponse.virtual = true;
57
56
  initialResponse.pkg = null;
58
57
  }
59
58
 
@@ -134,7 +134,7 @@ module.exports.init = (pkg, envTarget, compositeType) => {
134
134
  }
135
135
 
136
136
 
137
- module.exports.cloneMetadataRepos = () => {
137
+ module.exports.cloneMetadataRepos = (pkg) => {
138
138
  utils.tools.logBanner('CLONE METADATA REPOS');
139
139
 
140
140
  return Promise.resolve()
@@ -144,7 +144,12 @@ module.exports.cloneMetadataRepos = () => {
144
144
  })
145
145
  // CLONE METADATA LOCKS REPO
146
146
  .then(() => {
147
- return metadataUtils.common.cloneMetadataLocksRepo();
147
+ if (pkg.build && pkg.build.skipLock) {
148
+ utils.tools.logInfo('Package has lock de-activated...skipping cloning of devops-metadata-locks repository');
149
+
150
+ } else {
151
+ return metadataUtils.common.cloneMetadataLocksRepo();
152
+ }
148
153
  })
149
154
  .catch((e) => {
150
155
  throw e;
@@ -182,14 +187,20 @@ module.exports.preReleaseChecks = (pkg) => {
182
187
  if (!pkg.backend) {
183
188
  utils.tools.logTitle('Checking package lock state');
184
189
 
185
- // if package is locked, exception is thrown, check this specific exception handling in the global catch
186
- if (metadataUtils.package.isPackageLocked(pkg)) {
187
- utils.tools.logInfo('Package is locked ==> throwing exception');
188
- throw 'PACKAGE_LOCKED';
189
190
 
190
- // if package is not locked, we lock it
191
+ if (pkg.build && pkg.build.skipLock) {
192
+ utils.tools.logInfo('lock package de-activated...skipping');
193
+
191
194
  } else {
192
- return metadataUtils.package.lockPackage(pkg);
195
+ // if package is locked, exception is thrown, check this specific exception handling in the global catch
196
+ if (metadataUtils.package.isPackageLocked(pkg)) {
197
+ utils.tools.logInfo('Package is locked ==> throwing exception');
198
+ throw 'PACKAGE_LOCKED';
199
+
200
+ // if package is not locked, we lock it
201
+ } else {
202
+ return metadataUtils.package.lockPackage(pkg);
203
+ }
193
204
  }
194
205
  }
195
206
  })
@@ -656,7 +667,11 @@ module.exports.sendSuccessNotification = (pkg, version, pkgMetadata) => {
656
667
  if (!pkg.backend) {
657
668
  return Promise.resolve()
658
669
  .then(() => {
659
- return metadataUtils.package.unlockPackage(pkg);
670
+ if (pkg.build && pkg.build.skipLock) {
671
+ utils.tools.logInfo('lock package de-activated...skipping');
672
+ } else {
673
+ return metadataUtils.package.unlockPackage(pkg);
674
+ }
660
675
  })
661
676
  .catch((e) => {
662
677
  utils.tools.logError('ERROR UNLOCKING PACKAGE');
@@ -695,7 +710,11 @@ module.exports.sendErrorNotification = (pkg, exception, pkgMetadata) => {
695
710
  if (exception !== 'PACKAGE_LOCKED') {
696
711
  return Promise.resolve()
697
712
  .then(() => {
698
- return metadataUtils.package.unlockPackage(pkg);
713
+ if (pkg.build && pkg.build.skipLock) {
714
+ utils.tools.logInfo('lock package de-activated...skipping');
715
+ } else {
716
+ return metadataUtils.package.unlockPackage(pkg);
717
+ }
699
718
  })
700
719
  .catch((e) => {
701
720
  utils.tools.logError('ERROR UNLOCKING PACKAGE');
@@ -2,6 +2,7 @@
2
2
 
3
3
  // UTILS
4
4
  const tools = require('../../../utils/tools');
5
+ const configUtils = require('../../config/config-utils');
5
6
 
6
7
  // INNER MODULES
7
8
  const innerReleaseVirtualRemote = require('./release-virtual-remote');
@@ -12,7 +13,7 @@ module.exports.run = () => {
12
13
 
13
14
  // TESTING a release pipeline in DRY-RUN mode :
14
15
  // virtual remotes
15
- // npm run pkg:release mywp-dashboard-eui15-remote-el-ui -- --dryRun --branch master --remoteBuild true --virtual true --envTarget DEV --skipInstall
16
+ // npm run pkg:release mywp-dashboard-eui15-remote-el-ui -- --dryRun --branch master --envTarget DEV --skipInstall
16
17
 
17
18
  // normal UI package / old style remote
18
19
  // npm run pkg:release eui-tools -- --dryRun --branch develop --skipLint --skipInstall --skipTest --skipDoc --skipClone --debug --build
@@ -26,11 +27,10 @@ module.exports.run = () => {
26
27
 
27
28
  // CHECKING if release is for virtual remote or normal UI package (including normal remote)
28
29
  .then(() => {
29
- let { remoteBuild, virtual } = tools.getArgs();
30
- remoteBuild = tools.convertBooleanArg(remoteBuild);
31
- virtual = tools.convertBooleanArg(virtual);
30
+ const pkgName = tools.getArgs().root;
31
+ const isVirtualRemote = configUtils.remotes.isVirtualRemote(pkgName);
32
32
 
33
- if (remoteBuild && virtual) {
33
+ if (isVirtualRemote) {
34
34
  return innerReleaseVirtualRemote.run();
35
35
  } else {
36
36
  return innerReleaseUi.run();
@@ -52,7 +52,7 @@ module.exports.run = () => {
52
52
 
53
53
  // FOR UI and REMOTES clone metadata repositories
54
54
  .then(() => {
55
- return innerCommon.cloneMetadataRepos();
55
+ return innerCommon.cloneMetadataRepos(pkg);
56
56
  })
57
57
 
58
58
  // PRE-RELEASE & COMMON CHECKS
@@ -51,7 +51,7 @@ module.exports.run = () => {
51
51
 
52
52
  // FOR UI and REMOTES clone metadata repositories
53
53
  .then(() => {
54
- return innerCommon.cloneMetadataRepos();
54
+ return innerCommon.cloneMetadataRepos(pkg);
55
55
  })
56
56
 
57
57
 
@@ -105,9 +105,9 @@ const commitAndPush = (branch, message, folder) => {
105
105
  } catch (e2) {
106
106
  tools.logError('ERROR');
107
107
  console.log('ERROR!!!');
108
- if (debug) {
109
- console.log(e2);
110
- }
108
+ // if (debug) {
109
+ // console.log(e2);
110
+ // }
111
111
 
112
112
  try {
113
113
  tools.logInfo('Commit and push - second try - retrying pull & push');
@@ -115,9 +115,9 @@ const commitAndPush = (branch, message, folder) => {
115
115
  execa.sync('git', ['push', 'origin', branch], { cwd: folder });
116
116
 
117
117
  } catch (e3) {
118
- if (debug) {
119
- console.log(e3);
120
- }
118
+ // if (debug) {
119
+ // console.log(e3);
120
+ // }
121
121
  throw new Error(`Failed to push ${message} to ${folder}`);
122
122
  }
123
123
  }
@@ -474,10 +474,19 @@ const processRoutesConfigV2 = (project, envTarget, build, routesFileContent, eui
474
474
  }
475
475
 
476
476
  if (route.remote) {
477
- newAppRoute.data.featureName = defRoute.remoteDef.featureName;
478
- newAppRoute.data.moduleId = defRoute.remoteDef.moduleId;
479
- newAppRoute.data.elementTag = defRoute.remoteDef.elementTag;
480
- newAppRoute.data.iframe = defRoute.remoteDef.iframe;
477
+ const remoteDef = defRoute.remoteDefs.filter((r) => {
478
+ return r.euiVersion === route.euiVersion
479
+ })[0];
480
+ if (remoteDef) {
481
+ newAppRoute.data.moduleId = remoteDef.moduleId;
482
+ newAppRoute.data.elementTag = remoteDef.elementTag;
483
+ newAppRoute.data.iframe = remoteDef.iframe;
484
+
485
+ } else {
486
+ tools.logError('Remote route not found for: ');
487
+ console.log(route);
488
+ throw 'REMOTE_ROUTE_DEF_NOT_FOUND';
489
+ }
481
490
  }
482
491
 
483
492
  appRoutes.push(newAppRoute);
@@ -1,210 +0,0 @@
1
- 'use strict';
2
-
3
- const tools = require('../../utils/tools');
4
- const initUtils = require('./init-utils');
5
- const installUtils = require('../install/install-utils');
6
- const configUtils = require('../config/config-utils');
7
-
8
- // Getting arguments if they are provided for the CI/CD pipeline
9
- const {
10
- project, team, pkg, branch, configOnly, skipClone, skipInstall, reset, pkgOnly, prjOnly,
11
- build, containerOnly, skipAppContainers, remote, euiVersion, remoteOnly, remoteBuild, virtual, custom
12
- } = tools.getArgs();
13
-
14
-
15
- module.exports.init = () => {
16
- // Initializing a common response
17
- const initialResponse = {
18
- project: project || null,
19
- team: team || 'all',
20
- pkg: pkg || null,
21
- remote: remote || null,
22
- remoteBuild: remoteBuild || false,
23
- virtual: virtual || false,
24
- euiVersion: euiVersion || null,
25
- branch: branch || 'develop',
26
- configOnly: configOnly || false,
27
- skipClone: skipClone || false,
28
- reset: reset || false,
29
- pkgOnly: pkgOnly || false,
30
- prjOnly: prjOnly || false,
31
- remoteOnly: remoteOnly || false,
32
- build: build || false,
33
- containerOnly: containerOnly || false,
34
- skipAppContainers: skipAppContainers || false,
35
- custom: custom || false
36
- }
37
-
38
- // converting inputs args
39
- initialResponse.branch = tools.convertStringArg(initialResponse.branch, 'develop');
40
- initialResponse.euiVersion = tools.convertStringArg(initialResponse.euiVersion);
41
- initialResponse.remoteBuild = tools.convertBooleanArg(initialResponse.remoteBuild);
42
- initialResponse.virtual = tools.convertBooleanArg(initialResponse.virtual);
43
-
44
-
45
- // setting project to null if forced to NONE
46
- if (initialResponse.project === 'NONE') {
47
- initialResponse.project = null;
48
- }
49
-
50
- // swapping to remote build if virtual remote is pass to default gitlab call
51
- if (initialResponse.remoteBuild && initialResponse.pkg && initialResponse.virtual) {
52
- initialResponse.remote = initialResponse.pkg;
53
- initialResponse.pkg = null;
54
- }
55
-
56
-
57
- // Storing the response for propagation
58
- let finalResponse;
59
-
60
- return Promise.resolve()
61
- .then(() => {
62
-
63
- // if no project has been provided we prompt for project and team selection
64
- if (!project && !pkg && !remote && !custom ) {
65
- // TODO refactor to handle dynamic mywp-host-playground install (pre-remotes install etc...)
66
- // return initUtils.prompt.start();
67
- tools.logError('****************************************');
68
- tools.logError('*************** ERROR ******************');
69
- tools.logError('****************************************\n');
70
- tools.logError('At least "pkg" or "project" or "remote" type should be used for init, for example :\n');
71
- tools.logError('npm run init -- --pkg PKG_NAME [--branch BRANCH_NAME|default develop] [--git local] [--pkgOnly] [--skipInstall]');
72
- tools.logError('npm run init -- --project PROJECT_NAME [--branch BRANCH_NAME|default develop] [--git local] [--prjOnly] [--skipInstall]');
73
- tools.logError('npm run init -- --remote VIRTUAL_REMOTE_NAME [--remoteOnly] [--skipInstall]');
74
- tools.logError('npm run init -- --custom [--skipInstall] [--git local]');
75
- process.exit(0);
76
-
77
- // if provided, we are on automated mode, we use the initialized response
78
- } else {
79
- return initialResponse;
80
- }
81
- })
82
-
83
- // merge with response found from prompts
84
- .then((response) => {
85
- finalResponse = { ...initialResponse, ...response };
86
-
87
- tools.logInfo('Configuration generated based on provided args:');
88
- console.log(finalResponse);
89
- })
90
-
91
- // Initializing .euirc.json local file - the core of CSDR operations
92
- .then(() => {
93
- // Initialize config
94
- return configUtils.init.run(finalResponse);
95
- })
96
-
97
- // clone or install linked host package to project if any
98
- .then(() => {
99
- // TODO
100
- // if (finalResponse.project && !build) {
101
- if (finalResponse.project) {
102
- return initUtils.packages.cloneHostPackage(finalResponse.project);
103
- }
104
- // TODO
105
- // } else if (finalResponse.project && build) {
106
- // return initUtils.packages.installHostPackage(finalResponse.project);
107
- // }
108
- })
109
-
110
- // Initializing .meta based on .euirc.json for local respoisitories cloning
111
- .then(() => {
112
- if (!finalResponse.remote) {
113
- return initUtils.meta.init();
114
- }
115
- })
116
-
117
- // Cloning repositories based on the .meta file generated
118
- .then(() => {
119
- if (!skipClone && !finalResponse.remote) {
120
- return initUtils.repos.init(finalResponse);
121
- }
122
- })
123
-
124
- // Importing external sources
125
- .then(() => {
126
- if (finalResponse.project) {
127
- return initUtils.projects.importExternalSources(true);
128
- }
129
- })
130
-
131
- // Generating virtual remote - experimental
132
- .then(() => {
133
- if (finalResponse.remote) {
134
- return initUtils.remotes.generateVirtualRemote(finalResponse.remote);
135
- }
136
- })
137
-
138
- // Importing packages and generating definitions
139
- .then(() => {
140
- return initUtils.packages.importPackages(finalResponse);
141
- })
142
-
143
- // adapt and inject particular root data/config for eUI version detected on project
144
- // if multiple versions of eUI are detected on the same project, an exception is thrown
145
- .then(() => {
146
- return initUtils.global.processLocalEuiVersions();
147
- })
148
-
149
- // specific resolution injection based on NodeJS (recent failure of nodejs10.x for MWP v7)
150
- .then(() => {
151
- return initUtils.global.processResolutionsForNodeVersion();
152
- })
153
-
154
- // Install deps based on current config generated => take last know snapshots
155
- .then(() => {
156
- // this is only executed for local dev installation,
157
- // in case of release the initialisation is managed by the application / package themselves
158
- if (!build && !skipInstall) {
159
- if (finalResponse.pkgOnly || finalResponse.remoteOnly) {
160
- if (finalResponse.remote) {
161
- return installUtils.localDev.installRemote(finalResponse.remote);
162
- } else {
163
- return installUtils.localDev.installPackage(finalResponse.pkg);
164
- }
165
- } else {
166
- return installUtils.localDev.install();
167
- }
168
- }
169
- })
170
-
171
- // Attaching app scripts to root package.json
172
- .then(() => {
173
- if (finalResponse.project) {
174
- return initUtils.projects.importScripts();
175
- }
176
- })
177
-
178
-
179
- // Attaching extra tsconfig from project
180
- .then(() => {
181
- if (finalResponse.project) {
182
- return initUtils.projects.importExtraTsConfig();
183
- }
184
- })
185
-
186
-
187
- // Attaching external features from project
188
- .then(() => {
189
- if (finalResponse.project && !build) {
190
- return initUtils.projects.importExternalFeatures();
191
- }
192
- })
193
-
194
-
195
- // Attaching external mock repo for project
196
- .then(() => {
197
- if (finalResponse.project && !build && !finalResponse.prjOnly) {
198
- return initUtils.projects.importExternalMock();
199
- }
200
- })
201
-
202
-
203
- .then(() => {
204
- tools.logSuccess('OK => Project successfully initialized');
205
- })
206
-
207
- .catch((e) => {
208
- throw e;
209
- });
210
- }