Skip to content

Commit

Permalink
fix: svgo types
Browse files Browse the repository at this point in the history
  • Loading branch information
ubermanu committed Aug 18, 2023
1 parent ea1c004 commit 8561272
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 14 deletions.
1 change: 0 additions & 1 deletion plugins/svgo/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
"prepublishOnly": "pnpm run build"
},
"dependencies": {
"@types/svgo": "^3.0.0",
"fast-glob": "^3.2.11",
"svgo": "^3.0.2"
},
Expand Down
6 changes: 3 additions & 3 deletions plugins/svgo/src/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@ import glob, { type Pattern } from 'fast-glob'
import type { Plugin } from 'magefront'
import fs from 'node:fs/promises'
import path from 'node:path'
import svgo, { type OptimizeOptions } from 'svgo'
import svgo, { type Config } from 'svgo'

export interface Options {
src?: string | string[]
ignore?: Pattern[]
optimizeOptions?: OptimizeOptions
optimizeOptions?: Config
}

/** Optimize SVG files. */
Expand All @@ -24,7 +24,7 @@ export default (options?: Options): Plugin => {
files.map(async (file) => {
const filePath = path.join(context.src, file)
const fileContent = await fs.readFile(filePath)
const result = await svgo.optimize(fileContent.toString(), optimizeOptions)
const result = svgo.optimize(fileContent.toString(), optimizeOptions)

if ('data' in result) {
await fs.writeFile(filePath, result.data)
Expand Down
10 changes: 0 additions & 10 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 8561272

Please sign in to comment.