Skip to content

Commit

Permalink
fix: show version in changelog
Browse files Browse the repository at this point in the history
  • Loading branch information
hyoban committed Apr 20, 2024
1 parent f85a0fa commit 2d37bce
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ class ReleaseItPnpmPlugin extends Plugin {
}
}

async writeChangelog(changelog) {
async writeChangelog(changelog, version) {
const { inFile, header: _header = "# Changelog" } = this.options;
const header = _header.split(/\r\n|\r|\n/g).join(EOL);

Expand All @@ -187,10 +187,9 @@ class ReleaseItPnpmPlugin extends Plugin {

fs.writeFileSync(
inFile,
header +
(changelog ? EOL + EOL + changelog.trim() : "") +
(previousChangelog ? EOL + EOL + previousChangelog.trim() : "") +
EOL,
`${header + EOL + EOL}## ${version}${EOL}${EOL}${
changelog ? EOL + EOL + changelog.trim() : ""
}${previousChangelog ? EOL + EOL + previousChangelog.trim() : ""}${EOL}`,
);

if (!hasInFile) {
Expand All @@ -205,8 +204,8 @@ class ReleaseItPnpmPlugin extends Plugin {
this.log.exec(`Writing changelog to ${inFile}`, isDryRun);

if (inFile && !isDryRun) {
const { md } = await generate();
await this.writeChangelog(md);
const { md, config } = await generate();
await this.writeChangelog(md, config.to);
}
}

Expand Down

0 comments on commit 2d37bce

Please sign in to comment.