Skip to content

Commit 55ba55b

Browse files
committed
fix(CustomUpdater): improve regex for version extraction
- Removed unnecessary path splitting - Updated regex for better version matching - Improved error handling for version lookup - Removed console logs from ManifestParser - Updated sourcemap
1 parent 01e507f commit 55ba55b

3 files changed

Lines changed: 10 additions & 13 deletions

File tree

dist/index.js

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
/**
2-
* universal-version-bump v0.13.0
2+
* universal-version-bump v0.13.3
33
* Universal Version Bump
44
*
55
* Description: A GitHub Action to automatically bump versions across any app (Node, Python, PHP, Docker, etc.)
66
* Author: Taj <[email protected]>
77
* Homepage: https://github.com/taj54/universal-version-bump#readme
88
* License: MIT
9-
* Generated on Tue, 02 Sep 2025 13:17:46 GMT
9+
* Generated on Wed, 03 Sep 2025 14:49:27 GMT
1010
*/
1111
require('./sourcemap-register.js');/******/ (() => { // webpackBootstrap
1212
/******/ var __webpack_modules__ = ({
@@ -33442,15 +33442,15 @@ class CustomUpdater {
3344233442
return this.currentVersion;
3344333443
}
3344433444
try {
33445-
const lastPath = this.filePath.split('/').pop() || '';
33446-
const extension = lastPath.split('.').pop() || '';
33445+
const extension = this.filePath.split('.').pop() || '';
3344733446
if (extension === 'json') {
3344833447
this.currentVersion = this.manifestParser.getVersion(this.filePath, 'json', {
3344933448
jsonPath: [this.variableName],
3345033449
});
3345133450
}
3345233451
else {
33453-
const regex = new RegExp(`(${this.variableName}\\s*(=|=>|:)\\s*['"])([0-9]+\\.[0-9]+\\.[0-9]+(?:-[a-zA-Z0-9_.-]+)?(?:\\+[a-zA-Z0-9_.-]+)?)(['"])`);
33452+
// console.log(extension, this.filePath);
33453+
const regex = new RegExp(`(${this.variableName}\\s*(?:=|=>|:)\\s*['"])([0-9]+\\.[0-9]+\\.[0-9]+(?:-[a-zA-Z0-9_.-]+)?(?:\\+[a-zA-Z0-9_.-]+)?)(['"])`);
3345433454
this.currentVersion = this.manifestParser.getVersion(this.filePath, 'regex', {
3345533455
regex,
3345633456
});
@@ -33468,16 +33468,15 @@ class CustomUpdater {
3346833468
throw new Error(`Could not find current version for variable '${this.variableName}' in file '${this.filePath}'`);
3346933469
}
3347033470
const newVersion = (0, utils_1.calculateNextVersion)(oldVersion, releaseType);
33471-
const lastPath = this.filePath.split('/').pop() || '';
33472-
const extension = lastPath.split('.').pop() || '';
33471+
const extension = this.filePath.split('.').pop() || '';
3347333472
if (extension === 'json') {
3347433473
this.manifestParser.updateVersion(this.filePath, newVersion, 'json', {
3347533474
jsonPath: [this.variableName],
3347633475
});
3347733476
}
3347833477
else {
3347933478
// eslint-disable-next-line no-useless-escape
33480-
const regexReplace = new RegExp(`(${this.variableName}\\s*(=|=>|:)\\s*['"])([0-9]+\\.[0-9]+\\.[0-9]+(?:-[a-zA-Z0-9_.-]+)?(?:\\+[a-zA-Z0-9_.-]+)?)(['"])`);
33479+
const regexReplace = new RegExp(`(${this.variableName}\\s*(?:=|=>|:)\\s*['"])([0-9]+\\.[0-9]+\\.[0-9]+(?:-[a-zA-Z0-9_.-]+)?(?:\\+[a-zA-Z0-9_.-]+)?)(['"])`);
3348133480
this.manifestParser.updateVersion(this.filePath, newVersion, 'regex', {
3348233481
regexReplace,
3348333482
});
@@ -34139,8 +34138,6 @@ class ManifestParser {
3413934138
catch (e) {
3414034139
throw new errors_1.InvalidManifestError(`Invalid JSON in ${manifestPath}: ${e instanceof Error ? e.message : String(e)}`);
3414134140
}
34142-
console.log('data:', data);
34143-
console.log('options.jsonPath:', options.jsonPath);
3414434141
let version = data;
3414534142
if (options.jsonPath) {
3414634143
for (const key of options.jsonPath) {

dist/index.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "universal-version-bump",
33
"displayName": "Universal Version Bump",
4-
"version": "0.13.2",
4+
"version": "0.13.3",
55
"description": "A GitHub Action to automatically bump versions across any app (Node, Python, PHP, Docker, etc.)",
66
"main": "dist/index.js",
77
"scripts": {
@@ -53,4 +53,4 @@
5353
"vitest": "^3.2.4",
5454
"yaml": "^2.8.1"
5555
}
56-
}
56+
}

0 commit comments

Comments
 (0)