Skip to content

Commit

Permalink
Print --release-version after incremented version is resolved
Browse files Browse the repository at this point in the history
  • Loading branch information
webpro committed Jan 9, 2022
1 parent fb73af2 commit 5b04ba5
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 8 deletions.
6 changes: 5 additions & 1 deletion lib/plugin/version/Version.js
Expand Up @@ -106,7 +106,11 @@ class Version extends Plugin {
}

if (this.config.isCI && !increment) {
return semver.inc(latestVersion, 'patch');
if (isPreRelease) {
return semver.inc(latestVersion, 'prepatch', preReleaseId);
} else {
return semver.inc(latestVersion, 'patch');
}
}

const normalizedType = RELEASE_TYPES.includes(increment) && isPreRelease ? `pre${increment}` : increment;
Expand Down
16 changes: 9 additions & 7 deletions lib/tasks.js
Expand Up @@ -77,24 +77,26 @@ const runTasks = async (opts, di) => {
version = latestVersion;
}

if (config.isReleaseVersion) {
log.log(version);
process.exit(0);
}

config.setContext({ name, latestVersion, version, changelog });

const action = config.isIncrement ? 'release' : 'update';
const suffix = version && config.isIncrement ? `${latestVersion}...${version}` : `currently at ${latestVersion}`;

log.obtrusive(`🚀 Let's ${action} ${name} (${suffix})`);
if (!config.isReleaseVersion) {
log.obtrusive(`🚀 Let's ${action} ${name} (${suffix})`);

log.preview({ title: 'changelog', text: changelog });
log.preview({ title: 'changelog', text: changelog });
}

if (config.isIncrement) {
version = version || (await reduceUntil(plugins, plugin => plugin.getIncrementedVersion(incrementBase)));
}

if (config.isReleaseVersion) {
console.log(version);
process.exit(0);
}

config.setContext(parseVersion(version));

if (config.isPromptOnlyVersion) {
Expand Down

0 comments on commit 5b04ba5

Please sign in to comment.