Skip to content

Commit

Permalink
Sunsetting Shields custom logos
Browse files Browse the repository at this point in the history
  • Loading branch information
PyvesB committed Jul 10, 2024
1 parent 9d31aa0 commit dac6c73
Show file tree
Hide file tree
Showing 24 changed files with 73 additions and 230 deletions.
4 changes: 0 additions & 4 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -154,10 +154,6 @@ To run the integration tests:

There is a [High-level code walkthrough](doc/code-walkthrough.md) describing the layout of the project.

### Logos

We have [documentation for logo usage](doc/logos.md) which includes [contribution guidance](doc/logos.md#contributing-logos)

## Pull Requests

All code changes are incorporated via pull requests, and pull requests are always squashed into a single commit on merging. Therefore there's no requirement to squash commits within your PR, but feel free to squash or restructure the commits on your PR branch if you think it will be helpful. PRs with well structured commits are always easier to review!
Expand Down
10 changes: 4 additions & 6 deletions core/base-service/coalesce-badge.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,10 @@ import toArray from './to-array.js'
//
// Logos are resolved in this manner:
//
// 1. When `?logo=` contains a named logo or the name of one of the Shields
// logos or contains base64-encoded SVG, that logo is used. When a
// `&logoColor=` is specified, that color is used (except for the
// base64-encoded logos). Otherwise the default color is used. If the color
// is specified for a multicolor Shield logo, the named logo will be used and
// colored. The appearance of the logo can be customized using `logoWidth`,
// 1. When `?logo=` contains a simple-icons logo or contains a base64-encoded
// SVG, that logo is used. When a `&logoColor=` is specified, that color is
// used (except for the base64-encoded logos). Otherwise the default color
// is used. The appearance of the logo can be customized using `logoWidth`,
// When `?logo=` is specified, any logo-related parameters specified
// dynamically by the service, or by default in the service, are ignored.
// 2. The second precedence is the dynamic logo returned by a service. This is
Expand Down
51 changes: 12 additions & 39 deletions core/base-service/coalesce-badge.spec.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { expect } from 'chai'
import { getShieldsIcon, getSimpleIcon } from '../../lib/logos.js'
import { getSimpleIcon } from '../../lib/logos.js'
import coalesceBadge from './coalesce-badge.js'

describe('coalesceBadge', function () {
Expand Down Expand Up @@ -138,7 +138,7 @@ describe('coalesceBadge', function () {
})

it('when a social badge, uses the default named logo', function () {
// .not.be.empty for confidence that nothing has changed with `getShieldsIcon()`.
// .not.be.empty for confidence that nothing has changed with `getSimpleIcon()`.
expect(
coalesceBadge({ style: 'social' }, {}, { namedLogo: 'appveyor' }).logo,
).to.equal(getSimpleIcon({ name: 'appveyor' })).and.not.be.empty
Expand All @@ -149,52 +149,35 @@ describe('coalesceBadge', function () {
namedLogo: 'npm',
})
expect(coalesceBadge({}, { namedLogo: 'npm' }, {}).logo).to.equal(
getShieldsIcon({ name: 'npm' }),
getSimpleIcon({ name: 'npm' }),
).and.not.to.be.empty
})

it('applies the named monochrome logo with color', function () {
it('applies the named logo with color', function () {
expect(
coalesceBadge({}, { namedLogo: 'dependabot', logoColor: 'blue' }, {})
.logo,
).to.equal(getShieldsIcon({ name: 'dependabot', color: 'blue' })).and.not
).to.equal(getSimpleIcon({ name: 'dependabot', color: 'blue' })).and.not
.to.be.empty
})

it('applies the named multicolored logo with color', function () {
expect(
coalesceBadge({}, { namedLogo: 'npm', logoColor: 'blue' }, {}).logo,
).to.equal(getSimpleIcon({ name: 'npm', color: 'blue' })).and.not.to.be
.empty
})

it('overrides the logo', function () {
expect(
coalesceBadge({ logo: 'npm' }, { namedLogo: 'appveyor' }, {}).logo,
).to.equal(getShieldsIcon({ name: 'npm' })).and.not.be.empty
).to.equal(getSimpleIcon({ name: 'npm' })).and.not.be.empty
})

it('overrides the monochrome logo with a color', function () {
it('overrides the logo with a color', function () {
expect(
coalesceBadge(
{ logo: 'dependabot', logoColor: 'blue' },
{ namedLogo: 'appveyor' },
{},
).logo,
).to.equal(getShieldsIcon({ name: 'dependabot', color: 'blue' })).and.not
).to.equal(getSimpleIcon({ name: 'dependabot', color: 'blue' })).and.not
.be.empty
})

it('overrides multicolored logo with a color', function () {
expect(
coalesceBadge(
{ logo: 'npm', logoColor: 'blue' },
{ namedLogo: 'appveyor' },
{},
).logo,
).to.equal(getSimpleIcon({ name: 'npm', color: 'blue' })).and.not.be.empty
})

it("when the logo is overridden, it ignores the service's logo color and width", function () {
expect(
coalesceBadge(
Expand All @@ -206,35 +189,25 @@ describe('coalesceBadge', function () {
},
{},
).logo,
).to.equal(getShieldsIcon({ name: 'npm' })).and.not.be.empty
).to.equal(getSimpleIcon({ name: 'npm' })).and.not.be.empty
})

it("overrides the service monochome logo's color", function () {
it("overrides the service logo's color", function () {
expect(
coalesceBadge(
{ logoColor: 'blue' },
{ namedLogo: 'dependabot', logoColor: 'red' },
{},
).logo,
).to.equal(getShieldsIcon({ name: 'dependabot', color: 'blue' })).and.not
).to.equal(getSimpleIcon({ name: 'dependabot', color: 'blue' })).and.not
.be.empty
})

it("overrides the service multicolored logo's color", function () {
expect(
coalesceBadge(
{ logoColor: 'blue' },
{ namedLogo: 'npm', logoColor: 'red' },
{},
).logo,
).to.equal(getSimpleIcon({ name: 'npm', color: 'blue' })).and.not.be.empty
})

// https://github.com/badges/shields/issues/2998
it('overrides logoSvg', function () {
const logoSvg = 'data:image/svg+xml;base64,PHN2ZyB4bWxu'
expect(coalesceBadge({ logo: 'npm' }, { logoSvg }, {}).logo).to.equal(
getShieldsIcon({ name: 'npm' }),
getSimpleIcon({ name: 'npm' }),
).and.not.be.empty
})
})
Expand Down
6 changes: 3 additions & 3 deletions core/base-service/openapi.js
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ function category2openapi({ category, services, sort = false }) {
in: 'query',
required: false,
description:
'One of the named logos (bitcoin, dependabot, gitlab, npm, paypal, serverfault, stackexchange, superuser, telegram, travis) or simple-icons. All simple-icons are referenced using icon slugs. You can click the icon title on <a href="https://simpleicons.org/" rel="noopener noreferrer" target="_blank">simple-icons</a> to copy the slug or they can be found in the <a href="https://github.com/simple-icons/simple-icons/blob/master/slugs.md">slugs.md file</a> in the simple-icons repository. <a href="/docs/logos">Further info</a>.',
'Icon slug from simple-icons. You can click the icon title on <a href="https://simpleicons.org/" rel="noopener noreferrer" target="_blank">simple-icons</a> to copy the slug or they can be found in the <a href="https://github.com/simple-icons/simple-icons/blob/master/slugs.md">slugs.md file</a> in the simple-icons repository. <a href="/docs/logos">Further info</a>.',
schema: {
type: 'string',
},
Expand All @@ -135,7 +135,7 @@ function category2openapi({ category, services, sort = false }) {
in: 'query',
required: false,
description:
'The color of the logo (hex, rgb, rgba, hsl, hsla and css named colors supported). Supported for named logos and Shields logos but not for custom logos. For multicolor Shields logos, the corresponding named logo will be used and colored.',
'The color of the logo (hex, rgb, rgba, hsl, hsla and css named colors supported). Supported for simple-icons logos but not for custom logos.',
schema: {
type: 'string',
},
Expand All @@ -146,7 +146,7 @@ function category2openapi({ category, services, sort = false }) {
in: 'query',
required: false,
description:
'Make icons adaptively resize by setting `auto`. Useful for some wider logos like `amd` and `amg`. Supported for simple-icons logos only.',
'Make icons adaptively resize by setting `auto`. Useful for some wider logos like `amd` and `amg`. Supported for simple-icons logos but not for custom logos.',
schema: {
type: 'string',
},
Expand Down
6 changes: 3 additions & 3 deletions core/base-service/openapi.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ const expected = {
in: 'query',
required: false,
description:
'One of the named logos (bitcoin, dependabot, gitlab, npm, paypal, serverfault, stackexchange, superuser, telegram, travis) or simple-icons. All simple-icons are referenced using icon slugs. You can click the icon title on <a href="https://simpleicons.org/" rel="noopener noreferrer" target="_blank">simple-icons</a> to copy the slug or they can be found in the <a href="https://github.com/simple-icons/simple-icons/blob/master/slugs.md">slugs.md file</a> in the simple-icons repository. <a href="/docs/logos">Further info</a>.',
'Icon slug from simple-icons. You can click the icon title on <a href="https://simpleicons.org/" rel="noopener noreferrer" target="_blank">simple-icons</a> to copy the slug or they can be found in the <a href="https://github.com/simple-icons/simple-icons/blob/master/slugs.md">slugs.md file</a> in the simple-icons repository. <a href="/docs/logos">Further info</a>.',
schema: { type: 'string' },
example: 'appveyor',
},
Expand All @@ -89,7 +89,7 @@ const expected = {
in: 'query',
required: false,
description:
'The color of the logo (hex, rgb, rgba, hsl, hsla and css named colors supported). Supported for named logos and Shields logos but not for custom logos. For multicolor Shields logos, the corresponding named logo will be used and colored.',
'The color of the logo (hex, rgb, rgba, hsl, hsla and css named colors supported). Supported for simple-icons logos but not for custom logos.',
schema: { type: 'string' },
example: 'violet',
},
Expand All @@ -98,7 +98,7 @@ const expected = {
in: 'query',
required: false,
description:
'Make icons adaptively resize by setting `auto`. Useful for some wider logos like `amd` and `amg`. Supported for simple-icons logos only.',
'Make icons adaptively resize by setting `auto`. Useful for some wider logos like `amd` and `amg`. Supported for simple-icons logos but not for custom logos.',
schema: {
type: 'string',
},
Expand Down
12 changes: 0 additions & 12 deletions dangerfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ const server = fileMatch('core/server/**.js', '!*.spec.js')
const serverTests = fileMatch('core/server/**.spec.js')
const legacyHelpers = fileMatch('lib/**/*.js', '!*.spec.js')
const legacyHelperTests = fileMatch('lib/**/*.spec.js')
const logos = fileMatch('logo/*.svg')
const packageJson = fileMatch('package.json')
const packageLock = fileMatch('package-lock.json')
const secretsDocs = fileMatch('doc/server-secrets.md')
Expand Down Expand Up @@ -78,17 +77,6 @@ if (legacyHelpers.created) {
)
}

if (logos.created) {
message(
[
':art: Thanks for submitting a logo. <br>',
'Please ensure your contribution follows our ',
'[guidance](https://github.com/badges/shields/blob/master/doc/logos.md#contributing-logos) ',
'for logo submissions.',
].join(''),
)
}

if (capitals.created || underscores.created) {
fail(
[
Expand Down
42 changes: 0 additions & 42 deletions doc/logos.md

This file was deleted.

Loading

0 comments on commit dac6c73

Please sign in to comment.