feat: support `scale` arg (resolve #309)

pull/313/head
amio 2019-10-04 17:27:30 +08:00
rodzic 9310c1b20f
commit 9d55854d22
3 zmienionych plików z 18 dodań i 7 usunięć

Wyświetl plik

@ -1,4 +1,4 @@
import badgen from 'badgen'
import { badgen } from 'badgen'
import icons from 'badgen-icons'
import { BadgenParams } from './types'
@ -14,7 +14,7 @@ export default function (req, res, options: ServeBadgeOptions) {
const { code = 200, sMaxAge = 10800, query = {}, params } = options
const { subject, status, color } = params
const { label, labelColor, icon, iconWidth, list } = query
const { label, labelColor, icon, iconWidth, list, scale } = query
const _icon = resolveIcon(icon, iconWidth)
// TODO: review usage of list
@ -27,7 +27,8 @@ export default function (req, res, options: ServeBadgeOptions) {
color: query.color || color,
style: query.style || process.env.BADGE_STYLE,
icon: _icon.src,
iconWidth: iconWidth || _icon.width
iconWidth: iconWidth || _icon.width,
scale,
})
const staleControl = `stale-while-revalidate=604800, stale-if-error=604800`

16
package-lock.json wygenerowano
Wyświetl plik

@ -2093,9 +2093,19 @@
}
},
"badgen": {
"version": "2.8.2",
"resolved": "https://registry.npmjs.org/badgen/-/badgen-2.8.2.tgz",
"integrity": "sha512-DFvuODcK/KVwRXbSy2MtHGtrdBOes6ZSZ+jQOgvbxM7vLOiFLlyjXG4YrPlStSRNa+VFr5XBqOBMdBesWjcOgg=="
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/badgen/-/badgen-3.0.0.tgz",
"integrity": "sha512-kLs853P9fz7MFDgXpxvtSgEyBGFaMIKwA6v3lTAEVbeWH5z3a2XtOUD7uCORPp6JoVQmxH6Ca/DQkr1TRrTW8g==",
"requires": {
"typescript": "^3.7.0-beta"
},
"dependencies": {
"typescript": {
"version": "3.7.0-dev.20191004",
"resolved": "https://registry.npmjs.org/typescript/-/typescript-3.7.0-dev.20191004.tgz",
"integrity": "sha512-HoDEBY2LsQv5STXCw1Mt/xylYhGUeymFzHWV+5NGl2hCxLDeNmYmV38tlFoCSK2RQkFTpE2Fr9jQ6OzWiWgrpQ=="
}
}
},
"badgen-icons": {
"version": "0.12.0",

Wyświetl plik

@ -27,7 +27,7 @@
"dependencies": {
"@sentry/integrations": "^5.6.1",
"@sentry/node": "^5.6.2",
"badgen": "^2.8.2",
"badgen": "^3.0.0",
"badgen-icons": "^0.12.0",
"byte-size": "^5.0.1",
"cheerio": "^1.0.0-rc.3",