kopia lustrzana https://github.com/badgen/badgen.net
* feat: migrate /pypi badges * feat: migrate /hackage badges * chore: add comments for cabalfile compabilitypull/601/head
rodzic
34a019ab34
commit
d7adf406b8
|
@ -20,7 +20,6 @@ export const liveBadgeList = [
|
|||
'packagist',
|
||||
'rubygems',
|
||||
'apm',
|
||||
'hackage',
|
||||
'vs-marketplace',
|
||||
'melpa',
|
||||
'maven',
|
||||
|
|
|
@ -2,6 +2,7 @@ import staticBadge from '../pages/api/static'
|
|||
import github from '../pages/api/github'
|
||||
import npm from '../pages/api/npm'
|
||||
import chromeWebStore from '../pages/api/chrome-web-store'
|
||||
import hackage from '../pages/api/hackage'
|
||||
import pypi from '../pages/api/pypi'
|
||||
import runkit from '../pages/api/runkit'
|
||||
import winget from '../pages/api/winget'
|
||||
|
@ -12,6 +13,7 @@ export default {
|
|||
github: github.meta,
|
||||
npm: npm.meta,
|
||||
chromeWebStore: chromeWebStore.meta,
|
||||
hackage: hackage.meta,
|
||||
pypi: pypi.meta,
|
||||
runkit: runkit.meta,
|
||||
winget: winget.meta,
|
||||
|
|
|
@ -45,6 +45,7 @@ const nextConfig = {
|
|||
'/github',
|
||||
'/npm',
|
||||
'/chrome-web-store',
|
||||
'/hackage',
|
||||
'/pypi',
|
||||
'/runkit',
|
||||
'/winget',
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import got from '../libs/got'
|
||||
import { version as v, versionColor } from '../libs/utils'
|
||||
import { createBadgenHandler, PathArgs } from '../libs/create-badgen-handler'
|
||||
import got from '../../libs/got'
|
||||
import { version as v, versionColor } from '../../libs/utils'
|
||||
import { createBadgenHandler, PathArgs } from '../../libs/create-badgen-handler-next'
|
||||
|
||||
export default createBadgenHandler({
|
||||
title: 'Hackage',
|
||||
|
@ -32,14 +32,23 @@ async function handler ({ topic, pkg }: PathArgs) {
|
|||
status: license,
|
||||
color: 'blue'
|
||||
}
|
||||
default:
|
||||
return {
|
||||
subject: 'hackage',
|
||||
status: 'unknown topic',
|
||||
color: 'grey'
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Naive implementation (only parse meta blocks)
|
||||
const parseCabalFile = raw => {
|
||||
return raw.match(/[\w-]+:.+\S+$/gm).reduce((accu, line) => {
|
||||
// this regex needs to support both v1 and v2 for cabalfile
|
||||
const cabalMeta = raw.match(/[\w-]+:.+\S+$/gm).reduce((accu, line) => {
|
||||
const [key, value] = line.split(':')
|
||||
accu[key] = value.trim()
|
||||
accu[key.toLowerCase()] = value.trim()
|
||||
return accu
|
||||
}, {})
|
||||
|
||||
return cabalMeta
|
||||
}
|
|
@ -110,10 +110,6 @@
|
|||
"source": "/gitter/:match*",
|
||||
"destination": "https://v2022.badgen.net/gitter/:match*"
|
||||
},
|
||||
{
|
||||
"source": "/hackage/:match*",
|
||||
"destination": "https://v2022.badgen.net/hackage/:match*"
|
||||
},
|
||||
{
|
||||
"source": "/haxelib/:match*",
|
||||
"destination": "https://v2022.badgen.net/haxelib/:match*"
|
||||
|
|
Ładowanie…
Reference in New Issue