Skip to content

Commit

Permalink
fix: fix type error. (#185)
Browse files Browse the repository at this point in the history
  • Loading branch information
jaywcjlove committed Oct 24, 2022
1 parent 74a6e7a commit 60ba57c
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 7 deletions.
3 changes: 1 addition & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,6 @@
"@types/cheerio": "~0.22.31",
"@types/ejs": "~3.1.0",
"@types/fs-extra": "~9.0.13",
"@types/svgo": "~2.6.1",
"@types/svg2ttf": "~5.0.1",
"@types/svgicons2svgfont": "~10.0.1",
"@types/ttf2eot": "~2.0.0",
Expand All @@ -88,6 +87,6 @@
"yargs": "~17.6.0"
},
"devDependencies": {
"tsbb": "~3.7.2"
"tsbb": "^3.7.8"
}
}
6 changes: 3 additions & 3 deletions src/generate.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import fs from 'fs-extra';
import path from 'path';
import { optimize, OptimizedSvg } from 'svgo';
import { optimize } from 'svgo';
import { filterSvgFiles, toPascalCase } from './utils';
import { SvgToFontOptions } from './';

Expand Down Expand Up @@ -35,7 +35,7 @@ async function buildPathsObject(files: string[], options: SvgToFontOptions = {})
...(svgoOptions.plugins || [])
// 'convertShapeToPath'
],
}) as OptimizedSvg;
});
const str: string[] = (pathStrings.data.match(/ d="[^"]+"/g) || []).map(s => s.slice(3));
return `\n"${name}": [${str.join(',\n')}]`;
}),
Expand Down Expand Up @@ -87,7 +87,7 @@ async function outputReactFile(files: string[], options: SvgToFontOptions = {})
// 'removeViewBox'
...(svgoOptions.plugins || [])
]
}) as OptimizedSvg;
});
const str: string[] = (pathData.data.match(/ d="[^"]+"/g) || []).map(s => s.slice(3));
const outDistPath = path.join(options.dist, 'react', `${name}.js`);
const pathStrings = str.map((d, i) => `<path d=${d} fillRule="evenodd" />`);
Expand Down
4 changes: 2 additions & 2 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import fs from 'fs-extra';
import image2uri from 'image2uri';
import { SvgIcons2FontOptions } from 'svgicons2svgfont';
import color from 'colors-cli';
import { OptimizeOptions } from 'svgo';
import { Config } from 'svgo';
import { generateIconsSource, generateReactIcons } from './generate';
import { createSVG, createTTF, createEOT, createWOFF, createWOFF2, createSvgSymbol, copyTemplate, CSSOptions, createHTML, createTypescript, TypescriptOptions } from './utils';

Expand Down Expand Up @@ -58,7 +58,7 @@ export type SvgToFontOptions = {
*/
svgicons2svgfont?: SvgIcons2FontOptions;
/** Some options can be configured with svgoOptions though it. [svgo](https://github.com/svg/svgo#configuration) */
svgoOptions?: OptimizeOptions;
svgoOptions?: Config;
/**
* Create font class name prefix, default value font name.
* @default fontName
Expand Down

0 comments on commit 60ba57c

Please sign in to comment.