File tree Expand file tree Collapse file tree 2 files changed +14
-1
lines changed Expand file tree Collapse file tree 2 files changed +14
-1
lines changed Original file line number Diff line number Diff line change @@ -38,7 +38,20 @@ function genNpmPluginXML() {
38
38
39
39
fs . writeFileSync ( 'plugin.xml' , xml ) ;
40
40
} ;
41
+ // first match only!
42
+ var PLUGIN_XML_VERSION_REGEX = / ^ \s * v e r s i o n = \" [ \d \. ] * \" \> $ / m;
43
+ gulp . task ( 'update-plugin-xml-version' , ( ) => {
44
+ var versionNumber = require ( './package.json' ) . version ;
45
+ // this will break if plugin.xml is not formatted exactly as we expect
46
+ // so you might end up needing to fix the regex
47
+ for ( target of [ '.xml' , '.template.xml' ] ) {
48
+ var pluginXML = fs . readFileSync ( 'plugin' + target , 'utf8' ) ;
49
+ var newVersionXML = ` version="${ versionNumber } ">` ;
50
+ pluginXML = pluginXML . replace ( PLUGIN_XML_VERSION_REGEX , newVersionXML ) ;
51
+ fs . writeFileSync ( 'plugin' + target , pluginXML ) ;
52
+ }
41
53
54
+ } ) ;
42
55
// generate plugin.xml for local development
43
56
// here we reference the frameworks instead of all the files directly
44
57
function getDevPluginXML ( ) {
Original file line number Diff line number Diff line change 32
32
"license" : " MIT" ,
33
33
"scripts" : {
34
34
"prerelease" : " gulp prerelease" ,
35
- "semantic-release" : " semantic-release pre && npm publish && semantic-release post" ,
35
+ "semantic-release" : " semantic-release pre && gulp update-plugin-xml-version && npm publish && semantic-release post" ,
36
36
"commit" : " git-cz"
37
37
},
38
38
"dependencies" : {
You can’t perform that action at this time.
0 commit comments