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>
This commit is contained in:
@@ -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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user