Page MenuHomePhabricator

Update SVGO to v4.x in various extensions & skins
Open, Needs TriagePublic

Description

Goal

Many Wikimedia extensions currently use 'svgo' package in v3.3.2 or v3.2.0 (CodeSearch) as result of formerly successful T339162.
With the new 4.x release there have been minimal changes and numerous bug fixes – as for example disabling both, removeViewBox and removeTitle plugins by default, which was counter-productive for our environment and has been set to disabled in each of the configs. Other changes like removeScriptElementremoveScripts plugin don't apply with the repos listed.

Acceptance criteria

Note that extensions Sanctions and AchievementBadges used by femiwiki also feature the package in v3.x.

Event Timeline

Restricted Application added a subscriber: Lens0021. · View Herald Transcript

Change #1170143 had a related patch set uploaded (by Jforrester; author: Jforrester):

[mediawiki/extensions/VisualEditor@master] build: Use SVGO v4, move out of Grunt to be similar to other repos

https://gerrit.wikimedia.org/r/1170143

Change #1170143 merged by jenkins-bot:

[mediawiki/extensions/VisualEditor@master] build: Use SVGO v4, move out of Grunt to be similar to other repos

https://gerrit.wikimedia.org/r/1170143

So, the general recommended safe approach is to

  1. update to svgo v4
  2. copy over the new config from https://www.mediawiki.org/w/index.php?title=Manual%3ACoding_conventions%2FSVG#Exemplified_safe_configuration_(.svgo.config.js),
  3. run the minify script
  4. commit everything
  5. done

right?

I tried that and noticed that there were a couple issues with the config on mw.org:

  • missing commas
  • typo (fasle)
  • duplicate disabled rule cleanupNumericValues: false
  • a disabled rule that is instead apparently actually a plugin that we should just not use? removeOffCanvasPaths (source)
  • wrong quotes
  • missing semicolon

I've updated that example accordingly: https://www.mediawiki.org/w/index.php?diff=7762345 Please have a look to make sure I did not make any mistakes.

Change #1171556 had a related patch set uploaded (by Michael Große; author: Michael Große):

[mediawiki/extensions/GrowthExperiments@master] chore: Update svgo and minify svg files

https://gerrit.wikimedia.org/r/1171556

Change #1171556 merged by jenkins-bot:

[mediawiki/extensions/GrowthExperiments@master] chore: Update svgo and minify svg files

https://gerrit.wikimedia.org/r/1171556

Thanks @Michael for going over the configuration. There are a number of flags/options set in the recent past, that are not important for the client sent SVGs for most of Wikimedia Foundation deployed repositories like in our icons (removeEditorsNSData as most bloating example).
We might end up with two configurations on the SVG coding conventions page, but as is, I would not recommend the config from there over the options in the established .svgo.config.js files in most of our repos.
I might have time end of week to care about the coding guidelines mw.org website, not earlier though.

Any update here? I think, I'd like to also get this our of the way for the Thanks extension and then remove it from our board.