2019-05-26 04:28:59 +00:00
|
|
|
import path from 'path'
|
|
|
|
import { examples as staticBadgeExamples } from '../endpoints/badge'
|
|
|
|
|
|
|
|
const rel = (...args) => path.resolve(__dirname, ...args)
|
|
|
|
|
2019-06-01 03:26:41 +00:00
|
|
|
// sort live badge manually
|
|
|
|
export const liveBadgeList = [
|
2019-05-31 02:07:31 +00:00
|
|
|
// source control
|
2019-05-26 04:28:59 +00:00
|
|
|
'github',
|
2019-05-31 02:07:31 +00:00
|
|
|
// release registries
|
2019-05-26 07:54:24 +00:00
|
|
|
'npm',
|
2019-05-31 02:07:31 +00:00
|
|
|
'david',
|
2019-05-31 06:11:48 +00:00
|
|
|
'packagephobia',
|
2019-05-31 06:21:26 +00:00
|
|
|
'bundlephobia',
|
2019-05-31 06:26:16 +00:00
|
|
|
'crates',
|
2019-05-31 06:35:44 +00:00
|
|
|
'docker',
|
|
|
|
'homebrew',
|
2019-05-31 06:46:43 +00:00
|
|
|
'chrome-web-store',
|
2019-05-26 04:28:59 +00:00
|
|
|
'amo',
|
2019-05-31 06:54:08 +00:00
|
|
|
'pypi',
|
2019-05-31 07:02:09 +00:00
|
|
|
'nuget',
|
2019-05-31 07:27:27 +00:00
|
|
|
'packagist',
|
2019-05-31 07:47:16 +00:00
|
|
|
'rubygems',
|
2019-05-26 04:40:32 +00:00
|
|
|
'apm',
|
2019-05-31 07:59:03 +00:00
|
|
|
'hackage',
|
2019-05-31 08:03:21 +00:00
|
|
|
'vs-marketplace',
|
2019-05-31 02:07:31 +00:00
|
|
|
// CI
|
2019-05-31 08:11:24 +00:00
|
|
|
'travis',
|
2019-05-31 08:21:34 +00:00
|
|
|
'circleci',
|
2019-05-31 02:07:31 +00:00
|
|
|
'appveyor',
|
2019-05-31 08:36:27 +00:00
|
|
|
'codecov',
|
2019-05-31 09:26:28 +00:00
|
|
|
'coveralls',
|
2019-05-31 09:35:46 +00:00
|
|
|
'codeclimate',
|
2019-06-01 05:30:55 +00:00
|
|
|
'azure-pipelines',
|
2019-06-01 03:34:47 +00:00
|
|
|
// quality & metrics
|
2019-05-31 12:10:30 +00:00
|
|
|
'lgtm',
|
2019-06-01 03:26:41 +00:00
|
|
|
'uptime-robot',
|
2019-06-01 03:34:47 +00:00
|
|
|
'xo',
|
2019-06-01 04:16:52 +00:00
|
|
|
'badgesize',
|
2019-06-01 04:51:10 +00:00
|
|
|
'jsdelivr',
|
2019-06-21 13:45:26 +00:00
|
|
|
'dependabot',
|
2019-05-31 02:07:31 +00:00
|
|
|
// utilities
|
2019-06-01 05:21:10 +00:00
|
|
|
'opencollective',
|
|
|
|
'keybase',
|
2019-06-01 05:26:15 +00:00
|
|
|
'twitter',
|
2019-06-02 03:47:11 +00:00
|
|
|
'runkit',
|
|
|
|
'https',
|
2019-05-26 04:28:59 +00:00
|
|
|
]
|
|
|
|
|
2019-06-01 06:37:20 +00:00
|
|
|
export async function loadBadgeMeta () {
|
|
|
|
const liveBadgeExamples = await Promise.all(liveBadgeList.map(async id => {
|
|
|
|
const { meta, handlers } = await import(rel('../endpoints', id))
|
|
|
|
const { title, examples, help } = meta
|
|
|
|
|
2019-05-26 04:28:59 +00:00
|
|
|
return {
|
2019-06-01 06:37:20 +00:00
|
|
|
id,
|
|
|
|
title,
|
|
|
|
examples,
|
|
|
|
routes: Object.keys(handlers),
|
|
|
|
help
|
2019-05-26 04:28:59 +00:00
|
|
|
}
|
|
|
|
}))
|
|
|
|
|
|
|
|
return {
|
|
|
|
live: liveBadgeExamples,
|
|
|
|
static: staticBadgeExamples
|
|
|
|
}
|
|
|
|
}
|