@clickview/ship-it 0.0.37-rc.0 → 0.0.38

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.
@@ -175,27 +175,44 @@ var BumpPackagesTask = /** @class */ (function () {
175
175
  return commitFiles;
176
176
  };
177
177
  BumpPackagesTask.prototype.getNextVersion = function (version, options) {
178
- // If we're in a prerelease, we only want to increment the preId part of the version number
179
- if (this.isInPreRelease && options.preId) {
178
+ if (options.preId)
179
+ return this.getNextPrereleaseVersion(version, options);
180
+ return this.getNextReleaseVersion(version);
181
+ };
182
+ BumpPackagesTask.prototype.getNextPrereleaseVersion = function (version, options) {
183
+ /**
184
+ * If we're in a prerelease state already, we only want to increment the
185
+ * preId part of the version number
186
+ *
187
+ * Example: 1.0.0-rc.0 -> 1.0.0-rc.1
188
+ */
189
+ if (this.isInPreRelease) {
180
190
  if (options.preId === 'dev') {
181
191
  if (DEV_VERSION_REGEX.test(version)) {
182
- var currentPreId = Number(version[version.length - 1]);
183
- return "".concat(version.substring(0, version.length - 1)).concat(currentPreId + 1);
192
+ var _a = version.split('-dev.'), mainVersion = _a[0], currentPreId = _a[1];
193
+ return "".concat(mainVersion, "-dev.").concat(Number(currentPreId) + 1);
184
194
  }
185
195
  return "".concat(utils_1.Versions.getNextVersion(version, 'patch'), "-dev.0");
186
196
  }
187
197
  if (options.preId === 'rc') {
188
198
  if (RC_VERSION_REGEX.test(version)) {
189
- var currentPreId = Number(version[version.length - 1]);
190
- return "".concat(version.substring(0, version.length - 1)).concat(currentPreId + 1);
199
+ var _b = version.split('-rc.'), mainVersion = _b[0], currentPreId = _b[1];
200
+ return "".concat(mainVersion, "-rc.").concat(Number(currentPreId) + 1);
191
201
  }
192
202
  if (this.isReleaseBranch)
193
203
  return "".concat(utils_1.Versions.getNextVersion(version, 'minor'), "-rc.0");
194
204
  if (this.isHotfixBranch)
195
205
  return "".concat(utils_1.Versions.getNextVersion(version, 'patch'), "-rc.0");
196
206
  }
207
+ // Should never run
197
208
  return version;
198
209
  }
210
+ /**
211
+ * The code below runs if we are not currently in a prerelease state,
212
+ * and we want to bump to a prerelease version.
213
+ *
214
+ * Example: 1.0.0 -> 1.0.1-dev.0 / 1.0.0 -> 1.1.0-rc.0
215
+ */
199
216
  if (options.preId === 'dev')
200
217
  return "".concat(utils_1.Versions.getNextVersion(version, 'patch'), "-dev.0");
201
218
  if (options.preId === 'rc') {
@@ -204,8 +221,18 @@ var BumpPackagesTask = /** @class */ (function () {
204
221
  if (this.isHotfixBranch)
205
222
  return "".concat(utils_1.Versions.getNextVersion(version, 'patch'), "-rc.0");
206
223
  }
224
+ // Should never run
225
+ return version;
226
+ };
227
+ BumpPackagesTask.prototype.getNextReleaseVersion = function (version) {
228
+ if (this.isInPreRelease) {
229
+ // Examples: 1.0.1-rc.5 -> 1.0.1 / 1.0.0-dev.0 -> 1.0.0
230
+ return version.split('-')[0];
231
+ }
232
+ // Example: 1.0.0 -> 1.1.0
207
233
  if (this.isReleaseBranch)
208
234
  return utils_1.Versions.getNextVersion(version, 'minor');
235
+ // Example: 1.0.0 -> 1.0.1
209
236
  if (this.isHotfixBranch)
210
237
  return utils_1.Versions.getNextVersion(version, 'patch');
211
238
  return version;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@clickview/ship-it",
3
- "version": "0.0.37-rc.0",
3
+ "version": "0.0.38",
4
4
  "description": "Release Manager",
5
5
  "main": "./lib/index.js",
6
6
  "bin": {