kopia lustrzana https://github.com/badgen/badgen
Update standard to 14 and fix styles
rodzic
7664764aed
commit
db29bba8d7
Plik diff jest za duży
Load Diff
|
@ -8,7 +8,7 @@
|
||||||
"main": "dist/index.js",
|
"main": "dist/index.js",
|
||||||
"types": "dist/index.d.ts",
|
"types": "dist/index.d.ts",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"lint": "standard",
|
"lint": "standard src/*.js",
|
||||||
"bench": "node bench/index.js",
|
"bench": "node bench/index.js",
|
||||||
"preview": "node preview/serve.js",
|
"preview": "node preview/serve.js",
|
||||||
"snaptests": "TAP_SNAPSHOT=1 npm test",
|
"snaptests": "TAP_SNAPSHOT=1 npm test",
|
||||||
|
@ -21,7 +21,7 @@
|
||||||
"@zeit/ncc": "^0.20.4",
|
"@zeit/ncc": "^0.20.4",
|
||||||
"benchmark": "^2.1.4",
|
"benchmark": "^2.1.4",
|
||||||
"serve-marked": "^2.0.0",
|
"serve-marked": "^2.0.0",
|
||||||
"standard": "^12.0.0",
|
"standard": "^14.0.0",
|
||||||
"tap": "^14.4.1"
|
"tap": "^14.4.1"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,9 +9,9 @@ const badgen = require('..')
|
||||||
const icons = require('../test/assets/icon-data-uri.js')
|
const icons = require('../test/assets/icon-data-uri.js')
|
||||||
|
|
||||||
const serveBadge = (req, res) => {
|
const serveBadge = (req, res) => {
|
||||||
const { pathname, query } = url.parse(req.url)
|
const { pathname, searchParams: query } = new url.URL(req.url)
|
||||||
const { label, style, icon, iconWidth, labelColor } = qs.parse(query)
|
const { label, style, icon, iconWidth, labelColor } = qs.parse(query)
|
||||||
const [ subject, status, color ] = pathname.split('/').splice(1)
|
const [subject, status, color] = pathname.split('/').splice(1)
|
||||||
.map(s => qs.unescape(s))
|
.map(s => qs.unescape(s))
|
||||||
|
|
||||||
res.statusCode = 200
|
res.statusCode = 200
|
||||||
|
|
|
@ -4,7 +4,7 @@ const { sanitize, typeAssert } = require('./utils.js')
|
||||||
|
|
||||||
module.exports = ({ status, color, style }) => {
|
module.exports = ({ status, color, style }) => {
|
||||||
typeAssert(typeof status === 'string', '<status> must be string')
|
typeAssert(typeof status === 'string', '<status> must be string')
|
||||||
color = colorPresets[color] || color || colorPresets['blue']
|
color = colorPresets[color] || color || colorPresets.blue
|
||||||
|
|
||||||
const stTextWidth = calcWidth(status)
|
const stTextWidth = calcWidth(status)
|
||||||
const stRectWidth = stTextWidth + 115
|
const stRectWidth = stTextWidth + 115
|
||||||
|
|
Ładowanie…
Reference in New Issue