kopia lustrzana https://github.com/badgen/badgen.net
feat: deprecated /david
rodzic
20833b3420
commit
6d2ab69b74
|
@ -1,65 +0,0 @@
|
|||
import got from '../libs/got'
|
||||
import { createBadgenHandler, PathArgs } from '../libs/create-badgen-handler'
|
||||
|
||||
export default createBadgenHandler({
|
||||
title: 'David DM',
|
||||
examples: {
|
||||
'/david/dep/zeit/pkg': 'dependencies',
|
||||
'/david/dev/zeit/pkg': 'dev dependencies',
|
||||
'/david/peer/epoberezkin/ajv-keywords': 'peer dependencies',
|
||||
'/david/optional/epoberezkin/ajv-keywords': 'optional dependencies',
|
||||
'/david/dep/babel/babel/packages/babel-cli': 'dependencies (sub path)',
|
||||
},
|
||||
handlers: {
|
||||
'/david/:topic/:owner/:repo/:path*': handler
|
||||
}
|
||||
})
|
||||
|
||||
const statusInfo = {
|
||||
insecure: ['insecure', 'red'],
|
||||
outofdate: ['out of date', 'orange'],
|
||||
notsouptodate: ['up to date', 'yellow'],
|
||||
uptodate: ['up to date', 'green'],
|
||||
none: ['none', 'green']
|
||||
}
|
||||
|
||||
async function handler ({ topic, owner, repo, path = '' }: PathArgs) {
|
||||
const prefix = {
|
||||
dep: '',
|
||||
dev: 'dev-',
|
||||
peer: 'peer-',
|
||||
optional: 'optional-'
|
||||
}[topic]
|
||||
|
||||
const endpoint = `https://david-dm.org/${owner}/${repo}/${prefix}info.json`
|
||||
const { status } = await got(endpoint, {
|
||||
searchParams: { path }
|
||||
}).json<any>()
|
||||
|
||||
switch (topic) {
|
||||
case 'dep':
|
||||
return {
|
||||
subject: 'dependencies',
|
||||
status: statusInfo[status][0],
|
||||
color: statusInfo[status][1]
|
||||
}
|
||||
case 'dev':
|
||||
return {
|
||||
subject: 'devDependencies',
|
||||
status: statusInfo[status][0],
|
||||
color: statusInfo[status][1]
|
||||
}
|
||||
case 'peer':
|
||||
return {
|
||||
subject: 'peerDependencies',
|
||||
status: statusInfo[status][0],
|
||||
color: statusInfo[status][1]
|
||||
}
|
||||
case 'optional':
|
||||
return {
|
||||
subject: 'optionalDependencies',
|
||||
status: statusInfo[status][0],
|
||||
color: statusInfo[status][1]
|
||||
}
|
||||
}
|
||||
}
|
|
@ -9,7 +9,6 @@ export const liveBadgeList = [
|
|||
// 'github',
|
||||
'gitlab',
|
||||
// release registries
|
||||
'david',
|
||||
'packagephobia',
|
||||
'crates',
|
||||
'docker',
|
||||
|
|
|
@ -55,6 +55,7 @@ const nextConfig = {
|
|||
// discontinued
|
||||
'/apm',
|
||||
'/lgtm',
|
||||
'/david',
|
||||
]
|
||||
|
||||
badgeApis.forEach(badge => {
|
||||
|
|
|
@ -0,0 +1,30 @@
|
|||
import { createBadgenHandler, PathArgs } from '../../libs/create-badgen-handler-next'
|
||||
|
||||
const help = `
|
||||
## Discontinued
|
||||
|
||||
Please refer to [https://github.com/alanshaw/david](https://github.com/alanshaw/david) for more info.
|
||||
`
|
||||
|
||||
export default createBadgenHandler({
|
||||
title: 'David DM',
|
||||
examples: {
|
||||
'/david/dep/zeit/pkg': 'dependencies',
|
||||
'/david/dev/zeit/pkg': 'dev dependencies',
|
||||
'/david/peer/epoberezkin/ajv-keywords': 'peer dependencies',
|
||||
'/david/optional/epoberezkin/ajv-keywords': 'optional dependencies',
|
||||
'/david/dep/babel/babel/packages/babel-cli': 'dependencies (sub path)',
|
||||
},
|
||||
handlers: {
|
||||
'/david/:topic/:owner/:repo/:path*': handler
|
||||
},
|
||||
help
|
||||
})
|
||||
|
||||
async function handler ({ topic, owner, repo, path = '' }: PathArgs) {
|
||||
return {
|
||||
subject: 'david badge',
|
||||
status: 'discontinued',
|
||||
color: 'grey',
|
||||
}
|
||||
}
|
|
@ -58,10 +58,6 @@
|
|||
"source": "/ctan/:match*",
|
||||
"destination": "https://v2022.badgen.net/ctan/:match*"
|
||||
},
|
||||
{
|
||||
"source": "/david/:match*",
|
||||
"destination": "https://v2022.badgen.net/david/:match*"
|
||||
},
|
||||
{
|
||||
"source": "/deepscan/:match*",
|
||||
"destination": "https://v2022.badgen.net/deepscan/:match*"
|
||||
|
|
Ładowanie…
Reference in New Issue