Move remaining badge examples into services/ [cpan] (#2349)

Except NuGet; leaving those for the last pass.
This commit is contained in:
Paul Melnikow
2018-11-19 15:25:34 -05:00
committed by GitHub
parent c9057266ea
commit ccfac2eab3
22 changed files with 1078 additions and 275 deletions

View File

@@ -17,7 +17,108 @@ const {
floorCount: floorCountColor,
} = require('../../lib/color-formatters')
module.exports = class Amo extends LegacyService {
class AmoDownloads extends LegacyService {
static get category() {
return 'downloads'
}
static get route() {
return {
base: 'amo/d',
}
}
static get examples() {
return [
{
title: 'Mozilla Add-on',
previewUrl: 'dustman',
keywords: ['amo', 'firefox'],
},
]
}
static registerLegacyRouteHandler() {}
}
class AmoVersion extends LegacyService {
static get category() {
return 'version'
}
static get route() {
return {
base: 'amo/v',
}
}
static get examples() {
return [
{
title: 'Mozilla Add-on',
previewUrl: 'dustman',
keywords: ['amo', 'firefox'],
},
]
}
static registerLegacyRouteHandler() {}
}
class AmoRating extends LegacyService {
static get category() {
return 'rating'
}
static get route() {
return {
base: 'amo',
}
}
static get examples() {
return [
{
title: 'Mozilla Add-on',
previewUrl: 'rating/dustman',
keywords: ['amo', 'firefox'],
},
{
title: 'Mozilla Add-on',
previewUrl: 'stars/dustman',
keywords: ['amo', 'firefox'],
},
]
}
static registerLegacyRouteHandler() {}
}
class AmoUsers extends LegacyService {
static get category() {
return 'other'
}
static get route() {
return {
base: 'amo/users',
}
}
static get examples() {
return [
{
title: 'Mozilla Add-on',
previewUrl: 'dustman',
keywords: ['amo', 'firefox'],
},
]
}
static registerLegacyRouteHandler() {}
}
class Amo extends LegacyService {
static registerLegacyRouteHandler({ camp, cache }) {
camp.route(
/^\/amo\/(v|d|rating|stars|users)\/(.*)\.(svg|png|gif|jpg|json)$/,
@@ -90,3 +191,11 @@ module.exports = class Amo extends LegacyService {
)
}
}
module.exports = {
AmoDownloads,
AmoVersion,
AmoRating,
AmoUsers,
Amo,
}