diff --git a/package.json b/package.json index 66d3c7f..8c4d6ee 100644 --- a/package.json +++ b/package.json @@ -49,7 +49,9 @@ }, "release-it": { "plugins": { - "./src/index.js": {} + "./src/index.js": { + "inFile": "CHANGELOG.md" + } }, "git": { "commitMessage": "chore: release ${version}", diff --git a/src/index.js b/src/index.js index 49743ba..8de10d8 100644 --- a/src/index.js +++ b/src/index.js @@ -198,6 +198,18 @@ class ReleaseItPnpmPlugin extends Plugin { } } + async beforeRelease() { + const { inFile } = this.options; + const isDryRun = this.options["dry-run"]; + + this.log.exec(`Writing changelog to ${inFile}`, isDryRun); + + if (inFile && !isDryRun) { + const { md } = await generate(); + await this.writeChangelog(md); + } + } + async release() { if (this.options?.disableRelease) return;