kopia lustrzana https://github.com/badgen/badgen.net
Use generated static help data
rodzic
54ef4b0f26
commit
63f5bbb0c5
|
@ -1,21 +1,24 @@
|
|||
import path from 'path'
|
||||
import { liveBadgeList } from './badge-list'
|
||||
// import path from 'path'
|
||||
// import { liveBadgeList } from './badge-list'
|
||||
|
||||
const liveBadgeDB = liveBadgeList.reduce((accu, curr) => {
|
||||
const { meta, handlers } = require(path.resolve(__dirname, `../endpoints/${curr}`))
|
||||
const { title, examples, help } = meta
|
||||
accu[curr] = {
|
||||
id: curr,
|
||||
title,
|
||||
examples,
|
||||
routes: Object.keys(handlers),
|
||||
help
|
||||
}
|
||||
return accu
|
||||
}, {})
|
||||
const { live: liveBadges } = require('../static/.gen/badges.json')
|
||||
|
||||
/** not supported on Now */
|
||||
// export const liveBadges = liveBadgeList.reduce((accu, curr) => {
|
||||
// const { meta, handlers } = require(path.resolve(__dirname, `../endpoints/${curr}`))
|
||||
// const { title, examples, help } = meta
|
||||
// accu[curr] = {
|
||||
// id: curr,
|
||||
// title,
|
||||
// examples,
|
||||
// routes: Object.keys(handlers),
|
||||
// help
|
||||
// }
|
||||
// return accu
|
||||
// }, {})
|
||||
|
||||
export default function genHelp (id) {
|
||||
const meta = liveBadgeDB[id]
|
||||
const meta = liveBadges.find(b => b.id === id)
|
||||
|
||||
if (!meta) {
|
||||
return ''
|
||||
|
|
Ładowanie…
Reference in New Issue