@@ -97,9 +97,9 @@ async function generateSpritesheetJs(library, data) {
9797 ) ;
9898 spritesheet = spritesheet
9999 /* eslint-disable-next-line sonarjs/slow-regex -- technical debt */
100- . replace ( / .* e s l i n t - d i s a b l e .* / g, "" )
101- . replace ( / P A C K A G E / g , JSON . stringify ( packageName ) )
102- . replace ( / L I B R A R Y / g , JSON . stringify ( library ) )
100+ . replaceAll ( / .* e s l i n t - d i s a b l e .* / g, "" )
101+ . replaceAll ( " PACKAGE" , JSON . stringify ( packageName ) )
102+ . replaceAll ( " LIBRARY" , JSON . stringify ( library ) )
103103 . replace (
104104 / I M P O R T _ S P R I T E S H E E T \( \) ; .* / ,
105105 `const spritesheet = '${ data . content } ';` ,
@@ -109,7 +109,7 @@ async function generateSpritesheetJs(library, data) {
109109 "utf8" ,
110110 ) ;
111111 /* eslint-disable-next-line sonarjs/slow-regex -- technical debt */
112- inject = inject . replace ( / .* e s l i n t - d i s a b l e .* / g, "" ) ;
112+ inject = inject . replaceAll ( / .* e s l i n t - d i s a b l e .* / g, "" ) ;
113113 const content = [ spritesheet , inject ] . join ( "\n" ) ;
114114 const indexJs = path . join ( dest , library , "index.js" ) ;
115115 const indexDts = path . join ( dest , library , "index.d.ts" ) ;
@@ -135,9 +135,9 @@ async function generateSpritesheetJsNoInject(library, data) {
135135 ) ;
136136 spritesheet = spritesheet
137137 /* eslint-disable-next-line sonarjs/slow-regex -- technical debt */
138- . replace ( / .* e s l i n t - d i s a b l e .* / g, "" )
139- . replace ( / P A C K A G E / g , JSON . stringify ( packageName ) )
140- . replace ( / L I B R A R Y / g , JSON . stringify ( library ) )
138+ . replaceAll ( / .* e s l i n t - d i s a b l e .* / g, "" )
139+ . replaceAll ( " PACKAGE" , JSON . stringify ( packageName ) )
140+ . replaceAll ( " LIBRARY" , JSON . stringify ( library ) )
141141 . replace (
142142 / I M P O R T _ S P R I T E S H E E T \( \) ; .* / ,
143143 `const spritesheet = '${ data . content } ';` ,
@@ -159,7 +159,7 @@ async function getSpriteSheetdata(directory, files) {
159159 ".svg" ,
160160 ) } `;
161161 const name = path . basename ( file , ".svg" ) ;
162- const prettyName = capitalize ( name . replace ( / - / g , " " ) ) ;
162+ const prettyName = capitalize ( name . replaceAll ( "-" , " " ) ) ;
163163 const svgFile = await fs . readFile ( path . join ( directory , file ) , "utf8" ) ;
164164 const optimizedSvg = optimize ( svgFile , {
165165 plugins : [
@@ -179,9 +179,9 @@ async function getSpriteSheetdata(directory, files) {
179179 } ) ;
180180
181181 const symbol = optimizedSvg . data
182- . replace ( / < s v g / g , `<symbol id="${ id } "` )
183- . replace ( / < \ /s v g > / g , "</symbol>" )
184- . replace ( / x m l n s = " [ ^ " ] * " / g, "" ) ;
182+ . replaceAll ( " <svg" , `<symbol id="${ id } "` )
183+ . replaceAll ( "< /svg>" , "</symbol>" )
184+ . replaceAll ( / x m l n s = " [ ^ " ] * " / g, "" ) ;
185185
186186 content += symbol ;
187187 icons . push ( {
0 commit comments