Throw if changelog version is below package.json version

This commit is contained in:
Fabio Berger
2018-07-02 13:32:22 +02:00
parent 9c7289d7a3
commit bdda1f2992

View File

@@ -44,6 +44,9 @@ export const utils = {
nextVersionIfValid = semver.inc(currentVersion, 'patch');
}
const lastEntry = changelog[0];
if (semver.gt(currentVersion, lastEntry.version)) {
throw new Error(`Package.json version cannot be greater then last CHANGELOG entry. Check: ${packageName}`);
}
nextVersionIfValid = semver.eq(lastEntry.version, currentVersion)
? semver.inc(currentVersion, 'patch')
: lastEntry.version;