@j-ulrich/release-it-regex-bumper 4.0.0 → 4.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/README.md +1 -1
  2. package/index.js +8 -3
  3. package/package.json +6 -6
package/README.md CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  > Regular expression based version read/write plugin for release-it
4
4
 
5
- ![CI](https://github.com/j-ulrich/release-it-regex-bumper/workflows/CI/badge.svg)
5
+ [![CI](https://github.com/j-ulrich/release-it-regex-bumper/actions/workflows/CI.yml/badge.svg)](https://github.com/j-ulrich/release-it-regex-bumper/actions/workflows/CI.yml)
6
6
  [![Test Coverage](https://app.codacy.com/project/badge/Coverage/bf3c6e8740a9472b9acd7dac231adf4e)](https://www.codacy.com/gh/j-ulrich/release-it-regex-bumper/dashboard?utm_source=github.com&utm_medium=referral&utm_content=j-ulrich/release-it-regex-bumper&utm_campaign=Badge_Coverage)
7
7
  [![Code Quality](https://app.codacy.com/project/badge/Grade/bf3c6e8740a9472b9acd7dac231adf4e)](https://www.codacy.com/gh/j-ulrich/release-it-regex-bumper/dashboard?utm_source=github.com&utm_medium=referral&utm_content=j-ulrich/release-it-regex-bumper&utm_campaign=Badge_Grade)
8
8
 
package/index.js CHANGED
@@ -250,15 +250,20 @@ function extractVersion( content, versionRegex, versionCaptureGroup ) {
250
250
  throw new Error( 'Could not extract version from file' );
251
251
  }
252
252
  if ( !_.isNil( versionCaptureGroup ) ) {
253
- if ( hasOwnProperty( match, versionCaptureGroup ) ) {
253
+ if ( typeof versionCaptureGroup === 'number' && hasOwnProperty( match, versionCaptureGroup ) ) {
254
254
  // object injection mitigated by checking hasOwnProperty()
255
255
  // eslint-disable-next-line security/detect-object-injection
256
256
  return match[versionCaptureGroup];
257
257
  }
258
+ if ( match.groups && hasOwnProperty( match.groups, versionCaptureGroup ) ) {
259
+ // object injection mitigated by checking hasOwnProperty()
260
+ // eslint-disable-next-line security/detect-object-injection
261
+ return match.groups[versionCaptureGroup];
262
+ }
258
263
  }
259
264
  else {
260
- if ( hasOwnProperty( match, 'version' ) ) {
261
- return match['version'];
265
+ if ( match.groups && hasOwnProperty( match.groups, 'version' ) ) {
266
+ return match.groups.version;
262
267
  }
263
268
  if ( hasOwnProperty( match, 1 ) ) {
264
269
  return match[1];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@j-ulrich/release-it-regex-bumper",
3
- "version": "4.0.0",
3
+ "version": "4.1.0",
4
4
  "description": "Regular expression based version read/write plugin for release-it",
5
5
  "main": "index.js",
6
6
  "type": "module",
@@ -39,18 +39,18 @@
39
39
  "name": "Jochen Ulrich"
40
40
  },
41
41
  "dependencies": {
42
- "chalk": "^4.0.0",
42
+ "chalk": "^5.0.0",
43
43
  "date-fns": "^2.8.0",
44
44
  "fast-glob": "^3.2.0",
45
45
  "lodash": "^4.17.20",
46
46
  "semver": "^7.3.0",
47
- "xregexp": "^4.3.0"
47
+ "xregexp": "^5.0.0"
48
48
  },
49
49
  "peerDependencies": {
50
- "release-it": "15 - 16"
50
+ "release-it": "15"
51
51
  },
52
52
  "optionalDependencies": {
53
- "diff": "^3.0.0 || ^4.0.0"
53
+ "diff": "3 - 5"
54
54
  },
55
55
  "devDependencies": {
56
56
  "@j-ulrich/eslint-config": "^1.0.0",
@@ -60,7 +60,7 @@
60
60
  "eslint": "^8.6.0",
61
61
  "eslint-plugin-security": "^1.4.0",
62
62
  "release-it": "^15.0.0",
63
- "sinon": "^12.0.1",
63
+ "sinon": "^13.0.2",
64
64
  "temp": "^0.9.4",
65
65
  "testdouble": "^3.16.4"
66
66
  },