* Calculates the next version based on current version, bump type, and changes config.
(currentVersion: string, bumpType: BumpType)
| 20 | * Calculates the next version based on current version, bump type, and changes config. |
| 21 | */ |
| 22 | function getNextVersion(currentVersion: string, bumpType: BumpType): string { |
| 23 | if (bumpType === "unstable") { |
| 24 | throw new Error( |
| 25 | "`unstable` bump type should be normalized to a semver bump before calling `getNextVersion`", |
| 26 | ); |
| 27 | } |
| 28 | // Normal stable release |
| 29 | let nextVersion = semver.inc(currentVersion, bumpType as semver.ReleaseType); |
| 30 | if (nextVersion == null) { |
| 31 | throw new Error( |
| 32 | `Invalid version increment: ${currentVersion} + ${bumpType}`, |
| 33 | ); |
| 34 | } |
| 35 | return nextVersion; |
| 36 | } |
| 37 | |
| 38 | interface ChangeFile { |
| 39 | file: string; |
no outgoing calls
no test coverage detected
searching dependent graphs…