* Build(deps-dev): bump prettier from 2.1.2 to 2.2.1 Bumps [prettier](https://github.com/prettier/prettier) from 2.1.2 to 2.2.1. - [Release notes](https://github.com/prettier/prettier/releases) - [Changelog](https://github.com/prettier/prettier/blob/master/CHANGELOG.md) - [Commits](https://github.com/prettier/prettier/compare/2.1.2...2.2.1) Signed-off-by: dependabot-preview[bot] <support@dependabot.com> * run new prettier Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com> Co-authored-by: chris48s <chris.shaw480@gmail.com> Co-authored-by: repo-ranger[bot] <39074581+repo-ranger[bot]@users.noreply.github.com>
41 lines
930 B
JavaScript
41 lines
930 B
JavaScript
'use strict'
|
|
|
|
const { metric } = require('../text-formatters')
|
|
const { floorCount: floorCountColor } = require('../color-formatters')
|
|
const { BasePuppetForgeUsersService } = require('./puppetforge-base')
|
|
|
|
module.exports = class PuppetForgeModuleCountService extends (
|
|
BasePuppetForgeUsersService
|
|
) {
|
|
static category = 'other'
|
|
|
|
static route = {
|
|
base: 'puppetforge/mc',
|
|
pattern: ':user',
|
|
}
|
|
|
|
static examples = [
|
|
{
|
|
title: 'Puppet Forge modules by user',
|
|
namedParams: {
|
|
user: 'camptocamp',
|
|
},
|
|
staticPreview: this.render({ modules: 60 }),
|
|
},
|
|
]
|
|
|
|
static defaultBadgeData = { label: 'modules' }
|
|
|
|
static render({ modules }) {
|
|
return {
|
|
message: metric(modules),
|
|
color: floorCountColor(modules, 5, 10, 50),
|
|
}
|
|
}
|
|
|
|
async handle({ user }) {
|
|
const data = await this.fetch({ user })
|
|
return this.constructor.render({ modules: data.module_count })
|
|
}
|
|
}
|