Files
shields/services/cpan/cpan-license.service.js
Caleb Cartwright bb6d2b5c78 convert some service classes to static props, run [cookbook coveralls cpan] (#5516)
* 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>
2020-09-12 17:39:01 +00:00

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] })
}
}