Skip to content

Commit c383afb

Browse files
committed
style: refactor code
1 parent 1b05891 commit c383afb

5 files changed

Lines changed: 11 additions & 11 deletions

File tree

lib/git.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ export default class Git extends CoreGit {
112112
return res;
113113
}
114114

115-
async getReleaseTags ( { allowMajorTag } = {} ) {
115+
async getReleaseTags ( { majorTagEnabled } = {} ) {
116116
const res = await this.getTags();
117117
if ( !res.ok ) return res;
118118

@@ -194,7 +194,7 @@ export default class Git extends CoreGit {
194194

195195
// tag is not set
196196
if ( tags[ tag ].current == null ) {
197-
if ( tags[ tag ].isMajorTag && !allowMajorTag ) {
197+
if ( tags[ tag ].isMajorTag && !majorTagEnabled ) {
198198
delete releaseTags[ tag ];
199199
}
200200
else if ( tags[ tag ].version ) {
@@ -203,7 +203,7 @@ export default class Git extends CoreGit {
203203
}
204204

205205
// major tag is set, but not allowed
206-
else if ( tags[ tag ].isMajorTag && !allowMajorTag ) {
206+
else if ( tags[ tag ].isMajorTag && !majorTagEnabled ) {
207207
releaseTags[ tag ].action = "delete";
208208
}
209209

lib/package.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -478,7 +478,7 @@ export default class Package {
478478
if ( !res.ok ) return res;
479479
}
480480

481-
res = await this.git.getReleaseTags( { "allowMajorTag": this.cliConfig?.release.allowMajorTag } );
481+
res = await this.git.getReleaseTags( { "majorTagEnabled": this.cliConfig?.release.majorTagEnabled } );
482482
if ( !res.ok ) return res;
483483
const tags = res.data;
484484

lib/package/release.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ export default class Publish {
8888
this.#originalBranch = status.head.branch;
8989

9090
// check allowed branch
91-
if ( this.#pkg.cliConfig?.release.allowedBranches && !this.#pkg.cliConfig.release.allowedBranches.includes( this.#originalBranch ) ) {
91+
if ( this.#pkg.cliConfig?.release.releaseBranches && !this.#pkg.cliConfig.release.releaseBranches.includes( this.#originalBranch ) ) {
9292
return result( [ 500, "Unable to create release from the current branch" ] );
9393
}
9494

@@ -154,7 +154,7 @@ export default class Publish {
154154

155155
this.#majorLatestTag = `v${ this.#currentRelease.majorNumber }.latest`;
156156

157-
if ( this.#pkg.cliConfig?.release.allowMajorTag ) {
157+
if ( this.#pkg.cliConfig?.release.majorTagEnabled ) {
158158
this.#majorTag = `v${ this.#currentRelease.majorNumber }`;
159159
}
160160
}

resources/cli.config.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,8 @@ meta:
5252

5353
release:
5454
enabled: false
55-
allowMajorTag: false
56-
allowedBranches: [main]
55+
releaseBranches: [main]
56+
majorTagEnabled: false
5757

5858
docker:
5959
composeFile: compose.yaml

resources/schemas/cli.config.schema.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -109,13 +109,13 @@ properties:
109109
type: object
110110
properties:
111111
enabled: { type: boolean }
112-
allowMajorTag: { type: boolean }
113-
allowedBranches:
112+
releaseBranches:
114113
anyOf:
115114
- type: "null"
116115
- { type: array, items: { type: string }, minItems: 1, uniqueItems: true }
116+
majorTagEnabled: { type: boolean }
117117
additionalProperties: false
118-
required: [enabled, allowMajorTag, allowedBranches]
118+
required: [enabled, releaseBranches, majorTagEnabled]
119119

120120
docker:
121121
type: object

0 commit comments

Comments
 (0)