* refactor(cookbook): convert to static props * refactor(coveralls): convert to static props * refactor(coverity): convert to static props * refactor(cpan): convert to static props Co-authored-by: repo-ranger[bot] <39074581+repo-ranger[bot]@users.noreply.github.com>
24 lines
607 B
JavaScript
24 lines
607 B
JavaScript
'use strict'
|
|
|
|
const { renderVersionBadge } = require('../version')
|
|
const BaseCpanService = require('./cpan')
|
|
|
|
module.exports = class CpanVersion extends BaseCpanService {
|
|
static category = 'version'
|
|
static route = { base: 'cpan/v', pattern: ':packageName' }
|
|
|
|
static examples = [
|
|
{
|
|
title: 'CPAN',
|
|
namedParams: { packageName: 'Config-Augeas' },
|
|
staticPreview: renderVersionBadge({ version: '1.000' }),
|
|
keywords: ['perl'],
|
|
},
|
|
]
|
|
|
|
async handle({ packageName }) {
|
|
const { version } = await this.fetch({ packageName })
|
|
return renderVersionBadge({ version })
|
|
}
|
|
}
|