Move build badge examples into services/ (#2234)

all-badge-examples is a common cause of merge conflicts. It’s difficult to adjust the badge categorization in that file – or to understand the diff – because it requires moving a block from one point to another. It’s much easier to edit a badge’s category in one place.

This starts the process of breaking up what’s left of that file, following up on the work from #1931. New-style services can only be in one category, which means legacy service examples have to be split along category lines. I split out separate legacy service classes where I could do so easily, leaving behind the ones which require more work, for one reason or another.
This commit is contained in:
Paul Melnikow
2018-10-31 17:32:35 -04:00
committed by GitHub
parent 973eeb0ea7
commit b7ecbd0a0d
74 changed files with 1737 additions and 698 deletions

View File

@@ -6,6 +6,31 @@ const { makeBadgeData: getBadgeData } = require('../../lib/badge-data')
// Bundle size for npm packages.
module.exports = class Bundlephobia extends LegacyService {
static get category() {
return 'size'
}
static get url() {
return {
base: 'bundlephobia',
}
}
static get examples() {
return [
{
title: 'npm bundle size (minified)',
previewUrl: 'min/react',
keywords: ['node'],
},
{
title: 'npm bundle size (minified + gzip)',
previewUrl: 'minzip/react',
keywords: ['node'],
},
]
}
static registerLegacyRouteHandler({ camp, cache }) {
camp.route(
/^\/bundlephobia\/(min|minzip)\/(?:@([^/]+)?\/)?([^/]+)?(?:\/([^/]+)?)?\.(svg|png|gif|jpg|json)?$/,