Skip to content

Commit

Permalink
Merge branch 'master' into redirect-to-canonical-url
Browse files Browse the repository at this point in the history
  • Loading branch information
paulmelnikow authored Feb 8, 2019
2 parents 2e95d93 + 4d45fe3 commit 735ffb3
Show file tree
Hide file tree
Showing 28 changed files with 647 additions and 453 deletions.
12 changes: 6 additions & 6 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -8,20 +8,19 @@ FRONTEND_TMP=${TMPDIR}shields-frontend-deploy
# pushing secrets to GitHub, this branch is configured to reject pushes.
WORKING_BRANCH=server-deploy-working-branch

all: website test

website:
npm run build
all: test

deploy: deploy-s0 deploy-s1 deploy-s2 clean-server-deploy deploy-gh-pages deploy-gh-pages-clean

deploy-s0: prepare-server-deploy push-s0
deploy-s1: prepare-server-deploy push-s1
deploy-s2: prepare-server-deploy push-s2

prepare-server-deploy: website
prepare-server-deploy:
# Ship a copy of the front end to each server for debugging.
# https://github.com/badges/shields/issues/1220
INCLUDE_DEV_PAGES=false \
npm run build
rm -rf ${SERVER_TMP}
git worktree prune
git worktree add -B ${WORKING_BRANCH} ${SERVER_TMP}
Expand Down Expand Up @@ -49,6 +48,7 @@ deploy-gh-pages:
rm -rf ${FRONTEND_TMP}
git worktree prune
GATSBY_BASE_URL=https://img.shields.io \
INCLUDE_DEV_PAGES=false \
npm run build
git worktree add -B gh-pages ${FRONTEND_TMP}
git -C ${FRONTEND_TMP} ls-files | xargs git -C ${FRONTEND_TMP} rm
Expand All @@ -67,4 +67,4 @@ deploy-gh-pages-clean:
test:
npm test

.PHONY: all website deploy prepare-server-deploy clean-server-deploy deploy-s0 deploy-s1 deploy-s2 push-s0 push-s1 push-s2 deploy-gh-pages deploy-gh-pages-clean deploy-heroku setup redis test
.PHONY: all deploy prepare-server-deploy clean-server-deploy deploy-s0 deploy-s1 deploy-s2 push-s0 push-s1 push-s2 deploy-gh-pages deploy-gh-pages-clean deploy-heroku setup redis test
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<p align="center">
<img src="https://rawgit.com/badges/shields/master/frontend/images/logo.svg"
<img src="./frontend/images/logo.svg"
height="130">
</p>
<p align="center">
Expand Down
69 changes: 69 additions & 0 deletions frontend/components/development/logo-page.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
import React from 'react'
import PropTypes from 'prop-types'
import styled from 'styled-components'
import { staticBadgeUrl } from '../../lib/badge-url'
import { baseUrl } from '../../constants'
import Meta from '../meta'
import Header from '../header'
import { H3, Badge } from '../common'
import { shieldsLogos, simpleIcons } from '../../../supported-features.json'

const StyledTable = styled.table`
border: 1px solid #ccc;
border-collapse: collapse;
td {
border: 1px solid #ccc;
padding: 3px;
text-align: left;
}
`

const NamedLogoTable = ({ logoNames }) => (
<StyledTable>
<thead>
<tr>
<td>Flat</td>
<td>Social</td>
</tr>
</thead>
<tbody>
{logoNames.map(name => (
<tr key={name}>
<td>
<Badge
src={staticBadgeUrl(baseUrl, 'named logo', name, 'blue', {
logo: name,
})}
alt={`logo: ${name}`}
/>
</td>
<td>
<Badge
src={staticBadgeUrl(baseUrl, 'Named Logo', name, 'blue', {
logo: name,
style: 'social',
})}
alt={`logo: ${name}`}
/>
</td>
</tr>
))}
</tbody>
</StyledTable>
)
NamedLogoTable.propTypes = {
logoNames: PropTypes.arrayOf(PropTypes.string).isRequired,
}

const LogoPage = () => (
<div>
<Meta />
<Header />
<H3>Named logos</H3>
<NamedLogoTable logoNames={shieldsLogos} />
<H3>Simple-icons</H3>
<NamedLogoTable logoNames={simpleIcons} />
</div>
)
export default LogoPage
4 changes: 2 additions & 2 deletions frontend/components/usage.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { Link } from 'gatsby'
import PropTypes from 'prop-types'
import styled from 'styled-components'
import { staticBadgeUrl } from '../lib/badge-url'
import { advertisedStyles, logos } from '../../supported-features.json'
import { advertisedStyles, shieldsLogos } from '../../supported-features.json'
import StaticBadgeMaker from './static-badge-maker'
import DynamicBadgeMaker from './dynamic-badge-maker'
import { H2, H3, Badge, VerticalSpace } from './common'
Expand Down Expand Up @@ -110,7 +110,7 @@ export default class Usage extends React.PureComponent {

static renderNamedLogos() {
const renderLogo = logo => <LogoName key={logo}>{logo}</LogoName>
const [first, ...rest] = logos
const [first, ...rest] = shieldsLogos
return [renderLogo(first)].concat(
rest.reduce((result, logo) => result.concat([', ', renderLogo(logo)]), [])
)
Expand Down
10 changes: 10 additions & 0 deletions gatsby-node.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@

const fs = require('fs')
const yaml = require('js-yaml')
const envFlag = require('node-env-flag')

const includeDevPages = envFlag(process.env.INCLUDE_DEV_PAGES, true)

const { categories } = yaml.safeLoad(
fs.readFileSync('./service-definitions.yml', 'utf8')
Expand All @@ -17,6 +20,13 @@ const { categories } = yaml.safeLoad(
// unnecessary complexity here, so this uses the programmatic API.
// https://www.gatsbyjs.org/docs/using-gatsby-without-graphql/#the-approach-fetch-data-and-use-gatsbys-createpages-api
async function createPages({ actions: { createPage } }) {
if (includeDevPages) {
createPage({
path: '/dev/logos',
component: require.resolve('./frontend/components/development/logo-page'),
})
}

categories.forEach(category => {
const { id } = category
createPage({
Expand Down
94 changes: 32 additions & 62 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@
"babel-eslint": "^10.0.0",
"babel-plugin-inline-react-svg": "^1.0.1",
"babel-plugin-istanbul": "^5.1.0",
"babel-preset-gatsby": "^0.1.6",
"babel-preset-gatsby": "^0.1.7",
"caller": "^1.0.1",
"chai": "^4.1.2",
"chai-datetime": "^1.5.0",
Expand Down Expand Up @@ -192,8 +192,8 @@
"prettier-check": "^2.0.0",
"pretty": "^2.0.0",
"prop-types": "^15.6.0",
"react": "^16.7.0",
"react-dom": "^16.7.0",
"react": "^16.8.1",
"react-dom": "^16.8.1",
"react-error-overlay": "^5.1.2",
"react-helmet": "^5.2.0",
"react-modal": "^3.8.1",
Expand All @@ -210,7 +210,7 @@
"styled-components": "^4.1.3",
"tmp": "0.0.33",
"url": "^0.11.0",
"walkdir": "0.0.12"
"walkdir": "0.2.0"
},
"engines": {
"node": ">= 8",
Expand Down
Loading

0 comments on commit 735ffb3

Please sign in to comment.