diff --git a/change/beachball-f4d4d8d6-7911-4657-87f3-f552ce6eed0f.json b/change/beachball-f4d4d8d6-7911-4657-87f3-f552ce6eed0f.json new file mode 100644 index 00000000..7126adcc --- /dev/null +++ b/change/beachball-f4d4d8d6-7911-4657-87f3-f552ce6eed0f.json @@ -0,0 +1,7 @@ +{ + "type": "patch", + "comment": "Ensure we can bump premajor, preminor and prepatch with a prereleasePrefix", + "packageName": "beachball", + "email": "kjell.knapen@craftzing.com", + "dependentChangeType": "patch" +} diff --git a/src/bump/bumpPackageInfoVersion.ts b/src/bump/bumpPackageInfoVersion.ts index b1d9b63b..7e3ef5e7 100644 --- a/src/bump/bumpPackageInfoVersion.ts +++ b/src/bump/bumpPackageInfoVersion.ts @@ -17,10 +17,16 @@ export function bumpPackageInfoVersion(pkgName: string, bumpInfo: BumpInfo, opti } else if (info.private) { console.log(`Skipping bumping private package "${pkgName}"`); } else { + // Ensure we can bump the correct versions + let bumpAsPrerelease = false; + if (options.prereleasePrefix && ! ["premajor", "preminor", "prepatch"].includes(changeType)) { + bumpAsPrerelease = true; + } + // Version should be updated info.version = semver.inc( info.version, - options.prereleasePrefix ? 'prerelease' : changeType, + bumpAsPrerelease ? 'prerelease' : changeType, options.prereleasePrefix || undefined, options.identifierBase ) as string;