Skip to content

Commit

Permalink
Fix regression caused by 46fc8fa
Browse files Browse the repository at this point in the history
  • Loading branch information
webpro committed Jun 5, 2023
1 parent 0198b89 commit 1ea14aa
Showing 1 changed file with 13 additions and 12 deletions.
25 changes: 13 additions & 12 deletions lib/index.js
Expand Up @@ -15,7 +15,7 @@ const runTasks = async (opts, di) => {
container.config = container.config || new Config(opts);

const { config } = container;
const { isCI, isVerbose, verbosityLevel, isDryRun } = config;
const { isCI, isVerbose, verbosityLevel, isDryRun, isChangelog, isReleaseVersion } = config;

container.log = container.log || new Logger({ isCI, isVerbose, verbosityLevel, isDryRun });
container.spinner = container.spinner || new Spinner({ container, config });
Expand Down Expand Up @@ -62,6 +62,11 @@ const runTasks = async (opts, di) => {
const latestVersion = (await reduceUntil(plugins, plugin => plugin.getLatestVersion())) || '0.0.0';
const changelog = await reduceUntil(plugins, plugin => plugin.getChangelog(latestVersion));

if (isChangelog) {
console.log(changelog);
process.exit(0);
}

const incrementBase = { latestVersion, increment, isPreRelease, preReleaseId };

let version;
Expand All @@ -74,30 +79,26 @@ const runTasks = async (opts, di) => {

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

const action = config.isIncrement ? 'release' : 'update';
const suffix = version && config.isIncrement ? `${latestVersion}...${version}` : `currently at ${latestVersion}`;
if (!isReleaseVersion) {
const action = config.isIncrement ? 'release' : 'update';
const suffix = version && config.isIncrement ? `${latestVersion}...${version}` : `currently at ${latestVersion}`;
log.obtrusive(`🚀 Let's ${action} ${name} (${suffix})`);
log.preview({ title: 'changelog', text: changelog });
}

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

if (!version) {
log.obtrusive(`No new version to release`);
} else if (!config.isReleaseVersion && !config.isChangelog) {
log.obtrusive(`🚀 Let's ${action} ${name} (${suffix})`);
log.preview({ title: 'changelog', text: changelog });
}

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

if (config.isChangelog) {
console.log(changelog);
process.exit(0);
}

if (version) {
config.setContext(parseVersion(version));

Expand Down

0 comments on commit 1ea14aa

Please sign in to comment.