Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(deps): update dependency svgo to v2 #594

Merged
merged 5 commits into from Aug 1, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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