@@ -7,6 +7,8 @@ module.exports = {
7
7
8
8
const regexVersionVariable = new RegExp ( dependency . group + ":" + dependency . name + ":\\${?(\\w+)}?" , "ig" )
9
9
10
+ // 'de.kevcodez:pubg-api-wrapper:$myVar'
11
+ // 'de.kevcodez:pubg-api-wrapper:${myVar}'
10
12
const versionWithVariableMatches = regexVersionVariable . exec ( modifiedBody )
11
13
if ( versionWithVariableMatches && versionWithVariableMatches . length === 2 ) {
12
14
const variableName = versionWithVariableMatches [ 1 ]
@@ -19,18 +21,29 @@ module.exports = {
19
21
} )
20
22
}
21
23
24
+ // compile 'de.kevcodez:pubg-api-wrapper:1.0.0'
22
25
const regexVersionInline = new RegExp ( `${ dependency . group } :${ dependency . name } :${ dependency . oldVersion } ` , "g" )
23
26
if ( regexVersionInline . exec ( modifiedBody ) ) {
24
27
modifiedBody = modifiedBody . replace ( regexVersionInline , `${ dependency . group } :${ dependency . name } :${ dependency . version } ` )
25
28
}
26
29
27
- const regexVersionWithPrefix = new RegExp ( `${ dependency . group } ("|')(\\s+)?version(\\s+)?("|')${ oldVersion } ("|')` )
28
- const regexVersionWithPrefixMatches = regexVersionWithPrefix . exec ( modifiedBody )
30
+ // id 'com.github.ben-manes.versions' version "0.21.0"
31
+ const regexPluginVersionWithPrefix = new RegExp ( `${ dependency . group } ("|')(\\s+)?version(\\s+)?("|')${ oldVersion } ("|')` )
32
+ const regexVersionWithPrefixMatches = regexPluginVersionWithPrefix . exec ( modifiedBody )
29
33
if ( regexVersionWithPrefixMatches ) {
30
34
regexVersionWithPrefixMatches . filter ( it => it . includes ( oldVersion ) ) . forEach ( match => {
31
35
modifiedBody = modifiedBody . replace ( match , match . replace ( oldVersion , newVersion ) )
32
36
} )
33
37
}
38
+
39
+ // compile group: 'de.kevcodez.pubg', name: 'pubg-api-wrapper', version: '0.8.1'
40
+ const regexDependencyWithVersionPrefix = new RegExp ( `${ dependency . name } ('|"),(\\s+)?version:(\\s+)('|")${ dependency . oldVersion } ('|")` )
41
+ const regexDependencyWithVersionPrefixMatches = regexDependencyWithVersionPrefix . exec ( modifiedBody )
42
+ if ( regexDependencyWithVersionPrefixMatches ) {
43
+ regexDependencyWithVersionPrefixMatches . filter ( it => it . includes ( oldVersion ) ) . forEach ( match => {
44
+ modifiedBody = modifiedBody . replace ( match , match . replace ( oldVersion , newVersion ) )
45
+ } )
46
+ }
34
47
35
48
return modifiedBody
36
49
}
0 commit comments