Skip to content

Commit a352806

Browse files
committed
feat: clear changelog on major release
1 parent 16160a3 commit a352806

1 file changed

Lines changed: 13 additions & 12 deletions

File tree

lib/package/release.js

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -551,23 +551,24 @@ export default class Publish {
551551
"linkify": false,
552552
} );
553553

554-
var fullChangelog = `
554+
var fullChangelog =
555+
`
555556
# Changelog
556557
557558
### ${ this.#currentRelease.versionString } (${ this.#currentRelease.changelogDate })
558559
559560
${ this.#changelog.linkifyMarkdown( changelogMarkdown ) }
560-
`.trim();
561-
562-
// patch CHANGELOG.md
563-
if ( await pathExists( this.#pkg.root + "/CHANGELOG.md" ) ) {
564-
fullChangelog +=
565-
"\n" +
566-
fs
567-
.readFileSync( this.#pkg.root + "/CHANGELOG.md", "utf8" )
568-
.replace( /# Changelog\n/, "" )
569-
.trim() +
570-
"\n";
561+
`.trim() + "\n";
562+
563+
// append CHANGELOG.md
564+
if ( !this.#currentRelease.isMajor ) {
565+
if ( await pathExists( this.#pkg.root + "/CHANGELOG.md" ) ) {
566+
fullChangelog +=
567+
fs
568+
.readFileSync( this.#pkg.root + "/CHANGELOG.md", "utf8" )
569+
.replace( /# Changelog\n/, "" )
570+
.trim() + "\n";
571+
}
571572
}
572573

573574
// write CHANGELOG.md

0 commit comments

Comments
 (0)