* Added sourceforge last-commit badge * Added sourceforge commit-count badge * Added sourceforge languages badge * Added sourceforge contributors badge * Added sourceforge translations badge * Added sourceforge platform badge * Fix SourceForge services ClassName * Fixed JoiSchema + Added BaseSourceForgeService + Fixed last-commit and commit-count
44 lines
989 B
JavaScript
44 lines
989 B
JavaScript
import Joi from 'joi'
|
|
import { renderContributorBadge } from '../contributor-count.js'
|
|
import BaseSourceForgeService from './sourceforge-base.js'
|
|
|
|
const schema = Joi.object({
|
|
developers: Joi.array().required(),
|
|
}).required()
|
|
|
|
export default class SourceforgeContributors extends BaseSourceForgeService {
|
|
static category = 'activity'
|
|
|
|
static route = {
|
|
base: 'sourceforge/contributors',
|
|
pattern: ':project',
|
|
}
|
|
|
|
static examples = [
|
|
{
|
|
title: 'SourceForge contributors',
|
|
namedParams: {
|
|
project: 'guitarix',
|
|
},
|
|
staticPreview: this.render({
|
|
contributorCount: 9,
|
|
}),
|
|
},
|
|
]
|
|
|
|
static defaultBadgeData = { label: 'contributors' }
|
|
|
|
static render({ contributorCount }) {
|
|
return renderContributorBadge({
|
|
contributorCount,
|
|
})
|
|
}
|
|
|
|
async handle({ project }) {
|
|
const body = await this.fetch({ project, schema })
|
|
return this.constructor.render({
|
|
contributorCount: body.developers.length,
|
|
})
|
|
}
|
|
}
|