@leverege/build-tools 2.33.2-bruno.1 → 2.33.2

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.
@@ -211,16 +211,26 @@ The tag-release script must run from a npm project.
211
211
  return packageJson.version;
212
212
  };
213
213
  const getNextVersions = currentVersion => {
214
- const [major, minor, patch, beta] = currentVersion.split(/\.|-beta\./).map(Number);
214
+ const regex = /^(\d+)(?:\.(\d+))?(?:\.(\d+))?(?:-(\w+)\.(\d+))?$/i;
215
+ const [, dirtyMajor, dirtyMinor, dirtyPatch, testTag, dirtyTestVersion] = currentVersion.match(regex);
216
+ const major = parseInt(dirtyMajor);
217
+ const minor = parseInt(dirtyMinor) || 0;
218
+ const patch = parseInt(dirtyPatch) || 0;
219
+ const testVersion = parseInt(dirtyTestVersion) || 0;
215
220
  const nextMajor = `${major + 1}.0.0`;
216
221
  const nextMinor = `${major}.${minor + 1}.0`;
217
222
  const nextPatch = `${major}.${minor}.${patch + 1}`;
218
- const nextBeta = beta ? `${major}.${minor}.${patch}-beta.${beta + 1}` : `${major}.${minor}.${patch + 1}-beta.1`;
223
+ const nextAlpha = testTag === 'alpha' ? `${major}.${minor}.${patch}-alpha.${testVersion + 1}` : `${major}.${minor}.${patch + 1}-alpha.1`;
224
+ const nextBeta = testTag === 'beta' ? `${major}.${minor}.${patch}-beta.${testVersion + 1}` : `${major}.${minor}.${patch + 1}-beta.1`;
225
+ const nextTestTag = testTag && !['alpha', 'beta'].includes(testTag) ? `${major}.${minor}.${patch}-${testTag}.${testVersion + 1}` : null;
219
226
  return {
220
227
  nextMajor,
221
228
  nextMinor,
222
229
  nextPatch,
223
- nextBeta
230
+ nextAlpha,
231
+ nextBeta,
232
+ nextTestTag,
233
+ testTag
224
234
  };
225
235
  };
226
236
  const promptForVersion = async currentVersion => {
@@ -228,7 +238,10 @@ const promptForVersion = async currentVersion => {
228
238
  nextMajor,
229
239
  nextMinor,
230
240
  nextPatch,
231
- nextBeta
241
+ nextAlpha,
242
+ nextBeta,
243
+ nextTestTag,
244
+ testTag
232
245
  } = getNextVersions(currentVersion);
233
246
  const choices = [{
234
247
  hint: '(major release)',
@@ -239,10 +252,16 @@ const promptForVersion = async currentVersion => {
239
252
  }, {
240
253
  hint: '(patch release)',
241
254
  value: nextPatch
255
+ }, {
256
+ hint: '(alpha release)',
257
+ value: nextAlpha
242
258
  }, {
243
259
  hint: '(beta release)',
244
260
  value: nextBeta
245
- }, {
261
+ }, ...(nextTestTag ? [{
262
+ hint: `(${testTag} release)`,
263
+ value: nextTestTag
264
+ }] : []), {
246
265
  hint: '(current version)',
247
266
  value: currentVersion
248
267
  }, {
@@ -211,16 +211,26 @@ The tag-release script must run from a npm project.
211
211
  return packageJson.version;
212
212
  };
213
213
  const getNextVersions = currentVersion => {
214
- const [major, minor, patch, beta] = currentVersion.split(/\.|-beta\./).map(Number);
214
+ const regex = /^(\d+)(?:\.(\d+))?(?:\.(\d+))?(?:-(\w+)\.(\d+))?$/i;
215
+ const [, dirtyMajor, dirtyMinor, dirtyPatch, testTag, dirtyTestVersion] = currentVersion.match(regex);
216
+ const major = parseInt(dirtyMajor);
217
+ const minor = parseInt(dirtyMinor) || 0;
218
+ const patch = parseInt(dirtyPatch) || 0;
219
+ const testVersion = parseInt(dirtyTestVersion) || 0;
215
220
  const nextMajor = `${major + 1}.0.0`;
216
221
  const nextMinor = `${major}.${minor + 1}.0`;
217
222
  const nextPatch = `${major}.${minor}.${patch + 1}`;
218
- const nextBeta = beta ? `${major}.${minor}.${patch}-beta.${beta + 1}` : `${major}.${minor}.${patch + 1}-beta.1`;
223
+ const nextAlpha = testTag === 'alpha' ? `${major}.${minor}.${patch}-alpha.${testVersion + 1}` : `${major}.${minor}.${patch + 1}-alpha.1`;
224
+ const nextBeta = testTag === 'beta' ? `${major}.${minor}.${patch}-beta.${testVersion + 1}` : `${major}.${minor}.${patch + 1}-beta.1`;
225
+ const nextTestTag = testTag && !['alpha', 'beta'].includes(testTag) ? `${major}.${minor}.${patch}-${testTag}.${testVersion + 1}` : null;
219
226
  return {
220
227
  nextMajor,
221
228
  nextMinor,
222
229
  nextPatch,
223
- nextBeta
230
+ nextAlpha,
231
+ nextBeta,
232
+ nextTestTag,
233
+ testTag
224
234
  };
225
235
  };
226
236
  const promptForVersion = async currentVersion => {
@@ -228,7 +238,10 @@ const promptForVersion = async currentVersion => {
228
238
  nextMajor,
229
239
  nextMinor,
230
240
  nextPatch,
231
- nextBeta
241
+ nextAlpha,
242
+ nextBeta,
243
+ nextTestTag,
244
+ testTag
232
245
  } = getNextVersions(currentVersion);
233
246
  const choices = [{
234
247
  hint: '(major release)',
@@ -239,10 +252,16 @@ const promptForVersion = async currentVersion => {
239
252
  }, {
240
253
  hint: '(patch release)',
241
254
  value: nextPatch
255
+ }, {
256
+ hint: '(alpha release)',
257
+ value: nextAlpha
242
258
  }, {
243
259
  hint: '(beta release)',
244
260
  value: nextBeta
245
- }, {
261
+ }, ...(nextTestTag ? [{
262
+ hint: `(${testTag} release)`,
263
+ value: nextTestTag
264
+ }] : []), {
246
265
  hint: '(current version)',
247
266
  value: currentVersion
248
267
  }, {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@leverege/build-tools",
3
- "version": "2.33.2-bruno.1",
3
+ "version": "2.33.2",
4
4
  "description": "A collection of build / support tools for Leverege developers",
5
5
  "main": "index.js",
6
6
  "repository": {
@@ -215,28 +215,58 @@ The tag-release script must run from a npm project.
215
215
  }
216
216
 
217
217
  const getNextVersions = ( currentVersion ) => {
218
- const [ major, minor, patch, beta ] = currentVersion.split( /\.|-beta\./ ).map( Number )
218
+ const regex = /^(\d+)(?:\.(\d+))?(?:\.(\d+))?(?:-(\w+)\.(\d+))?$/i
219
+ const [ , dirtyMajor, dirtyMinor, dirtyPatch, testTag, dirtyTestVersion ] = currentVersion.match( regex )
220
+ const major = parseInt( dirtyMajor )
221
+ const minor = parseInt( dirtyMinor ) || 0
222
+ const patch = parseInt( dirtyPatch ) || 0
223
+ const testVersion = parseInt( dirtyTestVersion ) || 0
219
224
 
220
225
  const nextMajor = `${major + 1}.0.0`
221
226
  const nextMinor = `${major}.${minor + 1}.0`
222
227
  const nextPatch = `${major}.${minor}.${patch + 1}`
223
- const nextBeta = beta ? `${major}.${minor}.${patch}-beta.${beta + 1}` : `${major}.${minor}.${patch + 1}-beta.1`
228
+
229
+ const nextAlpha = testTag === 'alpha' ?
230
+ `${major}.${minor}.${patch}-alpha.${testVersion + 1}` :
231
+ `${major}.${minor}.${patch + 1}-alpha.1`
232
+
233
+ const nextBeta = testTag === 'beta' ?
234
+ `${major}.${minor}.${patch}-beta.${testVersion + 1}` :
235
+ `${major}.${minor}.${patch + 1}-beta.1`
236
+
237
+ const nextTestTag = testTag && ![ 'alpha', 'beta' ].includes( testTag ) ?
238
+ `${major}.${minor}.${patch}-${testTag}.${testVersion + 1}` :
239
+ null
224
240
 
225
241
  return {
226
242
  nextMajor,
227
243
  nextMinor,
228
244
  nextPatch,
245
+ nextAlpha,
229
246
  nextBeta,
247
+ nextTestTag,
248
+ testTag,
230
249
  }
231
250
  }
232
251
 
233
252
  const promptForVersion = async ( currentVersion ) => {
234
- const { nextMajor, nextMinor, nextPatch, nextBeta } = getNextVersions( currentVersion )
253
+ const {
254
+ nextMajor,
255
+ nextMinor,
256
+ nextPatch,
257
+ nextAlpha,
258
+ nextBeta,
259
+ nextTestTag,
260
+ testTag
261
+ } = getNextVersions( currentVersion )
262
+
235
263
  const choices = [
236
264
  { hint : '(major release)', value : nextMajor },
237
265
  { hint : '(minor release)', value : nextMinor },
238
266
  { hint : '(patch release)', value : nextPatch },
267
+ { hint : '(alpha release)', value : nextAlpha },
239
268
  { hint : '(beta release)', value : nextBeta },
269
+ ...( nextTestTag ? [ { hint : `(${testTag} release)`, value : nextTestTag } ] : [] ),
240
270
  { hint : '(current version)', value : currentVersion },
241
271
  { value : 'custom' },
242
272
  ]