Skip to content

Commit

Permalink
chore(deps): update dependency svgo to v2 (#594)
Browse files Browse the repository at this point in the history
* chore(deps): update dependency svgo to v2

* fix svgo

* chore(deps): update dependency svgo to v2

* fix optimize

Co-authored-by: Renovate Bot <bot@renovateapp.com>
Co-authored-by: Jérémie Bertrand <jeremie.bertrand@outlook.fr>
  • Loading branch information
3 people committed Aug 1, 2021
1 parent 751d348 commit 53ca0c9
Show file tree
Hide file tree
Showing 4 changed files with 58 additions and 154 deletions.
2 changes: 1 addition & 1 deletion package.json
Expand Up @@ -50,7 +50,7 @@
"eslint-config-cozy-app": "2.1.0",
"git-directory-deploy": "1.5.1",
"husky": "7.0.1",
"svgo": "1.3.2",
"svgo": "2.3.1",
"ts-loader": "8.3.0",
"typescript": "4.3.5",
"webpack": "5.47.1",
Expand Down
10 changes: 10 additions & 0 deletions svgo.config.js
@@ -0,0 +1,10 @@
module.exports = {
plugins: [
{
name: 'inlineStyles',
params: {
onlyMatchedOnce: false
}
}
]
}
12 changes: 2 additions & 10 deletions webpack.config.js
Expand Up @@ -2,21 +2,13 @@ var path = require('path')
const CopyPlugin = require('copy-webpack-plugin')
const webpack = require('webpack')
const fs = require('fs')
const SvgoInstance = require('svgo')
const { optimize } = require('svgo');

const entry = require('./package.json').main

const readManifest = () =>
JSON.parse(fs.readFileSync(path.join(__dirname, './manifest.konnector')))

const svgo = new SvgoInstance({
plugins: [
{
inlineStyles: { onlyMatchedOnce: false }
}
]
})

let iconName
try {
iconName = JSON.parse(fs.readFileSync('manifest.konnector', 'utf8')).icon
Expand Down Expand Up @@ -61,7 +53,7 @@ module.exports = {

function optimizeSVGIcon(buffer, path) {
if (appIconRX && path.match(appIconRX)) {
return svgo.optimize(buffer).then(resp => resp.data)
return optimize(buffer).data
} else {
return buffer
}
Expand Down

0 comments on commit 53ca0c9

Please sign in to comment.