Update standard to 14 and fix styles

pull/61/head
amio 2019-08-21 22:58:25 +08:00
rodzic 7664764aed
commit db29bba8d7
4 zmienionych plików z 843 dodań i 543 usunięć

1376
package-lock.json wygenerowano

Plik diff jest za duży Load Diff

Wyświetl plik

@ -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"
} }
} }

Wyświetl plik

@ -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

Wyświetl plik

@ -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