Fix patching

This commit is contained in:
adrinr 2023-04-21 14:25:36 +01:00
parent 7e271fed18
commit eaab3dfc46
2 changed files with 9 additions and 6 deletions

View File

@ -1,5 +1,5 @@
{ {
"version": "0.0.999-alpha.35", "version": "0.0.999-alpha.38",
"npmClient": "yarn", "npmClient": "yarn",
"packages": [ "packages": [
"packages/backend-core", "packages/backend-core",

View File

@ -9,7 +9,7 @@ const lernaData = JSON.parse(fileData)
// Get current version and split into major, minor, patch, and alpha components // Get current version and split into major, minor, patch, and alpha components
const currentVersion = lernaData.version const currentVersion = lernaData.version
const [versionWithoutPrerelease, prerelease] = currentVersion.split("-") const [versionWithoutPrerelease, alpha] = currentVersion.split("-")
const [major, minor, patch] = versionWithoutPrerelease.split(".").map(Number) const [major, minor, patch] = versionWithoutPrerelease.split(".").map(Number)
// Calculate new version based on specified version bump // Calculate new version based on specified version bump
@ -25,10 +25,13 @@ switch (versionBump) {
newVersion = `${major}.${minor}.${patch + 1}` newVersion = `${major}.${minor}.${patch + 1}`
break break
case "alpha": case "alpha":
const newPrerelease = (prerelease || -1) + 1 let newAlphaVersion = 0
newVersion = prerelease if (alpha) {
? `${versionWithoutPrerelease}-alpha.${newPrerelease}` const [_, alphaVersion] = alpha.split(".")
: `${major}.${minor}.${patch}-alpha.${newPrerelease}` newAlphaVersion = +alphaVersion + 1
}
newVersion = `${versionWithoutPrerelease}-alpha.${newAlphaVersion}`
break break
default: default:
console.error(`Invalid version bump '${versionBump}' specified.`) console.error(`Invalid version bump '${versionBump}' specified.`)