Skip to content

Commit

Permalink
Hook into release-it plugin.getChangelog mechanism
Browse files Browse the repository at this point in the history
  • Loading branch information
webpro committed Apr 21, 2020
1 parent efce4b3 commit b9afe93
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,17 @@ class ConventionalChangelog extends Plugin {
);
}

getChangelog(latestVersion) {
return this.generateChangelog();
}

getChangelogStream(options = {}) {
return conventionalChangelog(Object.assign(options, this.options), null, {
debug: this.config.isDebug ? this.debug : null
});
}

getChangelog(options) {
generateChangelog(options) {
return new Promise((resolve, reject) => {
const resolver = result => resolve(result.toString().trim());
const changelogStream = this.getChangelogStream(options);
Expand All @@ -63,7 +67,7 @@ class ConventionalChangelog extends Plugin {
}

if (!hasInfile) {
changelog = await this.getChangelog({ releaseCount: 0 });
changelog = await this.generateChangelog({ releaseCount: 0 });
this.debug({ changelog });
}

Expand All @@ -82,9 +86,6 @@ class ConventionalChangelog extends Plugin {
async beforeRelease() {
const { infile } = this.options;
const { isDryRun } = this.global;
const changelog = await this.getChangelog();
this.debug({ changelog });
this.config.setContext({ changelog });

this.log.exec(`Writing changelog to ${infile}`, isDryRun);

Expand Down

0 comments on commit b9afe93

Please sign in to comment.