Skip to content

Commit

Permalink
add new --changelog option (#912)
Browse files Browse the repository at this point in the history
  • Loading branch information
husseinraoouf committed Aug 9, 2022
1 parent c2ae00d commit 5798a7a
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 2 deletions.
1 change: 1 addition & 0 deletions lib/cli.js
Expand Up @@ -20,6 +20,7 @@ const helpText = `Release It! v${pkg.version}
--only-version Prompt only for version, no further interaction
-v --version Print release-it version number
--release-version Print version number to be released
--changelog Print changelog for the version to be released
-V --verbose Verbose output (user hooks output)
-VV Extra verbose output (also internal commands output)
Expand Down
6 changes: 5 additions & 1 deletion lib/config.js
Expand Up @@ -109,7 +109,7 @@ class Config {
}

get isCI() {
return Boolean(this.options.ci) || this.isReleaseVersion;
return Boolean(this.options.ci) || this.isReleaseVersion || this.isChangelog;
}

get isPromptOnlyVersion() {
Expand All @@ -119,6 +119,10 @@ class Config {
get isReleaseVersion() {
return Boolean(this.options['release-version']);
}

get isChangelog() {
return Boolean(this.options['changelog']);
}
}

export default Config;
7 changes: 6 additions & 1 deletion lib/index.js
Expand Up @@ -78,7 +78,7 @@ const runTasks = async (opts, di) => {
const action = config.isIncrement ? 'release' : 'update';
const suffix = version && config.isIncrement ? `${latestVersion}...${version}` : `currently at ${latestVersion}`;

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

log.preview({ title: 'changelog', text: changelog });
Expand All @@ -93,6 +93,11 @@ const runTasks = async (opts, di) => {
process.exit(0);
}

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

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

Expand Down

0 comments on commit 5798a7a

Please sign in to comment.