File tree 1 file changed +3
-3
lines changed
1 file changed +3
-3
lines changed Original file line number Diff line number Diff line change @@ -30,16 +30,15 @@ export const convert = async (convertionOptions: ConvertionOptions): Promise<voi
30
30
31
31
try {
32
32
const files = await readdir ( directoryPath , { withFileTypes : true } ) ;
33
+ const typesDelimitor = ' | ' ;
33
34
for ( let i = 0 ; i < files . length ; i ++ ) {
34
35
if ( files [ i ] . isFile ( ) ) {
35
36
const fileNameWithEnding = files [ i ] . name ;
36
37
const filenameWithoutEnding = fileNameWithEnding . split ( '.' ) [ 0 ] ;
37
38
const rawSvg = await extractSvgContent ( fileNameWithEnding , directoryPath ) ;
38
39
const optimizedSvg = await svgo . optimize ( rawSvg ) ;
39
40
const variableName = getVariableName ( convertionOptions , filenameWithoutEnding ) ;
40
- i === files . length - 1
41
- ? ( types += `'${ snakeCase ( filenameWithoutEnding ) } ';` )
42
- : ( types += `'${ snakeCase ( filenameWithoutEnding ) } ' | ` ) ;
41
+ types += `'${ snakeCase ( filenameWithoutEnding ) } '${ typesDelimitor } ` ;
43
42
svgConstants += getSvgConstant (
44
43
variableName ,
45
44
convertionOptions . interfaceName ,
@@ -48,6 +47,7 @@ export const convert = async (convertionOptions: ConvertionOptions): Promise<voi
48
47
) ;
49
48
}
50
49
}
50
+ types = types . substring ( 0 , types . length - typesDelimitor . length ) + ';' ;
51
51
const fileContent = generateFileContent ( svgConstants , types , convertionOptions ) ;
52
52
await writeIconsFile ( convertionOptions , fileContent ) ;
53
53
console . log (
You can’t perform that action at this time.
0 commit comments