(packages: Packages, patchBranch: string)
| 305 | } |
| 306 | |
| 307 | async function getNewPatchDevVersion(packages: Packages, patchBranch: string): Promise<string> { |
| 308 | const patchMajorMinor = getSemverFromPatchBranch(patchBranch) |
| 309 | if (!patchMajorMinor) { |
| 310 | throw new Error(`Could not get major and minor for ${patchBranch}`) |
| 311 | } |
| 312 | const currentPatch = await getCurrentPatchForPatchVersions(patchMajorMinor) |
| 313 | const newPatch = currentPatch + 1 |
| 314 | const newVersion = `${patchMajorMinor.major}.${patchMajorMinor.minor}.${newPatch}` |
| 315 | const versions = [...(await getAllVersionsPublishedFor(packages, 'dev', newVersion))] |
| 316 | const maxIncrement = getMaxPatchVersionIncrement(versions) |
| 317 | |
| 318 | return `${newVersion}-dev.${maxIncrement + 1}` |
| 319 | } |
| 320 | |
| 321 | function getMaxDevVersionIncrement(versions: string[]): number { |
| 322 | const regex = /\d+\.\d+\.\d+-dev\.(\d+)/ |
no test coverage detected