@@ -59,29 +59,12 @@ function writeVersionJson(versionJson: { version: string; [key: string]: unknown
5959 fs . writeFileSync ( versionFilePath , newJson ) ;
6060}
6161
62- gulp . task ( 'incrementVersion' , async ( ) : Promise < void > => {
63- const argv = minimist ( process . argv . slice ( 2 ) ) ;
64- const isReleaseCandidate = argv [ 'releaseCandidate' ] === true || argv [ 'releaseCandidate' ] === 'true' ;
65-
66- // Get the current version from version.json
67- const versionJson = readVersionJson ( ) ;
68-
69- // Calculate new version
70- let version = versionJson . version as string ;
71- if ( isReleaseCandidate ) {
72- version = getNextReleaseVersion ( version ) ;
73- console . log ( `Release candidate, using base version of ${ version } ` ) ;
74- }
75-
76- const split = version . split ( '.' ) ;
77- const newVersion = `${ split [ 0 ] } .${ parseInt ( split [ 1 ] ) + 1 } ` ;
78- console . log ( `Updating ${ versionJson . version } to ${ newVersion } ` ) ;
79-
80- // Write the new version back to version.json
81- versionJson . version = newVersion ;
82- writeVersionJson ( versionJson ) ;
83-
84- // Add a new changelog section for the new version.
62+ /**
63+ * Add a new version section to the changelog
64+ * @param version The version to add (e.g., "2.75")
65+ * @param additionalLines Optional additional lines to add after the version header
66+ */
67+ function addChangelogSection ( version : string , additionalLines ?: string [ ] ) : void {
8568 console . log ( 'Adding new version header to changelog' ) ;
8669
8770 const changelogPath = path . join ( path . resolve ( __dirname , '..' ) , 'CHANGELOG.md' ) ;
@@ -112,10 +95,41 @@ gulp.task('incrementVersion', async (): Promise<void> => {
11295 // Insert a new header for the new version after the known issues header but before the next header.
11396 const lineToInsertAt = matches [ knownIssuesIndex + 1 ] . line - 1 ;
11497 console . log ( `Inserting new version header at line ${ lineToInsertAt } ` ) ;
115- const linesToInsert = [ '' , `# ${ newVersion } .x` ] ;
98+ const linesToInsert = [ '' , `# ${ version } .x` ] ;
99+
100+ // Add any additional lines if provided
101+ if ( additionalLines && additionalLines . length > 0 ) {
102+ linesToInsert . push ( ...additionalLines ) ;
103+ }
116104
117105 changelogLines . splice ( lineToInsertAt , 0 , ...linesToInsert ) ;
118106 fs . writeFileSync ( changelogPath , changelogLines . join ( os . EOL ) ) ;
107+ }
108+
109+ gulp . task ( 'incrementVersion' , async ( ) : Promise < void > => {
110+ const argv = minimist ( process . argv . slice ( 2 ) ) ;
111+ const isReleaseCandidate = argv [ 'releaseCandidate' ] === true || argv [ 'releaseCandidate' ] === 'true' ;
112+
113+ // Get the current version from version.json
114+ const versionJson = readVersionJson ( ) ;
115+
116+ // Calculate new version
117+ let version = versionJson . version as string ;
118+ if ( isReleaseCandidate ) {
119+ version = getNextReleaseVersion ( version ) ;
120+ console . log ( `Release candidate, using base version of ${ version } ` ) ;
121+ }
122+
123+ const split = version . split ( '.' ) ;
124+ const newVersion = `${ split [ 0 ] } .${ parseInt ( split [ 1 ] ) + 1 } ` ;
125+ console . log ( `Updating ${ versionJson . version } to ${ newVersion } ` ) ;
126+
127+ // Write the new version back to version.json
128+ versionJson . version = newVersion ;
129+ writeVersionJson ( versionJson ) ;
130+
131+ // Add a new changelog section for the new version.
132+ addChangelogSection ( newVersion ) ;
119133} ) ;
120134
121135gulp . task ( 'updateChangelog' , async ( ) : Promise < void > => {
@@ -245,4 +259,7 @@ gulp.task('updateVersionForStableRelease', async (): Promise<void> => {
245259 // Write the new version back to version.json
246260 versionJson . version = releaseVersion ;
247261 writeVersionJson ( versionJson ) ;
262+
263+ // Add a new changelog section for the release version that references the prerelease
264+ addChangelogSection ( releaseVersion , [ `* See ${ currentVersion } .x for full list of changes.` ] ) ;
248265} ) ;
0 commit comments