Skip to content

Commit

Permalink
fix: correct newVersion
Browse files Browse the repository at this point in the history
  • Loading branch information
hyoban committed Apr 20, 2024
1 parent 65d1c1b commit c7fc449
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@ class ReleaseItPnpmPlugin extends Plugin {
}

async bump(newVersion) {
this.setContext({ newVersion });
let needPublish = false;

if (!this.options["dry-run"]) {
Expand Down Expand Up @@ -187,7 +188,7 @@ class ReleaseItPnpmPlugin extends Plugin {

fs.writeFileSync(
inFile,
`${header + EOL + EOL}## ${version}${EOL}${EOL}${
`${header + EOL + EOL}## ${version}${
changelog ? EOL + EOL + changelog.trim() : ""
}${previousChangelog ? EOL + EOL + previousChangelog.trim() : ""}${EOL}`,
);
Expand All @@ -198,14 +199,15 @@ class ReleaseItPnpmPlugin extends Plugin {
}

async beforeRelease() {
const { newVersion } = this.getContext();
const { inFile } = this.options;
const isDryRun = this.options["dry-run"];

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

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

Expand Down

0 comments on commit c7fc449

Please sign in to comment.