@@ -113,6 +113,11 @@ class ReleasePreparation {
113113 await this . updateREPLACEMEs ( ) ;
114114 cli . stopSpinner ( 'Updated REPLACEME items in docs' ) ;
115115
116+ // Update any new deprecations in the codebase.
117+ cli . startSpinner ( 'Updating DEPOXXX items in codebase' ) ;
118+ const depCount = await this . updateDeprecations ( ) ;
119+ cli . stopSpinner ( `Updated ${ depCount } DEPOXXX items in codebase` ) ;
120+
116121 // Fetch date to use in release commit & changelogs.
117122 const todayDate = new Date ( ) . toISOString ( ) . split ( 'T' ) [ 0 ] ;
118123 this . date = await cli . prompt ( 'Enter release date in YYYY-MM-DD format:' ,
@@ -225,6 +230,41 @@ class ReleasePreparation {
225230 ] ) . trim ( ) ;
226231 }
227232
233+ async updateDeprecations ( ) {
234+ const deprecationPattern = / < \s * a i d = " D E P 0 ( [ 0 - 9 ] { 3 } ) + " [ ^ > ] * > < \s * \/ \s * a > / g;
235+ const newDeprecationPattern = / < \s * a i d = " D E P 0 ( [ X ] + [ 0 - 9 ] * ) + " [ ^ > ] * > < \s * \/ \s * a > / g;
236+
237+ const deprecationFilePath = path . resolve ( 'doc' , 'api' , 'deprecations.md' ) ;
238+ const deprecationFile = await fs . readFile ( deprecationFilePath , 'utf8' ) ;
239+
240+ const deprecationNumbers = [ ...deprecationFile . matchAll ( deprecationPattern ) ]
241+ . map ( m => m [ 1 ] ) . reverse ( ) ;
242+ const newDeprecationNumbers = [ ...deprecationFile . matchAll ( newDeprecationPattern ) ]
243+ . map ( m => m [ 1 ] ) ;
244+
245+ // Pull the highest deprecation number off the list and increment from there.
246+ let depNumber = parseInt ( deprecationNumbers [ 0 ] ) + 1 ;
247+
248+ // Loop through each new unmarked deprecation number and replace instances.
249+ for ( const newDep of newDeprecationNumbers ) {
250+ await replace ( {
251+ files : [
252+ 'doc/api/*.md' ,
253+ 'lib/**/*.js' ,
254+ 'src/**/*.{h,cc}' ,
255+ 'test/**/*.js'
256+ ] ,
257+ ignore : 'test/common/README.md' ,
258+ from : new RegExp ( `DEP0${ newDep } ` , 'g' ) ,
259+ to : `DEP0${ depNumber } `
260+ } ) ;
261+
262+ depNumber ++ ;
263+ }
264+
265+ return newDeprecationNumbers . length ;
266+ }
267+
228268 async updateREPLACEMEs ( ) {
229269 const { newVersion } = this ;
230270
0 commit comments