Skip to content

Commit

Permalink
fix: read and generate changelog before release
Browse files Browse the repository at this point in the history
  • Loading branch information
hyoban committed Apr 20, 2024
1 parent e25ccde commit 5210b1e
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,9 @@
},
"release-it": {
"plugins": {
"./src/index.js": {}
"./src/index.js": {
"inFile": "CHANGELOG.md"
}
},
"git": {
"commitMessage": "chore: release ${version}",
Expand Down
12 changes: 12 additions & 0 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down

0 comments on commit 5210b1e

Please sign in to comment.