@@ -55,7 +55,8 @@ function walkAsync(directory, excludedDirectories, fileCallback, errback) {
5555 } )
5656}
5757
58- function replaceRecursively ( directory , excludedDirectories , allowedExtensions , original , replacement ) {
58+ // eslint-disable-next-line max-params
59+ function replaceRecursively ( directory , excludedDirectories , excludedFiles , allowedExtensions , original , replacement ) {
5960 original = new RegExp ( regExpQuote ( original ) , 'g' )
6061 replacement = regExpQuoteReplacement ( replacement )
6162 const updateFile = DRY_RUN ?
@@ -67,7 +68,7 @@ function replaceRecursively(directory, excludedDirectories, allowedExtensions, o
6768 }
6869 } :
6970 filepath => {
70- if ( allowedExtensions . has ( path . parse ( filepath ) . ext ) ) {
71+ if ( allowedExtensions . has ( path . parse ( filepath ) . ext ) && ! excludedFiles . has ( path . parse ( filepath ) . base ) ) {
7172 sh . sed ( '-i' , original , replacement , filepath )
7273 }
7374 }
@@ -94,6 +95,9 @@ function main(args) {
9495 'node_modules' ,
9596 'resources'
9697 ] )
98+ const EXCLUDED_FILES = new Set ( [
99+ 'CHANGELOG.md'
100+ ] )
97101 const INCLUDED_EXTENSIONS = new Set ( [
98102 // This extension allowlist is how we avoid modifying binary files
99103 '' ,
@@ -106,7 +110,7 @@ function main(args) {
106110 '.txt' ,
107111 '.yml'
108112 ] )
109- replaceRecursively ( '.' , EXCLUDED_DIRS , INCLUDED_EXTENSIONS , oldVersion , newVersion )
113+ replaceRecursively ( '.' , EXCLUDED_DIRS , EXCLUDED_FILES , INCLUDED_EXTENSIONS , oldVersion , newVersion )
110114}
111115
112116main ( process . argv . slice ( 2 ) )
0 commit comments