semantic-release/lib/get-next-version.js
Pierre Vanduynslager a94e08de9a feat: pass cwd and env context to plugins
- Allow to run semantic-release (via API) from anywhere passing the current working directory.
- Allows to simplify the tests and to run them in parallel in both the core and plugins.
2018-07-17 00:42:04 -04:00

16 lines
473 B
JavaScript

const semver = require('semver');
const {FIRST_RELEASE} = require('./definitions/constants');
module.exports = ({nextRelease: {type}, lastRelease, logger}) => {
let version;
if (lastRelease.version) {
version = semver.inc(lastRelease.version, type);
logger.log('The next release version is %s', version);
} else {
version = FIRST_RELEASE;
logger.log('There is no previous release, the next release version is %s', version);
}
return version;
};