badgen.net/libs/badge-list.ts

80 wiersze
1.3 KiB
TypeScript
Czysty Zwykły widok Historia

2019-05-26 04:28:59 +00:00
import path from 'path'
2023-02-05 11:20:03 +00:00
import staticBadges from '../pages/api/static'
2019-05-26 04:28:59 +00:00
const rel = (...args) => path.resolve(__dirname, ...args)
2019-06-01 03:26:41 +00:00
// sort live badge manually
export const liveBadgeList = [
2023-02-05 11:20:03 +00:00
// // source control
// 'github',
2023-07-25 15:24:30 +00:00
// 'gitlab',
// release registries
'homebrew',
'nuget',
'packagist',
'rubygems',
'melpa',
'maven',
'cocoapods',
'haxelib',
'opam',
'cpan',
'cran',
'ctan',
'dub',
'elm-package',
'scoop',
'f-droid',
'shards',
'wapm',
'snapcraft',
// CI
'appveyor',
'codacy',
'azure-pipelines',
// quality & metrics
'snyk',
'deepscan',
'uptime-robot',
'badgesize',
'jsdelivr',
// social
'devrant',
'reddit',
// chat
'gitter',
// utilities
'opencollective',
'keybase',
'twitter',
'mastodon',
'tidelift',
'jenkins',
'liberapay',
2019-05-26 04:28:59 +00:00
]
2023-07-28 14:35:25 +00:00
export async function loadBadgeMeta() {
2019-06-01 06:37:20 +00:00
const liveBadgeExamples = await Promise.all(liveBadgeList.map(async id => {
const mod = await import(rel('../api-', id))
const { title, examples, handlers } = mod.default.meta
2019-06-01 06:37:20 +00:00
2019-05-26 04:28:59 +00:00
return {
2019-06-01 06:37:20 +00:00
id,
title,
examples,
routes: Object.keys(handlers),
2019-05-26 04:28:59 +00:00
}
}))
const statics = {
title: staticBadges.meta.title,
examples: staticBadges.meta.examples,
routes: Object.keys(staticBadges.meta.handlers)
}
2019-05-26 04:28:59 +00:00
return {
live: liveBadgeExamples,
static: [statics]
2019-05-26 04:28:59 +00:00
}
}