@eui/tools 6.12.53 → 6.12.55

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.53
1
+ 6.12.55
package/CHANGELOG.md CHANGED
@@ -1,3 +1,21 @@
1
+ ## 6.12.55 (2023-09-15)
2
+
3
+ ##### Bug Fixes
4
+
5
+ * **other:**
6
+ * prevent unknown supported branches to be processed by build release - EUI-7121 [EUI-7121](https://webgate.ec.europa.eu/CITnet/jira/browse/EUI-7121) ([7a42606a](https://webgate.ec.europa.eu/CITnet/stash/scm/csdr/eui-tools.git/commits/7a42606a91fa9523b3cc5eedcce7438334fcc863))
7
+
8
+ * * *
9
+ * * *
10
+ ## 6.12.54 (2023-09-15)
11
+
12
+ ##### Chores
13
+
14
+ * **other:**
15
+ * prevent RC release to go up in other env then DEV - collision of dependencies snapshot/latest prevention - EUI-7121 [EUI-7121](https://webgate.ec.europa.eu/CITnet/jira/browse/EUI-7121) ([0164bc8e](https://webgate.ec.europa.eu/CITnet/stash/scm/csdr/eui-tools.git/commits/0164bc8e06765a378dec2f535407e8cfc81dd6d5))
16
+
17
+ * * *
18
+ * * *
1
19
  ## 6.12.53 (2023-09-14)
2
20
 
3
21
  ##### Chores
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eui/tools",
3
- "version": "6.12.53",
3
+ "version": "6.12.55",
4
4
  "tag": "latest",
5
5
  "license": "EUPL-1.1",
6
6
  "description": "eUI common tools and scripts",
package/sandbox.js CHANGED
@@ -22,6 +22,7 @@ const apiUtils = require('./scripts/utils/api-utils');
22
22
  const versionUtils = require('./scripts/csdr/version/version-utils');
23
23
  const publishUtils = require('./scripts/utils/publish/publish-utils');
24
24
 
25
+
25
26
  // console.log(configUtils.packages.getPackages());
26
27
  // console.log(configUtils.packages.getPackage('eui-tools'));
27
28
 
@@ -1319,13 +1320,36 @@ const publishUtils = require('./scripts/utils/publish/publish-utils');
1319
1320
  // console.log(e);
1320
1321
  // })
1321
1322
 
1323
+ // Promise.resolve()
1324
+ // .then(() => {
1325
+ // const pkgs = configUtils.packages.getPackages();
1326
+ // console.log(pkgs);
1327
+ // })
1328
+
1329
+ // .catch((e) => {
1330
+ // console.log(e);
1331
+ // })
1332
+
1333
+ // Promise.resolve()
1334
+ // .then(() => {
1335
+ // const pkg = configUtils.remotes.getRemote('cc-task-details-eui15-remote-el-ui', true);
1336
+ // console.log(pkg);
1337
+
1338
+ // const deps = installUtils.remotes.getDeps(pkg, 'TST');
1339
+ // console.log(deps);
1340
+
1341
+ // })
1342
+
1343
+ // .catch((e) => {
1344
+ // console.log(e);
1345
+ // })
1346
+
1322
1347
  Promise.resolve()
1323
1348
  .then(() => {
1324
- const pkgs = configUtils.packages.getPackages();
1325
- console.log(pkgs);
1349
+ const util = require('./scripts/csdr/release/package/common');
1350
+ const branches = util.getBranches();
1351
+ console.log(branches);
1326
1352
  })
1327
-
1328
1353
  .catch((e) => {
1329
1354
  console.log(e);
1330
1355
  })
1331
-
@@ -92,7 +92,7 @@ module.exports.executeInstallPackage = (cwdPath, npmPkg) => {
92
92
 
93
93
 
94
94
 
95
- module.exports.getResolvedCarretDeps = (deps, isMaster) => {
95
+ module.exports.getResolvedCarretDeps = (deps, isMaster, isDevEnvTarget) => {
96
96
  tools.logTitle('Resolving carret versions for prev or next version packages');
97
97
 
98
98
  tools.logInfo('processing dependencies : ');
@@ -113,7 +113,7 @@ module.exports.getResolvedCarretDeps = (deps, isMaster) => {
113
113
  const pkg = configUtils.packages.getPackageByNpmPkg(npmPkg, true);
114
114
 
115
115
  // getting last major version from metadata history for pkg found
116
- const lastMajorVersion = metadataUtils.package.getLastMajorVersion(pkg, version.substr(1).split('.')[0], isMaster);
116
+ const lastMajorVersion = metadataUtils.package.getLastMajorVersion(pkg, version.substr(1).split('.')[0], isMaster, isDevEnvTarget);
117
117
 
118
118
  if (lastMajorVersion) {
119
119
  tools.logInfo(`--version found : ${lastMajorVersion}`);
@@ -16,7 +16,7 @@ const innerCommon = require('./common');
16
16
  const getDeps_DEV = (compositeDeps, prevSnapshotEnabled) => {
17
17
  return Promise.resolve()
18
18
  .then(() => {
19
- return innerCommon.getResolvedCarretDeps(compositeDeps, false);
19
+ return innerCommon.getResolvedCarretDeps(compositeDeps, false, true);
20
20
  })
21
21
 
22
22
  .catch((e) => {
@@ -30,7 +30,7 @@ const getDeps_TST = (compositeDeps, prevSnapshotEnabled) => {
30
30
  return Promise.resolve()
31
31
  // Re-mapping the dependencies found against their max "carret" versions found in the base dependencies defs in the project
32
32
  .then((metadataDeps) => {
33
- return innerCommon.getResolvedCarretDeps(compositeDeps, true);
33
+ return innerCommon.getResolvedCarretDeps(compositeDeps, true, false);
34
34
  })
35
35
 
36
36
  .catch((e) => {
@@ -76,6 +76,18 @@ const getCompositeDepsByEnv = (compositePath, envTarget, compositeType, envsMeta
76
76
 
77
77
  return { ...prevEnvDeps, ...returnedDeps };
78
78
  })
79
+ .then((deps) => {
80
+ tools.logInfo('Scanning resulting deps for RC detection (do avoid RC spreading up to non DEV envs)');
81
+ const depsToScan = Object.keys(deps);
82
+ depsToScan.forEach((d) => {
83
+ if (deps[d].indexOf('-rc.') > -1) {
84
+ tools.logInfo(`RC deps found : ${deps[d]}`);
85
+ tools.logWarning('In order to prevent this, your RC next/ branch should be released to develop/master branch of the package, support/ branch created for supporting older version in upper environments')
86
+ throw new Error('NOT_ALLOWED_RC_DEPS_FOR_NON_DEV_ENVIRONMENT_FOUND');
87
+ }
88
+ })
89
+ return deps;
90
+ })
79
91
  .catch((e) => {
80
92
  throw e;
81
93
  })
@@ -94,6 +106,18 @@ const getCompositeDepsByEnv = (compositePath, envTarget, compositeType, envsMeta
94
106
 
95
107
  return { ...currentEnvDeps, ...fileDeps };
96
108
  })
109
+ .then((deps) => {
110
+ tools.logInfo('Scanning resulting deps for RC detection (do avoid RC spreading up to non DEV envs)');
111
+ const depsToScan = Object.keys(deps);
112
+ depsToScan.forEach((d) => {
113
+ if (deps[d].indexOf('-rc.') > -1) {
114
+ tools.logInfo(`RC deps found : ${deps[d]}`);
115
+ tools.logWarning('In order to prevent this, your RC next/ branch should be released to develop/master branch of the package, support/ branch created for supporting older version in upper environments')
116
+ throw new Error('NOT_ALLOWED_RC_DEPS_FOR_NON_DEV_ENVIRONMENT_FOUND');
117
+ }
118
+ })
119
+ return deps;
120
+ })
97
121
  .catch((e) => {
98
122
  throw e;
99
123
  })
@@ -280,7 +280,7 @@ module.exports.isNewPackageBuild = (pkg) => {
280
280
  }
281
281
  }
282
282
 
283
- module.exports.getPackageVersionsByMajor = (pkg, major, isMaster) => {
283
+ module.exports.getPackageVersionsByMajor = (pkg, major, isMaster, isDevEnvTarget) => {
284
284
  const pkgVersions = this.getPackageVersions(pkg);
285
285
 
286
286
  if (pkgVersions) {
@@ -303,12 +303,18 @@ module.exports.getPackageVersionsByMajor = (pkg, major, isMaster) => {
303
303
  versions = versions.filter(v => !v.hotfix);
304
304
  tools.logInfo(`----> ${versions.length} metadata versions excluding hotfix version type`);
305
305
 
306
+ if (!isDevEnvTarget) {
307
+ tools.logInfo('----=> excludingi RC release of versions found for non-DEV build (preventing RC releases to go to another env than DEV');
308
+ versions = versions.filter(v => v.version.indexOf('-rc.') === -1);
309
+ tools.logInfo(`----> ${versions.length} metadata versions excluding hotfix version type`);
310
+ }
311
+
306
312
  return versions;
307
313
  }
308
314
  }
309
315
 
310
- module.exports.getLastMajorVersion = (pkg, major, isMaster) => {
311
- const pkgVersionsMajor = this.getPackageVersionsByMajor(pkg, major, isMaster);
316
+ module.exports.getLastMajorVersion = (pkg, major, isMaster, isDevEnvTarget) => {
317
+ const pkgVersionsMajor = this.getPackageVersionsByMajor(pkg, major, isMaster, isDevEnvTarget);
312
318
 
313
319
  if (pkgVersionsMajor && pkgVersionsMajor.length !== 0) {
314
320
  return pkgVersionsMajor.splice(-1)[0].version;
@@ -26,6 +26,12 @@ const getBranches = module.exports.getBranches = () => {
26
26
  const isHotfix = (!isMaster && !isSnapshot && !isSupportSnapshot && !isSupport && branch.indexOf('hotfix/') > -1);
27
27
  const isNext = (!isMaster && !isSnapshot && !isSupport && !isSupportSnapshot && !isHotfix && branch.indexOf('next/') > -1);
28
28
 
29
+ let valid = true;
30
+
31
+ if (!isSnapshot && !isMaster && !isSupportSnapshot && !isSupport && !isHotfix && !isNext) {
32
+ valid = false;
33
+ }
34
+
29
35
  return {
30
36
  isSupport: isSupport,
31
37
  isSupportSnapshot: isSupportSnapshot,
@@ -33,7 +39,8 @@ const getBranches = module.exports.getBranches = () => {
33
39
  isSnapshot: isSnapshot,
34
40
  isMaster: isMaster,
35
41
  isHotfix: isHotfix,
36
- branch: branch
42
+ branch: branch,
43
+ valid: valid
37
44
  }
38
45
  }
39
46
 
@@ -182,6 +189,21 @@ module.exports.preReleaseChecks = (pkg) => {
182
189
  return metadataUtils.common.isPipelineEnabled(pkg);
183
190
  })
184
191
 
192
+ // CHECK BRANCH VALIDITY
193
+ .then(() => {
194
+ const branches = this.getBranches();
195
+
196
+ utils.tools.logTitle('Checking branch validity');
197
+
198
+ if (!branches.valid) {
199
+ utils.tools.logInfo('Branch not supported ... stopping : allowed branches are develop-master-next/-support/-hotfix/');
200
+ throw 'BRANCH_NOT_SUPPORTED';
201
+
202
+ } else {
203
+ utils.tools.logInfo('Branch is valid... processing');
204
+ }
205
+ })
206
+
185
207
  // CHECKING PACKAGE LOCK STATE - AVOID SAME PACKAGE RUN issuing race conditions
186
208
  .then(() => {
187
209
  if (!pkg.backend) {