kopia lustrzana https://github.com/badgen/badgen.net
docs: put lgtm icon in examples
rodzic
8ed84a981e
commit
06cad8b682
|
@ -296,7 +296,7 @@ Advanced usage (for badge makers):
|
||||||
fetch('/metadata.json')
|
fetch('/metadata.json')
|
||||||
.then((resp) => resp.json())
|
.then((resp) => resp.json())
|
||||||
.then(json => {
|
.then(json => {
|
||||||
const blacklist = ['npm-red', 'postgresql', 'discord', 'lgtm']
|
const blacklist = ['npm-red', 'postgresql', 'discord']
|
||||||
const icons = document.querySelector('#icon-examples')
|
const icons = document.querySelector('#icon-examples')
|
||||||
for (const icon of json.icons) {
|
for (const icon of json.icons) {
|
||||||
if (blacklist.indexOf(icon) !== -1) continue;
|
if (blacklist.indexOf(icon) !== -1) continue;
|
||||||
|
|
|
@ -3,13 +3,17 @@ const { send } = require('micro')
|
||||||
const { builtin } = require('./icons.js')
|
const { builtin } = require('./icons.js')
|
||||||
|
|
||||||
const CACHE_CONTROL = `public, max-age=60, stale-while-revalidate=86400, stale-if-error=86400`
|
const CACHE_CONTROL = `public, max-age=60, stale-while-revalidate=86400, stale-if-error=86400`
|
||||||
|
const noneSquareIconWidths = {
|
||||||
|
codeclimate: 18,
|
||||||
|
lgtm: 19
|
||||||
|
}
|
||||||
|
|
||||||
module.exports = (req, res, options = {}) => {
|
module.exports = (req, res, options = {}) => {
|
||||||
const { code = 200, maxAge = '86400' } = options
|
const { code = 200, maxAge = '86400' } = options
|
||||||
|
|
||||||
const hostStyle = req.headers.host === 'flat.badgen.net' ? 'flat' : undefined
|
const hostStyle = req.headers.host === 'flat.badgen.net' ? 'flat' : undefined
|
||||||
const { subject, status, color } = req.params
|
const { subject, status, color } = req.params
|
||||||
const { style, label, list, icon } = req.query
|
const { style, label, list, icon, iconWidth } = req.query
|
||||||
|
|
||||||
const badge = badgen({
|
const badge = badgen({
|
||||||
subject: typeof label !== 'undefined' ? label : subject,
|
subject: typeof label !== 'undefined' ? label : subject,
|
||||||
|
@ -17,7 +21,8 @@ module.exports = (req, res, options = {}) => {
|
||||||
color: color,
|
color: color,
|
||||||
style: style || hostStyle,
|
style: style || hostStyle,
|
||||||
emoji: true,
|
emoji: true,
|
||||||
icon: builtin[icon]
|
icon: builtin[icon],
|
||||||
|
iconWidth: iconWidth || noneSquareIconWidths[icon]
|
||||||
})
|
})
|
||||||
|
|
||||||
res.setHeader('Content-Type', 'image/svg+xml;charset=utf-8')
|
res.setHeader('Content-Type', 'image/svg+xml;charset=utf-8')
|
||||||
|
|
|
@ -252,9 +252,9 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"badgen": {
|
"badgen": {
|
||||||
"version": "2.4.4",
|
"version": "2.4.5",
|
||||||
"resolved": "https://registry.npmjs.org/badgen/-/badgen-2.4.4.tgz",
|
"resolved": "https://registry.npmjs.org/badgen/-/badgen-2.4.5.tgz",
|
||||||
"integrity": "sha512-B8Kns0nemOOIwndUGQ8YFHHfoxhsYUh8EsktjBvn9uwLj7CzaMRthvi99zCGE8a0v5s+/c8qRZz2EaJUxXy2xg=="
|
"integrity": "sha512-fGCNEZm2pF/DuCnqK8IKNRkwEZ6NWU6FeKQKgjMLyB2ht4URcaU2vla5L2N78W99lAKJIlwwJ4ZGoJw9fAd+9w=="
|
||||||
},
|
},
|
||||||
"balanced-match": {
|
"balanced-match": {
|
||||||
"version": "1.0.0",
|
"version": "1.0.0",
|
||||||
|
|
|
@ -17,7 +17,7 @@
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"axios": "^0.18.0",
|
"axios": "^0.18.0",
|
||||||
"badgen": "^2.4.4",
|
"badgen": "^2.4.5",
|
||||||
"byte-size": "^4.0.3",
|
"byte-size": "^4.0.3",
|
||||||
"cheerio": "^1.0.0-rc.2",
|
"cheerio": "^1.0.0-rc.2",
|
||||||
"chrome-webstore": "^1.0.0",
|
"chrome-webstore": "^1.0.0",
|
||||||
|
|
Ładowanie…
Reference in New Issue