@@ -55,7 +55,8 @@ function walkAsync(directory, excludedDirectories, fileCallback, errback) {
55
55
} )
56
56
}
57
57
58
- function replaceRecursively ( directory , excludedDirectories , allowedExtensions , original , replacement ) {
58
+ // eslint-disable-next-line max-params
59
+ function replaceRecursively ( directory , excludedDirectories , excludedFiles , allowedExtensions , original , replacement ) {
59
60
original = new RegExp ( regExpQuote ( original ) , 'g' )
60
61
replacement = regExpQuoteReplacement ( replacement )
61
62
const updateFile = DRY_RUN ?
@@ -67,7 +68,7 @@ function replaceRecursively(directory, excludedDirectories, allowedExtensions, o
67
68
}
68
69
} :
69
70
filepath => {
70
- if ( allowedExtensions . has ( path . parse ( filepath ) . ext ) ) {
71
+ if ( allowedExtensions . has ( path . parse ( filepath ) . ext ) && ! excludedFiles . has ( path . parse ( filepath ) . base ) ) {
71
72
sh . sed ( '-i' , original , replacement , filepath )
72
73
}
73
74
}
@@ -94,6 +95,9 @@ function main(args) {
94
95
'node_modules' ,
95
96
'resources'
96
97
] )
98
+ const EXCLUDED_FILES = new Set ( [
99
+ 'CHANGELOG.md'
100
+ ] )
97
101
const INCLUDED_EXTENSIONS = new Set ( [
98
102
// This extension allowlist is how we avoid modifying binary files
99
103
'' ,
@@ -106,7 +110,7 @@ function main(args) {
106
110
'.txt' ,
107
111
'.yml'
108
112
] )
109
- replaceRecursively ( '.' , EXCLUDED_DIRS , INCLUDED_EXTENSIONS , oldVersion , newVersion )
113
+ replaceRecursively ( '.' , EXCLUDED_DIRS , EXCLUDED_FILES , INCLUDED_EXTENSIONS , oldVersion , newVersion )
110
114
}
111
115
112
116
main ( process . argv . slice ( 2 ) )
0 commit comments