-
-
Notifications
You must be signed in to change notification settings - Fork 420
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
Updated to SVGO 2 #565
Updated to SVGO 2 #565
Conversation
This pull request is being automatically deployed with Vercel (learn more). 🔍 Inspect: https://vercel.com/gregberge/svgr/HfGgtHN1Js67wpd4YUpVLs9oeMpX |
Codecov Report
@@ Coverage Diff @@
## main #565 +/- ##
==========================================
+ Coverage 87.19% 89.09% +1.90%
==========================================
Files 31 31
Lines 570 541 -29
Branches 160 151 -9
==========================================
- Hits 497 482 -15
+ Misses 58 48 -10
+ Partials 15 11 -4
Continue to review full report at Codecov.
|
return array | ||
}, []) | ||
return configs | ||
.flatMap(extractPlugins) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Node 10 doesn't seem to support flatMap
Consider changing this to:
.reduce((configsArr,config)=>configsArr.concat(extractPlugins(config)),[])
Refference: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/flatMap
Else, you would need to remove compatibility to Node 10.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Else, you would need to remove compatibility to Node 10.
So while the 2.0 release in Feb 2021 mentions needing
10.13.x
or newer, in this case to resolve this issue (as it appears to be NodeJS related not specificallysvgo
, you need NodeJS11.x.x
or newer
Otherwise users may risk breakage as the linked issue describes and my investigation revealed was due to issues with NodeJS 10.
@@ -28,6 +28,6 @@ | |||
"dependencies": { | |||
"cosmiconfig": "^7.0.0", | |||
"deepmerge": "^4.2.2", | |||
"svgo": "^1.2.2" | |||
"svgo": "^2.3.0" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you update this to ^2.3.1
so that it incorporates the css-select vulnerability fix?
You will need to update travis ci config to remove Node 10, also i would suggest to update everywhere engines in package.json. Anyway this will cause major version, so it makes sense to incorporate as much changes as possible. |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
This should still be merged |
Yep, I think that I'll find time on current week to deal with comments |
@@ -13,7 +13,7 @@ export const DEFAULT_CONFIG = { | |||
replaceAttrValues: null, | |||
svgProps: null, | |||
svgo: true, | |||
svgoConfig: null, | |||
svgoConfig: { plugins: [{ name: 'convertStyleToAttrs', active: true }]}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This plugin is error prone and was disabled because of it. I don't recommend to enable it.
@@ -1,3 +1,4 @@ | |||
import { extendDefaultPlugins } from 'svgo'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The latest svgo version provides preset-default plugin. extendDefaultPlugins is deprecated and will trigger warning.
Fixed in #591 |
Summary
css-what
#564 case)Test plan
yarn test
) after modifications and make changes according to changes in API of SVGO in cases where it was needed. Snapshots from tests stay almost untouched except of optimization of "Move to" operator ind
attribute ofpath
(d="M10 10 10 10"
instead ofd="M10 10L10 10"
)