1+ /* eslint-disable local-rules/enforce-umbraco-external-imports */
12import { readFileSync , writeFile , mkdir , rmSync } from 'fs' ;
2- import * as globModule from 'tiny-glob' ;
33import * as pathModule from 'path' ;
4+ import * as globModule from 'tiny-glob' ;
45import { optimize } from 'svgo' ;
56
67const path = pathModule . default ;
@@ -23,7 +24,7 @@ const run = async () => {
2324 // Empty output directory:
2425 rmSync ( iconsOutputDirectory , { recursive : true } ) ;
2526
26- var icons = await collectDictionaryIcons ( ) ;
27+ let icons = await collectDictionaryIcons ( ) ;
2728 icons = await collectDiskIcons ( icons ) ;
2829 writeIconsToDisk ( icons ) ;
2930 generateJS ( icons ) ;
@@ -59,7 +60,7 @@ const collectDictionaryIcons = async () => {
5960 } ;
6061
6162 icons . push ( icon ) ;
62- } catch ( e ) {
63+ } catch {
6364 errors . push ( `[Lucide] Could not load file: '${ path } '` ) ;
6465 console . log ( `[Lucide] Could not load file: '${ path } '` ) ;
6566 }
@@ -91,7 +92,7 @@ const collectDictionaryIcons = async () => {
9192 } ;
9293
9394 icons . push ( icon ) ;
94- } catch ( e ) {
95+ } catch {
9596 errors . push ( `[SimpleIcons] Could not load file: '${ path } '` ) ;
9697 console . log ( `[SimpleIcons] Could not load file: '${ path } '` ) ;
9798 }
@@ -117,7 +118,7 @@ const collectDictionaryIcons = async () => {
117118 } ;
118119
119120 icons . push ( icon ) ;
120- } catch ( e ) {
121+ } catch {
121122 errors . push ( `[Umbraco] Could not load file: '${ path } '` ) ;
122123 console . log ( `[Umbraco] Could not load file: '${ path } '` ) ;
123124 }
@@ -171,11 +172,9 @@ const writeIconsToDisk = (icons) => {
171172
172173 writeFileWithDir ( icon . output , content , ( err ) => {
173174 if ( err ) {
174- // eslint-disable-next-line no-undef
175175 console . log ( err ) ;
176176 }
177177
178- // eslint-disable-next-line no-undef
179178 //console.log(`icon: ${icon.name} generated`);
180179 } ) ;
181180 } ) ;
@@ -192,18 +191,18 @@ const generateJS = (icons) => {
192191 ${ icon . legacy ? 'legacy: true,' : '' }
193192 ${ icon . hidden || icon . legacy ? 'hidden: true,' : '' }
194193 path: () => import("./icons/${ icon . fileName } .js"),
195- }` . replace ( / \t / g, '' ) . replace ( / ^ \s * [ \r \n ] / gm, '' ) ; // Regex removes white space [NL] // + regex that removes empty lines. [NL]
194+ }`
195+ . replace ( / \t / g, '' ) // Regex removes white space [NL]
196+ . replace ( / ^ \s * [ \r \n ] / gm, '' ) ; // Regex that removes empty lines. [NL]
196197 } ) ;
197198
198199 const content = `export default [${ iconDescriptors . join ( ',' ) } ];` ;
199200
200201 writeFileWithDir ( JSPath , content , ( err ) => {
201202 if ( err ) {
202- // eslint-disable-next-line no-undef
203203 console . log ( err ) ;
204204 }
205205
206- // eslint-disable-next-line no-undef
207206 console . log ( 'Icons outputted and Icon Manifests generated!' ) ;
208207 } ) ;
209208} ;
0 commit comments