Skip to content

Commit d9cf304

Browse files
committed
refactor: rename parent release
1 parent 9e07c12 commit d9cf304

3 files changed

Lines changed: 19 additions & 19 deletions

File tree

lib/git.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ export default class Git extends CoreGit {
7676
200,
7777
new GitChangelog( res.data.changes, {
7878
"upstream": this.upstream,
79-
"previousRelease": res.data.currentRelease,
79+
"parentRelease": res.data.currentRelease,
8080
"currentRelease": null,
8181
commitTypes,
8282
} )
@@ -94,7 +94,7 @@ export default class Git extends CoreGit {
9494
200,
9595
new GitChangelog( res.data.changes, {
9696
"upstream": this.upstream,
97-
"previousRelease": res.data.startRelease,
97+
"parentRelease": res.data.startRelease,
9898
"currentRelease": res.data.endRelease,
9999
commitTypes,
100100
} )

lib/git/changelog.js

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -22,16 +22,16 @@ const TITLES = {
2222
export default class GitChangelog {
2323
#changes;
2424
#upstream;
25-
#previousRelease;
25+
#parentRelease;
2626
#currentRelease;
2727
#changesGroups;
2828
#notableChanges = 0;
2929
#report;
3030

31-
constructor ( changes, { upstream, previousRelease, currentRelease, commitTypes } ) {
31+
constructor ( changes, { upstream, parentRelease, currentRelease, commitTypes } ) {
3232
this.#changes = changes;
3333
this.#upstream = upstream;
34-
this.#previousRelease = previousRelease;
34+
this.#parentRelease = parentRelease;
3535
this.#currentRelease = currentRelease;
3636

3737
this.#indexChanges( commitTypes || DEFAULT_COMMIT_TYPES );
@@ -47,8 +47,8 @@ export default class GitChangelog {
4747
}
4848

4949
// properties
50-
get previousRelease () {
51-
return this.#previousRelease;
50+
get parentRelease () {
51+
return this.#parentRelease;
5252
}
5353

5454
get currentRelease () {
@@ -87,9 +87,9 @@ export default class GitChangelog {
8787
"changelog": this,
8888
currentRelease,
8989
"changesGroups": this.#changesGroups,
90-
"compareUrl": !this.#previousRelease || !currentRelease
90+
"compareUrl": !this.#parentRelease || !currentRelease
9191
? null
92-
: this.#upstream?.getCompareUrl( this.#previousRelease.versionString, currentRelease.versionString ),
92+
: this.#upstream?.getCompareUrl( this.#parentRelease.versionString, currentRelease.versionString ),
9393
} );
9494

9595
changelog = changelog.trim();
@@ -181,10 +181,10 @@ export default class GitChangelog {
181181
}
182182

183183
getNextVersion ( preReleaseTag ) {
184-
const previousRelease = this.previousRelease || SemanticVersion.initialVersion;
184+
const parentRelease = this.parentRelease || SemanticVersion.initialVersion;
185185

186186
try {
187-
const nextVersion = previousRelease.increment( previousRelease.isInitialVersion
187+
const nextVersion = parentRelease.increment( parentRelease.isInitialVersion
188188
? "patch"
189189
: this.hasBreakingChanges
190190
? "major"
@@ -265,14 +265,14 @@ export default class GitChangelog {
265265
}
266266

267267
#createHeader ( currentRelease ) {
268-
if ( this.#previousRelease && currentRelease ) {
269-
return `**Changes between the releases: \`${ this.#previousRelease.versionString }\` (${ this.#previousRelease.changelogDate }) ... \`${ currentRelease.versionString }\` (${ currentRelease.changelogDate })**`;
268+
if ( this.#parentRelease && currentRelease ) {
269+
return `**Changes between the releases: \`${ this.#parentRelease.versionString }\` (${ this.#parentRelease.changelogDate }) ... \`${ currentRelease.versionString }\` (${ currentRelease.changelogDate })**`;
270270
}
271-
else if ( !this.#previousRelease && currentRelease ) {
271+
else if ( !this.#parentRelease && currentRelease ) {
272272
return `**Changes for the release: \`${ currentRelease.versionString }\` (${ currentRelease.changelogDate })**`;
273273
}
274-
else if ( this.#previousRelease && !this.#currentRelease ) {
275-
return `**Changes since the release: \`${ this.#previousRelease.versionString }\` (${ this.#previousRelease.changelogDate })**`;
274+
else if ( this.#parentRelease && !this.#currentRelease ) {
275+
return `**Changes since the release: \`${ this.#parentRelease.versionString }\` (${ this.#parentRelease.changelogDate })**`;
276276
}
277277
else {
278278
return "**Changes since the initial commit**";

lib/package/release.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -96,9 +96,9 @@ export default class Publish {
9696
if ( this.#parentRelease ) {
9797
res = await this.#pkg.git.getCommit( { "commitRef": this.#parentRelease.versionString } );
9898
if ( !res.ok ) return res;
99-
const previousReleaseCommit = res.data;
99+
const parentReleaseCommit = res.data;
100100

101-
if ( !previousReleaseCommit.branches.has( this.#parentReleaseBranch ) ) {
101+
if ( !parentReleaseCommit.branches.has( this.#parentReleaseBranch ) ) {
102102
return result( [ 500, `Release "${ this.#parentRelease.versionString }" must be a release branch "${ this.#parentReleaseBranch }" head` ] );
103103
}
104104
}
@@ -432,7 +432,7 @@ export default class Publish {
432432
if ( !res.ok ) return res;
433433

434434
this.#changelog = res.data;
435-
this.#parentRelease = this.#changelog.previousRelease;
435+
this.#parentRelease = this.#changelog.parentRelease;
436436
}
437437

438438
return result( 200, this.#changelog );

0 commit comments

Comments
 (0)