From bf5438f457aea9a2bb24cb2af868183a32b3d463 Mon Sep 17 00:00:00 2001 From: chris48s Date: Fri, 25 Jan 2019 17:51:41 +0000 Subject: [PATCH] Delete some of our logos (part 1) (#2857) Refs #2510 I'm going to delete or change some more logos in a further PR or two, but lets start off with the (hopefully) non-controversial ones. I think in all of these cases it is fairly clear-cut that we are not losing anything by removing our icon in favour of simple-icons now that we apply a sensible colour by default. --- core/base-service/coalesce-badge.spec.js | 34 ++++++++++++------------ lib/logos.js | 15 ++++++++++- lib/logos.spec.js | 12 ++++----- logo/appveyor.svg | 3 --- logo/azuredevops.svg | 1 - logo/circleci.svg | 1 - logo/codeship.svg | 1 - logo/docker.svg | 1 - logo/eclipse.svg | 1 - logo/github.svg | 3 --- logo/gitter-white.svg | 8 ------ logo/liberapay.svg | 1 - logo/matrix.svg | 1 - logo/postgresql.svg | 12 --------- logo/slack.svg | 1 - logo/sourcegraph.svg | 1 - logo/stackoverflow.svg | 1 - logo/telegram.svg | 2 +- logo/tfs.svg | 3 --- logo/twitter.svg | 1 - logo/windows.svg | 1 - services/endpoint/endpoint.tester.js | 12 ++++----- 22 files changed, 44 insertions(+), 72 deletions(-) delete mode 100644 logo/appveyor.svg delete mode 100644 logo/azuredevops.svg delete mode 100644 logo/circleci.svg delete mode 100644 logo/codeship.svg delete mode 100644 logo/docker.svg delete mode 100644 logo/eclipse.svg delete mode 100644 logo/github.svg delete mode 100644 logo/gitter-white.svg delete mode 100644 logo/liberapay.svg delete mode 100644 logo/matrix.svg delete mode 100644 logo/postgresql.svg delete mode 100644 logo/slack.svg delete mode 100644 logo/sourcegraph.svg delete mode 100644 logo/stackoverflow.svg delete mode 100644 logo/tfs.svg delete mode 100644 logo/twitter.svg delete mode 100644 logo/windows.svg diff --git a/core/base-service/coalesce-badge.spec.js b/core/base-service/coalesce-badge.spec.js index 4c9ba4ba060f3..71bf04ec34615 100644 --- a/core/base-service/coalesce-badge.spec.js +++ b/core/base-service/coalesce-badge.spec.js @@ -1,7 +1,7 @@ 'use strict' const { expect } = require('chai') -const { getShieldsIcon } = require('../../lib/logos') +const { getShieldsIcon, getSimpleIcon } = require('../../lib/logos') const coalesceBadge = require('./coalesce-badge') describe('coalesceBadge', function() { @@ -118,43 +118,43 @@ describe('coalesceBadge', function() { // .not.be.empty for confidence that nothing has changed with `getShieldsIcon()`. expect( coalesceBadge({ style: 'social' }, {}, { namedLogo: 'appveyor' }).logo - ).to.equal(getShieldsIcon({ name: 'appveyor' })).and.not.be.empty + ).to.equal(getSimpleIcon({ name: 'appveyor' })).and.not.be.empty }) it('applies the named logo', function() { - expect(coalesceBadge({}, { namedLogo: 'github' }, {}).logo).to.equal( - getShieldsIcon({ name: 'github' }) + expect(coalesceBadge({}, { namedLogo: 'npm' }, {}).logo).to.equal( + getShieldsIcon({ name: 'npm' }) ).and.not.to.be.empty }) it('applies the named logo with color', function() { expect( - coalesceBadge({}, { namedLogo: 'github', logoColor: 'blue' }, {}).logo - ).to.equal(getShieldsIcon({ name: 'github', color: 'blue' })).and.not.to - .be.empty + coalesceBadge({}, { namedLogo: 'npm', logoColor: 'blue' }, {}).logo + ).to.equal(getShieldsIcon({ name: 'npm', color: 'blue' })).and.not.to.be + .empty }) it('overrides the logo', function() { expect( - coalesceBadge({ logo: 'github' }, { namedLogo: 'appveyor' }, {}).logo - ).to.equal(getShieldsIcon({ name: 'github' })).and.not.be.empty + coalesceBadge({ logo: 'npm' }, { namedLogo: 'appveyor' }, {}).logo + ).to.equal(getShieldsIcon({ name: 'npm' })).and.not.be.empty }) it('overrides the logo with a color', function() { expect( coalesceBadge( - { logo: 'github', logoColor: 'blue' }, + { logo: 'npm', logoColor: 'blue' }, { namedLogo: 'appveyor' }, {} ).logo - ).to.equal(getShieldsIcon({ name: 'github', color: 'blue' })).and.not.be + ).to.equal(getShieldsIcon({ name: 'npm', color: 'blue' })).and.not.be .empty }) it("when the logo is overridden, it ignores the service's logo color, position, and width", function() { expect( coalesceBadge( - { logo: 'github' }, + { logo: 'npm' }, { namedLogo: 'appveyor', logoColor: 'red', @@ -163,17 +163,17 @@ describe('coalesceBadge', function() { }, {} ).logo - ).to.equal(getShieldsIcon({ name: 'github' })).and.not.be.empty + ).to.equal(getShieldsIcon({ name: 'npm' })).and.not.be.empty }) it("overrides the service logo's color", function() { expect( coalesceBadge( { logoColor: 'blue' }, - { namedLogo: 'github', logoColor: 'red' }, + { namedLogo: 'npm', logoColor: 'red' }, {} ).logo - ).to.equal(getShieldsIcon({ name: 'github', color: 'blue' })).and.not.be + ).to.equal(getShieldsIcon({ name: 'npm', color: 'blue' })).and.not.be .empty }) }) @@ -205,7 +205,7 @@ describe('coalesceBadge', function() { it('applies the logo width', function() { expect( - coalesceBadge({}, { namedLogo: 'github', logoWidth: 275 }, {}).logoWidth + coalesceBadge({}, { namedLogo: 'npm', logoWidth: 275 }, {}).logoWidth ).to.equal(275) }) }) @@ -219,7 +219,7 @@ describe('coalesceBadge', function() { it('applies the logo position', function() { expect( - coalesceBadge({}, { namedLogo: 'github', logoPosition: -10 }, {}) + coalesceBadge({}, { namedLogo: 'npm', logoPosition: -10 }, {}) .logoPosition ).to.equal(-10) }) diff --git a/lib/logos.js b/lib/logos.js index f9324fc06a24f..8afd1a0a60170 100644 --- a/lib/logos.js +++ b/lib/logos.js @@ -7,6 +7,15 @@ const { svg2base64 } = require('./svg-helpers') const logos = require('./load-logos')() const simpleIcons = require('./load-simple-icons')() +// for backwards-compatibility with deleted logos +const logoAliases = { + azuredevops: 'azure-devops', + eclipse: 'eclipse-ide', + 'gitter-white': 'gitter', + stackoverflow: 'stack-overflow', + tfs: 'azure-devops', +} + function prependPrefix(s, prefix) { if (s === undefined) { return undefined @@ -81,7 +90,10 @@ function getSimpleIconStyle({ icon, style }) { } function getSimpleIcon({ name, color, style }) { - const key = name.toLowerCase().replace(/ /g, '-') + let key = name.toLowerCase().replace(/ /g, '-') + if (key in logoAliases) { + key = logoAliases[key] + } if (!(key in simpleIcons)) { return undefined @@ -127,5 +139,6 @@ module.exports = { decodeDataUrlFromQueryParam, prepareNamedLogo, getShieldsIcon, + getSimpleIcon, makeLogo, } diff --git a/lib/logos.spec.js b/lib/logos.spec.js index cf0f044493a29..4ad07d442a15b 100644 --- a/lib/logos.spec.js +++ b/lib/logos.spec.js @@ -26,11 +26,11 @@ describe('Logo helpers', function() { test(prepareNamedLogo, () => { // These two strings are identical except for characters 159-165 which // differ. - given({ name: 'github' }).expect( - 'data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSI0MCIgaGVpZ2h0PSI0MCIgdmlld0JveD0iMTIgMTIgNDAgNDAiPgo8cGF0aCBmaWxsPSIjMzMzMzMzIiBkPSJNMzIsMTMuNGMtMTAuNSwwLTE5LDguNS0xOSwxOWMwLDguNCw1LjUsMTUuNSwxMywxOGMxLDAuMiwxLjMtMC40LDEuMy0wLjljMC0wLjUsMC0xLjcsMC0zLjIgYy01LjMsMS4xLTYuNC0yLjYtNi40LTIuNkMyMCw0MS42LDE4LjgsNDEsMTguOCw0MWMtMS43LTEuMiwwLjEtMS4xLDAuMS0xLjFjMS45LDAuMSwyLjksMiwyLjksMmMxLjcsMi45LDQuNSwyLjEsNS41LDEuNiBjMC4yLTEuMiwwLjctMi4xLDEuMi0yLjZjLTQuMi0wLjUtOC43LTIuMS04LjctOS40YzAtMi4xLDAuNy0zLjcsMi01LjFjLTAuMi0wLjUtMC44LTIuNCwwLjItNWMwLDAsMS42LTAuNSw1LjIsMiBjMS41LTAuNCwzLjEtMC43LDQuOC0wLjdjMS42LDAsMy4zLDAuMiw0LjcsMC43YzMuNi0yLjQsNS4yLTIsNS4yLTJjMSwyLjYsMC40LDQuNiwwLjIsNWMxLjIsMS4zLDIsMywyLDUuMWMwLDcuMy00LjUsOC45LTguNyw5LjQgYzAuNywwLjYsMS4zLDEuNywxLjMsMy41YzAsMi42LDAsNC42LDAsNS4yYzAsMC41LDAuNCwxLjEsMS4zLDAuOWM3LjUtMi42LDEzLTkuNywxMy0xOC4xQzUxLDIxLjksNDIuNSwxMy40LDMyLDEzLjR6Ii8+Cjwvc3ZnPgo=' + given({ name: 'npm' }).expect( + 'data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCA0MCA0MCI+PHBhdGggZD0iTTAgMGg0MHY0MEgwVjB6IiBmaWxsPSIjY2IwMDAwIi8+PHBhdGggZmlsbD0iI2ZmZiIgZD0iTTcgN2gyNnYyNmgtN1YxNGgtNnYxOUg3eiIvPjwvc3ZnPgo=' ) - given({ name: 'github', color: 'blue' }).expect( - 'data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSI0MCIgaGVpZ2h0PSI0MCIgdmlld0JveD0iMTIgMTIgNDAgNDAiPgo8cGF0aCBmaWxsPSIjMDA3ZWM2IiBkPSJNMzIsMTMuNGMtMTAuNSwwLTE5LDguNS0xOSwxOWMwLDguNCw1LjUsMTUuNSwxMywxOGMxLDAuMiwxLjMtMC40LDEuMy0wLjljMC0wLjUsMC0xLjcsMC0zLjIgYy01LjMsMS4xLTYuNC0yLjYtNi40LTIuNkMyMCw0MS42LDE4LjgsNDEsMTguOCw0MWMtMS43LTEuMiwwLjEtMS4xLDAuMS0xLjFjMS45LDAuMSwyLjksMiwyLjksMmMxLjcsMi45LDQuNSwyLjEsNS41LDEuNiBjMC4yLTEuMiwwLjctMi4xLDEuMi0yLjZjLTQuMi0wLjUtOC43LTIuMS04LjctOS40YzAtMi4xLDAuNy0zLjcsMi01LjFjLTAuMi0wLjUtMC44LTIuNCwwLjItNWMwLDAsMS42LTAuNSw1LjIsMiBjMS41LTAuNCwzLjEtMC43LDQuOC0wLjdjMS42LDAsMy4zLDAuMiw0LjcsMC43YzMuNi0yLjQsNS4yLTIsNS4yLTJjMSwyLjYsMC40LDQuNiwwLjIsNWMxLjIsMS4zLDIsMywyLDUuMWMwLDcuMy00LjUsOC45LTguNyw5LjQgYzAuNywwLjYsMS4zLDEuNywxLjMsMy41YzAsMi42LDAsNC42LDAsNS4yYzAsMC41LDAuNCwxLjEsMS4zLDAuOWM3LjUtMi42LDEzLTkuNywxMy0xOC4xQzUxLDIxLjksNDIuNSwxMy40LDMyLDEzLjR6Ii8+Cjwvc3ZnPgo=' + given({ name: 'npm', color: 'blue' }).expect( + 'data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCA0MCA0MCI+PHBhdGggZD0iTTAgMGg0MHY0MEgwVjB6IiBmaWxsPSIjMDA3ZWM2Ii8+PHBhdGggZmlsbD0iIzAwN2VjNiIgZD0iTTcgN2gyNnYyNmgtN1YxNGgtNnYxOUg3eiIvPjwvc3ZnPgo=' ) it('preserves color if light logo on dark background', function() { @@ -95,8 +95,8 @@ describe('Logo helpers', function() { forCases([given('npm', { logo: '' }), given(undefined, {})]).expect( undefined ) - given('github', {}).expect( - 'data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSI0MCIgaGVpZ2h0PSI0MCIgdmlld0JveD0iMTIgMTIgNDAgNDAiPgo8cGF0aCBmaWxsPSIjMzMzMzMzIiBkPSJNMzIsMTMuNGMtMTAuNSwwLTE5LDguNS0xOSwxOWMwLDguNCw1LjUsMTUuNSwxMywxOGMxLDAuMiwxLjMtMC40LDEuMy0wLjljMC0wLjUsMC0xLjcsMC0zLjIgYy01LjMsMS4xLTYuNC0yLjYtNi40LTIuNkMyMCw0MS42LDE4LjgsNDEsMTguOCw0MWMtMS43LTEuMiwwLjEtMS4xLDAuMS0xLjFjMS45LDAuMSwyLjksMiwyLjksMmMxLjcsMi45LDQuNSwyLjEsNS41LDEuNiBjMC4yLTEuMiwwLjctMi4xLDEuMi0yLjZjLTQuMi0wLjUtOC43LTIuMS04LjctOS40YzAtMi4xLDAuNy0zLjcsMi01LjFjLTAuMi0wLjUtMC44LTIuNCwwLjItNWMwLDAsMS42LTAuNSw1LjIsMiBjMS41LTAuNCwzLjEtMC43LDQuOC0wLjdjMS42LDAsMy4zLDAuMiw0LjcsMC43YzMuNi0yLjQsNS4yLTIsNS4yLTJjMSwyLjYsMC40LDQuNiwwLjIsNWMxLjIsMS4zLDIsMywyLDUuMWMwLDcuMy00LjUsOC45LTguNyw5LjQgYzAuNywwLjYsMS4zLDEuNywxLjMsMy41YzAsMi42LDAsNC42LDAsNS4yYzAsMC41LDAuNCwxLjEsMS4zLDAuOWM3LjUtMi42LDEzLTkuNywxMy0xOC4xQzUxLDIxLjksNDIuNSwxMy40LDMyLDEzLjR6Ii8+Cjwvc3ZnPgo=' + given('npm', {}).expect( + 'data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCA0MCA0MCI+PHBhdGggZD0iTTAgMGg0MHY0MEgwVjB6IiBmaWxsPSIjY2IwMDAwIi8+PHBhdGggZmlsbD0iI2ZmZiIgZD0iTTcgN2gyNnYyNmgtN1YxNGgtNnYxOUg3eiIvPjwvc3ZnPgo=' ) }) }) diff --git a/logo/appveyor.svg b/logo/appveyor.svg deleted file mode 100644 index 7c36860e13f9b..0000000000000 --- a/logo/appveyor.svg +++ /dev/null @@ -1,3 +0,0 @@ - - - \ No newline at end of file diff --git a/logo/azuredevops.svg b/logo/azuredevops.svg deleted file mode 100644 index 14b04d910f055..0000000000000 --- a/logo/azuredevops.svg +++ /dev/null @@ -1 +0,0 @@ - diff --git a/logo/circleci.svg b/logo/circleci.svg deleted file mode 100644 index 05099fb880c5d..0000000000000 --- a/logo/circleci.svg +++ /dev/null @@ -1 +0,0 @@ - diff --git a/logo/codeship.svg b/logo/codeship.svg deleted file mode 100644 index ea980770a27c0..0000000000000 --- a/logo/codeship.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/logo/docker.svg b/logo/docker.svg deleted file mode 100644 index a25e3e74358ff..0000000000000 --- a/logo/docker.svg +++ /dev/null @@ -1 +0,0 @@ - diff --git a/logo/eclipse.svg b/logo/eclipse.svg deleted file mode 100644 index e15fd50d55a40..0000000000000 --- a/logo/eclipse.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/logo/github.svg b/logo/github.svg deleted file mode 100644 index 99e8eb58478f0..0000000000000 --- a/logo/github.svg +++ /dev/null @@ -1,3 +0,0 @@ - - - diff --git a/logo/gitter-white.svg b/logo/gitter-white.svg deleted file mode 100644 index 7c764cb431890..0000000000000 --- a/logo/gitter-white.svg +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - - diff --git a/logo/liberapay.svg b/logo/liberapay.svg deleted file mode 100644 index 4f5c5e47ac03b..0000000000000 --- a/logo/liberapay.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/logo/matrix.svg b/logo/matrix.svg deleted file mode 100644 index 594b97ed726ba..0000000000000 --- a/logo/matrix.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/logo/postgresql.svg b/logo/postgresql.svg deleted file mode 100644 index 038754c5ab729..0000000000000 --- a/logo/postgresql.svg +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - - - - - - - diff --git a/logo/slack.svg b/logo/slack.svg deleted file mode 100644 index 35f308dab1012..0000000000000 --- a/logo/slack.svg +++ /dev/null @@ -1 +0,0 @@ - diff --git a/logo/sourcegraph.svg b/logo/sourcegraph.svg deleted file mode 100644 index 2b80224171547..0000000000000 --- a/logo/sourcegraph.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/logo/stackoverflow.svg b/logo/stackoverflow.svg deleted file mode 100644 index 60904befb7c8e..0000000000000 --- a/logo/stackoverflow.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/logo/telegram.svg b/logo/telegram.svg index 5713a26a06249..edf84d1356a5d 100644 --- a/logo/telegram.svg +++ b/logo/telegram.svg @@ -3,4 +3,4 @@ - + \ No newline at end of file diff --git a/logo/tfs.svg b/logo/tfs.svg deleted file mode 100644 index fcdc57ebd7cdc..0000000000000 --- a/logo/tfs.svg +++ /dev/null @@ -1,3 +0,0 @@ - - - \ No newline at end of file diff --git a/logo/twitter.svg b/logo/twitter.svg deleted file mode 100644 index c67c567b78a40..0000000000000 --- a/logo/twitter.svg +++ /dev/null @@ -1 +0,0 @@ - diff --git a/logo/windows.svg b/logo/windows.svg deleted file mode 100644 index a3097ecd95094..0000000000000 --- a/logo/windows.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/services/endpoint/endpoint.tester.js b/services/endpoint/endpoint.tester.js index 6ac3fea217884..6de816adc49e9 100644 --- a/services/endpoint/endpoint.tester.js +++ b/services/endpoint/endpoint.tester.js @@ -69,12 +69,12 @@ t.create('named logo') schemaVersion: 1, label: 'hey', message: 'yo', - namedLogo: 'github', + namedLogo: 'npm', }) ) .after((err, res, body) => { expect(err).not.to.be.ok - expect(body).to.include(getShieldsIcon({ name: 'github' })) + expect(body).to.include(getShieldsIcon({ name: 'npm' })) }) t.create('named logo with color') @@ -86,17 +86,17 @@ t.create('named logo with color') schemaVersion: 1, label: 'hey', message: 'yo', - namedLogo: 'github', + namedLogo: 'npm', logoColor: 'blue', }) ) .after((err, res, body) => { expect(err).not.to.be.ok - expect(body).to.include(getShieldsIcon({ name: 'github', color: 'blue' })) + expect(body).to.include(getShieldsIcon({ name: 'npm', color: 'blue' })) }) const logoSvg = Buffer.from( - getShieldsIcon({ name: 'github' }).replace('data:image/svg+xml;base64,', ''), + getShieldsIcon({ name: 'npm' }).replace('data:image/svg+xml;base64,', ''), 'base64' ).toString('ascii') @@ -114,7 +114,7 @@ t.create('custom svg logo') ) .after((err, res, body) => { expect(err).not.to.be.ok - expect(body).to.include(getShieldsIcon({ name: 'github' })) + expect(body).to.include(getShieldsIcon({ name: 'npm' })) }) t.create('logoWidth')