Skip to content

Commit 1f37e54

Browse files
committed
refactor: rename currentRelease -> parentRelease
1 parent 65b63da commit 1f37e54

5 files changed

Lines changed: 35 additions & 35 deletions

File tree

lib/commands/ls.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ export default class extends Command {
101101
: null;
102102

103103
const isDirty = status.isDirty || currentBranchPushStatus,
104-
isUnreleased = ( status.currentReleaseDistance || ( !status.head.branch && status.head.abbrev ) ) && pkg.isReleaseEnabled;
104+
isUnreleased = ( status.parentReleaseDistance || ( !status.head.branch && status.head.abbrev ) ) && pkg.isReleaseEnabled;
105105

106106
// unreleased filter includes unreleased and dirty packages
107107
if ( options.unreleased && !( isUnreleased || isDirty ) ) continue;
@@ -121,12 +121,12 @@ export default class extends Command {
121121
? ansi.error( ` ${ currentBranchPushStatus } ` )
122122
: " - ",
123123
"lastRelease": this.#formatVersion( status.releases.lastRelease, pkg.isReleaseEnabled ),
124-
"parentRelease": this.#formatVersion( status.currentRelease, pkg.isReleaseEnabled ) + ( status.currentRelease && status.releases?.lastRelease.eq( status.currentRelease )
124+
"parentRelease": this.#formatVersion( status.parentRelease, pkg.isReleaseEnabled ) + ( status.parentRelease && status.releases?.lastRelease.eq( status.parentRelease )
125125
? " 🚩"
126126
: " " ),
127127
"unreleasedCommits": pkg.isReleaseEnabled
128-
? ( status.currentReleaseDistance
129-
? ansi.error( ` ${ status.currentReleaseDistance } ` )
128+
? ( status.parentReleaseDistance
129+
? ansi.error( ` ${ status.parentReleaseDistance } ` )
130130
: " - " )
131131
: ansi.dim( " DISABLED " ),
132132
} );

lib/commands/status.js

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -40,15 +40,15 @@ Stable release (latest): ${ ansi.hl( status.releases.lastStableRelease?.versionS
4040
Last release (next): ${ ansi.hl( status.releases.lastRelease?.versionString || "-" ) }
4141
4242
Branch name: ${ ansi.hl( status.head.branch ) }
43-
Parent release: ${ ansi.hl( status.currentRelease?.versionString || "-" ) }${ status.currentRelease && status.releases.lastRelease?.eq( status.currentRelease )
43+
Parent release: ${ ansi.hl( status.parentRelease?.versionString || "-" ) }${ status.parentRelease && status.releases.lastRelease?.eq( status.parentRelease )
4444
? " 🚩"
4545
: "" }
4646
Working tree status: ${ status.isDirty
4747
? ansi.error( " DIRTY " )
4848
: ansi.ok( " COMMITED " ) }
4949
Unreleased commits: ${ pkg.isReleaseEnabled
50-
? ( status.currentReleaseDistance
51-
? ansi.error( " " + status.currentReleaseDistance + " " )
50+
? ( status.parentReleaseDistance
51+
? ansi.error( " " + status.parentReleaseDistance + " " )
5252
: ansi.ok( " RELEASED " ) )
5353
: "-" }
5454
`.trim() );
@@ -136,8 +136,8 @@ Clone wiki: ${ ansi.hl( upstream.wikiSshCloneUrl ) }
136136
"align": "end",
137137
"format": status => {
138138
if ( pkg.isReleaseEnabled ) {
139-
if ( status.currentRelease ) {
140-
return `${ status.currentRelease.versionString }${ status.releases.lastRelease.eq( status.currentRelease )
139+
if ( status.parentRelease ) {
140+
return `${ status.parentRelease.versionString }${ status.releases.lastRelease.eq( status.parentRelease )
141141
? " 🚩"
142142
: " " }`;
143143
}
@@ -158,8 +158,8 @@ Clone wiki: ${ ansi.hl( upstream.wikiSshCloneUrl ) }
158158
"align": "end",
159159
"format": status => {
160160
if ( pkg.isReleaseEnabled ) {
161-
if ( status.currentReleaseDistance ) {
162-
return ansi.error( ` ${ status.currentReleaseDistance } ` );
161+
if ( status.parentReleaseDistance ) {
162+
return ansi.error( ` ${ status.parentReleaseDistance } ` );
163163
}
164164
else {
165165
return " - ";

lib/git.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -76,8 +76,8 @@ export default class Git extends CoreGit {
7676
200,
7777
new GitChangelog( res.data.changes, {
7878
"upstream": this.upstream,
79-
"parentRelease": res.data.currentRelease,
80-
"currentRelease": null,
79+
"parentRelease": res.data.parentRelease,
80+
"endRelease": null,
8181
commitTypes,
8282
} )
8383
);
@@ -95,7 +95,7 @@ export default class Git extends CoreGit {
9595
new GitChangelog( res.data.changes, {
9696
"upstream": this.upstream,
9797
"parentRelease": res.data.startRelease,
98-
"currentRelease": res.data.endRelease,
98+
"endRelease": res.data.endRelease,
9999
commitTypes,
100100
} )
101101
);

lib/git/changelog.js

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -23,16 +23,16 @@ export default class GitChangelog {
2323
#changes;
2424
#upstream;
2525
#parentRelease;
26-
#currentRelease;
26+
#endRelease;
2727
#changesGroups;
2828
#notableChanges = 0;
2929
#report;
3030

31-
constructor ( changes, { upstream, parentRelease, currentRelease, commitTypes } ) {
31+
constructor ( changes, { upstream, parentRelease, endRelease, commitTypes } ) {
3232
this.#changes = changes;
3333
this.#upstream = upstream;
3434
this.#parentRelease = parentRelease;
35-
this.#currentRelease = currentRelease;
35+
this.#endRelease = endRelease;
3636

3737
this.#indexChanges( commitTypes || DEFAULT_COMMIT_TYPES );
3838
}
@@ -51,8 +51,8 @@ export default class GitChangelog {
5151
return this.#parentRelease;
5252
}
5353

54-
get currentRelease () {
55-
return this.#currentRelease;
54+
get endRelease () {
55+
return this.#endRelease;
5656
}
5757

5858
get changes () {
@@ -80,22 +80,22 @@ export default class GitChangelog {
8080
}
8181

8282
// public
83-
async createChangelog ( { currentRelease, header, text, ansi = true } = {} ) {
84-
currentRelease ||= this.#currentRelease;
83+
async createChangelog ( { endRelease, header, text, ansi = true } = {} ) {
84+
endRelease ||= this.#endRelease;
8585

8686
var changelog = await ejs.renderFile( resolve( "#resources/templates/changelog.md.ejs", import.meta.url ), {
8787
"changelog": this,
88-
currentRelease,
88+
endRelease,
8989
"changesGroups": this.#changesGroups,
90-
"compareUrl": !this.#parentRelease || !currentRelease
90+
"compareUrl": !this.#parentRelease || !endRelease
9191
? null
92-
: this.#upstream?.getCompareUrl( this.#parentRelease.versionString, currentRelease.versionString ),
92+
: this.#upstream?.getCompareUrl( this.#parentRelease.versionString, endRelease.versionString ),
9393
} );
9494

9595
changelog = changelog.trim();
9696

9797
if ( header ) {
98-
changelog = this.#createHeader( currentRelease ) + "\n\n" + changelog;
98+
changelog = this.#createHeader( endRelease ) + "\n\n" + changelog;
9999
}
100100

101101
if ( text ) {
@@ -106,10 +106,10 @@ export default class GitChangelog {
106106
}
107107
}
108108

109-
createChangesList ( { currentRelease, text = true, ansi = true } = {} ) {
110-
currentRelease ||= this.#currentRelease;
109+
createChangesList ( { endRelease, text = true, ansi = true } = {} ) {
110+
endRelease ||= this.#endRelease;
111111

112-
const lines = [ this.#createHeader( currentRelease ) ];
112+
const lines = [ this.#createHeader( endRelease ) ];
113113

114114
if ( this.hasChanges ) {
115115
for ( const group of this.#changesGroups ) {
@@ -264,14 +264,14 @@ export default class GitChangelog {
264264
);
265265
}
266266

267-
#createHeader ( currentRelease ) {
268-
if ( this.#parentRelease && currentRelease ) {
269-
return `**Changes between the releases: \`${ this.#parentRelease.versionString }\` (${ this.#parentRelease.changelogDate }) ... \`${ currentRelease.versionString }\` (${ currentRelease.changelogDate })**`;
267+
#createHeader ( endRelease ) {
268+
if ( this.#parentRelease && endRelease ) {
269+
return `**Changes between the releases: \`${ this.#parentRelease.versionString }\` (${ this.#parentRelease.changelogDate }) ... \`${ endRelease.versionString }\` (${ endRelease.changelogDate })**`;
270270
}
271-
else if ( !this.#parentRelease && currentRelease ) {
272-
return `**Changes for the release: \`${ currentRelease.versionString }\` (${ currentRelease.changelogDate })**`;
271+
else if ( !this.#parentRelease && endRelease ) {
272+
return `**Changes for the release: \`${ endRelease.versionString }\` (${ endRelease.changelogDate })**`;
273273
}
274-
else if ( this.#parentRelease && !this.#currentRelease ) {
274+
else if ( this.#parentRelease && !this.#endRelease ) {
275275
return `**Changes since the release: \`${ this.#parentRelease.versionString }\` (${ this.#parentRelease.changelogDate })**`;
276276
}
277277
else {

lib/package/release.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -506,7 +506,7 @@ export default class Publish {
506506
async #updateChangelog () {
507507
var res,
508508
changelogMarkdown = await this.#changelog.createChangelog( {
509-
"currentRelease": this.#newRelease,
509+
"endRelease": this.#newRelease,
510510
} );
511511

512512
while ( true ) {

0 commit comments

Comments
 (0)