* 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>
31 lines
689 B
JavaScript
31 lines
689 B
JavaScript
'use strict'
|
|
|
|
const BaseCpanService = require('./cpan')
|
|
|
|
module.exports = class CpanLicense extends BaseCpanService {
|
|
static category = 'license'
|
|
static route = { base: 'cpan/l', pattern: ':packageName' }
|
|
|
|
static examples = [
|
|
{
|
|
title: 'CPAN',
|
|
namedParams: { packageName: 'Config-Augeas' },
|
|
staticPreview: this.render({ license: 'lgpl_2_1' }),
|
|
keywords: ['perl'],
|
|
},
|
|
]
|
|
|
|
static render({ license }) {
|
|
return {
|
|
label: 'license',
|
|
message: license,
|
|
color: 'blue',
|
|
}
|
|
}
|
|
|
|
async handle({ packageName }) {
|
|
const data = await this.fetch({ packageName })
|
|
return this.constructor.render({ license: data.license[0] })
|
|
}
|
|
}
|