From c87a215d0e2538db49ae8ff4a31049e57f2d55a3 Mon Sep 17 00:00:00 2001
From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com>
Date: Wed, 22 Jun 2022 22:12:17 +0000
Subject: [PATCH] chore(deps): bump simple-icons from 6.23.0 to 7.0.0 (#8039)

* chore(deps): bump simple-icons from 6.23.0 to 7.0.0

Bumps [simple-icons](https://github.com/simple-icons/simple-icons) from 6.23.0 to 7.0.0.
- [Release notes](https://github.com/simple-icons/simple-icons/releases)
- [Commits](https://github.com/simple-icons/simple-icons/compare/6.23.0...7.0.0)

---
updated-dependencies:
- dependency-name: simple-icons
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>

* refactor: update icon loading to handle SI v7

* refactor: use SI slugs directly

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Caleb Cartwright <caleb.cartwright@outlook.com>
Co-authored-by: repo-ranger[bot] <39074581+repo-ranger[bot]@users.noreply.github.com>
---
 lib/load-simple-icons.js | 21 ++++++++++++---------
 package-lock.json        | 14 +++++++-------
 package.json             |  2 +-
 3 files changed, 20 insertions(+), 17 deletions(-)

diff --git a/lib/load-simple-icons.js b/lib/load-simple-icons.js
index a17b7ce8a2..6f9590f261 100644
--- a/lib/load-simple-icons.js
+++ b/lib/load-simple-icons.js
@@ -1,4 +1,4 @@
-import originalSimpleIcons from 'simple-icons'
+import * as originalSimpleIcons from 'simple-icons/icons'
 import { svg2base64 } from './svg-helpers.js'
 
 function loadSimpleIcons() {
@@ -14,10 +14,10 @@ function loadSimpleIcons() {
   // https://github.com/badges/shields/issues/4273
   Object.keys(originalSimpleIcons).forEach(key => {
     const icon = originalSimpleIcons[key]
-    const title = icon.title.toLowerCase()
-    const legacyTitle = title.replace(/ /g, '-')
+    const { title, slug, hex } = icon
+
     icon.base64 = {
-      default: svg2base64(icon.svg.replace('<svg', `<svg fill="#${icon.hex}"`)),
+      default: svg2base64(icon.svg.replace('<svg', `<svg fill="#${hex}"`)),
       light: svg2base64(icon.svg.replace('<svg', `<svg fill="whitesmoke"`)),
       dark: svg2base64(icon.svg.replace('<svg', `<svg fill="#333"`)),
     }
@@ -26,14 +26,17 @@ function loadSimpleIcons() {
     // (e.g. 'Hive'). If a by-title reference we generate for
     // backwards compatibility collides with a proper slug from Simple Icons
     // then do nothing, so that the proper slug will always map to the correct icon.
-    if (!(title in originalSimpleIcons)) {
-      simpleIcons[title] = icon
+    // Starting in v7, the exported object with the full icon set has updated the keys
+    // to include a lowercase `si` prefix, and utilizes proper case naming conventions.
+    if (!(`si${title}` in originalSimpleIcons)) {
+      simpleIcons[title.toLowerCase()] = icon
     }
-    if (!(legacyTitle in originalSimpleIcons)) {
-      simpleIcons[legacyTitle] = icon
+    const legacyTitle = title.replace(/ /g, '-')
+    if (!(`si${legacyTitle}` in originalSimpleIcons)) {
+      simpleIcons[legacyTitle.toLowerCase()] = icon
     }
 
-    simpleIcons[key] = icon
+    simpleIcons[slug] = icon
   })
   return simpleIcons
 }
diff --git a/package-lock.json b/package-lock.json
index e539ba4ed0..0ab947c04a 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -49,7 +49,7 @@
         "qs": "^6.10.5",
         "query-string": "^7.1.1",
         "semver": "~7.3.7",
-        "simple-icons": "6.23.0",
+        "simple-icons": "7.0.0",
         "webextension-store-meta": "^1.0.5",
         "xmldom": "~0.6.0",
         "xpath": "~0.0.32"
@@ -25916,9 +25916,9 @@
       }
     },
     "node_modules/simple-icons": {
-      "version": "6.23.0",
-      "resolved": "https://registry.npmjs.org/simple-icons/-/simple-icons-6.23.0.tgz",
-      "integrity": "sha512-9ql+6OdW5Dnfx1/z5z8MYO2y+OM4Oj4XBvQY5Nlye4eW+Nf5igHzHIKKtTmFkvCmR0lrddZpe1F/89chgoUXhg==",
+      "version": "7.0.0",
+      "resolved": "https://registry.npmjs.org/simple-icons/-/simple-icons-7.0.0.tgz",
+      "integrity": "sha512-5jwnZ04C2PmdKrLe6HSZLmsmP77WvZtNau0hGgSqEi2pplcP3yiiE4/f0Emgix8tItWKsYkS1TQI75yZhr8Xjw==",
       "engines": {
         "node": ">=0.12.18"
       },
@@ -50405,9 +50405,9 @@
       "dev": true
     },
     "simple-icons": {
-      "version": "6.23.0",
-      "resolved": "https://registry.npmjs.org/simple-icons/-/simple-icons-6.23.0.tgz",
-      "integrity": "sha512-9ql+6OdW5Dnfx1/z5z8MYO2y+OM4Oj4XBvQY5Nlye4eW+Nf5igHzHIKKtTmFkvCmR0lrddZpe1F/89chgoUXhg=="
+      "version": "7.0.0",
+      "resolved": "https://registry.npmjs.org/simple-icons/-/simple-icons-7.0.0.tgz",
+      "integrity": "sha512-5jwnZ04C2PmdKrLe6HSZLmsmP77WvZtNau0hGgSqEi2pplcP3yiiE4/f0Emgix8tItWKsYkS1TQI75yZhr8Xjw=="
     },
     "simple-swizzle": {
       "version": "0.2.2",
diff --git a/package.json b/package.json
index c5800b7e5d..6ce19364c6 100644
--- a/package.json
+++ b/package.json
@@ -61,7 +61,7 @@
     "qs": "^6.10.5",
     "query-string": "^7.1.1",
     "semver": "~7.3.7",
-    "simple-icons": "6.23.0",
+    "simple-icons": "7.0.0",
     "webextension-store-meta": "^1.0.5",
     "xmldom": "~0.6.0",
     "xpath": "~0.0.32"
-- 
GitLab