diff --git a/package.json b/package.json index e0965ecb..e9f20b06 100644 --- a/package.json +++ b/package.json @@ -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", @@ -88,6 +87,6 @@ "yargs": "~17.6.0" }, "devDependencies": { - "tsbb": "~3.7.2" + "tsbb": "^3.7.8" } } diff --git a/src/generate.ts b/src/generate.ts index a32faabe..6d0c35b8 100644 --- a/src/generate.ts +++ b/src/generate.ts @@ -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 './'; @@ -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')}]`; }), @@ -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) => ``); diff --git a/src/index.ts b/src/index.ts index 97661b39..5c386923 100644 --- a/src/index.ts +++ b/src/index.ts @@ -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'; @@ -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