Skip to content

Commit 2f110f4

Browse files
committed
refactor(updaters): simplify version extraction
- Removed redundant path splitting. - Improved efficiency of extension extraction.
1 parent f8b4153 commit 2f110f4

1 file changed

Lines changed: 2 additions & 4 deletions

File tree

src/updaters/customUpdater.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,7 @@ export class CustomUpdater implements UpdaterInterface {
2929
}
3030

3131
try {
32-
const lastPath = this.filePath.split('/').pop() || '';
33-
const extension = lastPath.split('.').pop() || '';
32+
const extension = this.filePath.split('.').pop() || '';
3433
if (extension === 'json') {
3534
this.currentVersion = this.manifestParser.getVersion(this.filePath, 'json', {
3635
jsonPath: [this.variableName],
@@ -59,8 +58,7 @@ export class CustomUpdater implements UpdaterInterface {
5958
}
6059

6160
const newVersion = calculateNextVersion(oldVersion, releaseType);
62-
const lastPath = this.filePath.split('/').pop() || '';
63-
const extension = lastPath.split('.').pop() || '';
61+
const extension = this.filePath.split('.').pop() || '';
6462
if (extension === 'json') {
6563
this.manifestParser.updateVersion(this.filePath, newVersion, 'json', {
6664
jsonPath: [this.variableName],

0 commit comments

Comments
 (0)