@@ -124,6 +124,27 @@ function updateVersionInTestFile(newVersion, testFile) {
124124 }
125125}
126126
127+ function bumpFeatureVersion ( jsonFile ) {
128+ try {
129+ const content = fs . readFileSync ( jsonFile , 'utf8' ) ;
130+ const data = JSON . parse ( content ) ;
131+
132+ // Parse current version and increment patch version
133+ const currentVersion = data . version ;
134+ const incrementedVersion = semver . inc ( currentVersion , 'patch' ) ;
135+
136+ data . version = incrementedVersion ;
137+ fs . writeFileSync ( jsonFile , JSON . stringify ( data , null , 4 ) + '\n' ) ;
138+
139+ return {
140+ oldVersion : currentVersion ,
141+ newVersion : incrementedVersion
142+ } ;
143+ } catch ( error ) {
144+ throw new Error ( `Could not bump feature version: ${ error . message } ` ) ;
145+ }
146+ }
147+
127148function main ( ) {
128149 // Check command line arguments
129150 const args = process . argv . slice ( 2 ) ;
@@ -197,6 +218,13 @@ function main() {
197218 log ( `Updating default version in ${ jsonFile } ...` ) ;
198219 updateDefaultInJson ( newVersion , jsonFile ) ;
199220 log ( `${ emoji . check } Updated default version to ${ newVersion } ` , 'green' ) ;
221+
222+ // Bump feature version when default changes
223+ log ( '' ) ;
224+ log ( `${ emoji . update } Bumping feature version...` , 'yellow' ) ;
225+ const versionInfo = bumpFeatureVersion ( jsonFile ) ;
226+ log ( `${ emoji . check } Feature version bumped from ${ versionInfo . oldVersion } to ${ versionInfo . newVersion } ` , 'green' ) ;
227+
200228 filesModified . push ( jsonFile ) ;
201229 } else {
202230 log ( '' ) ;
0 commit comments