@eui/tools 5.1.12 → 5.1.13

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
- 5.1.12
1
+ 5.1.13
package/CHANGELOG.md CHANGED
@@ -1,3 +1,12 @@
1
+ ## 5.1.13 (2022-04-28)
2
+
3
+ ##### Bug Fixes
4
+
5
+ * **other:**
6
+ * broken version generated for remote snapshot - EUI-5632 [EUI-5632](https://webgate.ec.europa.eu/CITnet/jira/browse/EUI-5632) ([21a5afd7](https://webgate.ec.europa.eu/CITnet/stash/scm/csdr/eui-tools.git/commits/21a5afd7c07bcea1c4bed4e0ed7c417667e87673))
7
+
8
+ * * *
9
+ * * *
1
10
  ## 5.1.12 (2022-04-28)
2
11
 
3
12
  ##### Bug Fixes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eui/tools",
3
- "version": "5.1.12",
3
+ "version": "5.1.13",
4
4
  "tag": "latest",
5
5
  "license": "EUPL-1.1",
6
6
  "description": "eUI common tools and scripts",
@@ -7,6 +7,7 @@ const path = require('path');
7
7
  // local
8
8
  const tools = require('../../utils/tools');
9
9
 
10
+ const RELEASE_TYPES = ['major', 'minor', 'patch'];
10
11
 
11
12
  const getCurrentVersion = (pkg) => {
12
13
  return Promise.resolve()
@@ -51,36 +52,6 @@ const getCurrentVersion = (pkg) => {
51
52
  })
52
53
  }
53
54
 
54
-
55
- const getReleaseType = (commitsMetadata) => {
56
- tools.logInfo('Getting release type based on commits metadata parsed from last tag');
57
-
58
- const RELEASE_TYPES = ['major', 'minor', 'patch'];
59
-
60
- let level = 2;
61
- let breakings = 0;
62
- let features = 0;
63
-
64
- commitsMetadata.forEach((commit) => {
65
- if (commit.breakingChange) {
66
- breakings += commit.body;
67
- level = 1; // no major bump on "breaking changes"
68
- } else if (commit.type === 'feat') {
69
- features += 1;
70
- if (level === 2) {
71
- level = 1;
72
- }
73
- }
74
- });
75
-
76
- return {
77
- level: level,
78
- reason: 'There are ' + breakings + ' BREAKING CHANGES and ' + features + ' features',
79
- releaseType: RELEASE_TYPES[level]
80
- };
81
- }
82
-
83
-
84
55
  // PUBLIC METHODS
85
56
 
86
57
  module.exports.getNewVersion = (
@@ -101,7 +72,31 @@ module.exports.getNewVersion = (
101
72
  let newVersion = '1.0.0';
102
73
 
103
74
  if (commits) {
104
- const release = getReleaseType(commits);
75
+
76
+ tools.logInfo('Commits found for processing version, extracting...');
77
+
78
+ let level = 2;
79
+ let breakings = 0;
80
+ let features = 0;
81
+
82
+ commits.forEach((commit) => {
83
+ if (commit.breakingChange) {
84
+ breakings += commit.body;
85
+ level = 1; // no major bump on "breaking changes"
86
+ } else if (commit.type === 'feat') {
87
+ features += 1;
88
+ if (level === 2) {
89
+ level = 1;
90
+ }
91
+ }
92
+ });
93
+
94
+ const release = {
95
+ level: level,
96
+ reason: 'There are ' + breakings + ' BREAKING CHANGES and ' + features + ' features',
97
+ releaseType: RELEASE_TYPES[level]
98
+ };
99
+
105
100
  tools.logInfo('release info found : ' + JSON.stringify(release));
106
101
 
107
102
  if (isNextBranch) {
@@ -110,37 +105,39 @@ module.exports.getNewVersion = (
110
105
  newVersion = semver.valid(release.releaseType) || semver.inc(currentVersion, release.releaseType)
111
106
  }
112
107
 
113
- tools.logInfo('probable new version : ' + newVersion);
114
108
 
115
- if (isSnapshot) {
116
- if (pkg.backend) {
117
- if (pkg.build && pkg.build.nodejs) {
118
- newVersion += '-snapshot-' + Date.now();
119
- } else {
120
- newVersion += '-SNAPSHOT';
121
- }
122
- } else {
123
- newVersion += '-snapshot-' + Date.now();
124
- }
109
+ } else {
110
+ tools.logInfo('No commits found for version processing...applying minor version upgrade');
125
111
 
126
- } else if (isSupportBranch) {
127
- if (pkg.backend) {
112
+ if (isNextBranch) {
128
113
  newVersion = semver.inc(currentVersion, 'prerelease');
114
+ } else {
115
+ newVersion = semver.inc(currentVersion, 'minor');
129
116
  }
130
- } else if (isHotfixBranch) {
131
- newVersion = semver.inc(currentVersion, 'prerelease');
132
- }
117
+ }
133
118
 
134
- } else {
135
- tools.logInfo('No commits found for version processing...applying minor version upgrade');
119
+ tools.logInfo('probable new version : ' + newVersion);
136
120
 
137
- if (isNextBranch) {
138
- newVersion = semver.inc(currentVersion, 'prerelease');
121
+ if (isSnapshot) {
122
+ if (pkg.backend) {
123
+ if (pkg.build && pkg.build.nodejs) {
124
+ newVersion += '-snapshot-' + Date.now();
125
+ } else {
126
+ newVersion += '-SNAPSHOT';
127
+ }
139
128
  } else {
140
- newVersion = semver.inc(currentVersion, 'minor');
129
+ newVersion += '-snapshot-' + Date.now();
141
130
  }
142
131
  }
143
132
 
133
+ if (isSupportBranch && pkg.backend) {
134
+ newVersion = semver.inc(currentVersion, 'prerelease');
135
+ }
136
+
137
+ if (isHotfixBranch) {
138
+ newVersion = semver.inc(currentVersion, 'prerelease');
139
+ }
140
+
144
141
  tools.logSuccess('new version generated : ' + newVersion);
145
142
 
146
143
  return newVersion;