diff --git a/lib/all-badge-examples.js b/lib/all-badge-examples.js index 6372ca840bafd300e59a99f913ab78d9050f3585..ef50170cef290abbf0999c70a7ecb649e4afce7c 100644 --- a/lib/all-badge-examples.js +++ b/lib/all-badge-examples.js @@ -1,9 +1,6 @@ 'use strict' const { loadServiceClasses } = require('../services') -const { - documentation: githubDoc, -} = require('../services/github/github-helpers') const allBadgeExamples = [ { @@ -32,27 +29,7 @@ const allBadgeExamples = [ id: 'size', name: 'Size', }, - examples: [ - { - title: 'GitHub code size in bytes', - previewUrl: '/github/languages/code-size/badges/shields.svg', - keywords: ['GitHub', 'byte', 'code', 'size'], - documentation: githubDoc, - }, - { - title: 'GitHub repo size in bytes', - previewUrl: '/github/repo-size/badges/shields.svg', - keywords: ['GitHub', 'repo', 'size'], - documentation: githubDoc, - }, - { - title: 'GitHub file size', - previewUrl: - '/github/size/webcaetano/craft/build/phaser-craft.min.js.svg', - keywords: ['GitHub', 'file', 'size'], - documentation: githubDoc, - }, - ], + examples: [], }, { category: { @@ -60,42 +37,6 @@ const allBadgeExamples = [ name: 'Downloads', }, examples: [ - { - title: 'GitHub All Releases', - previewUrl: '/github/downloads/atom/atom/total.svg', - keywords: ['github'], - documentation: githubDoc, - }, - { - title: 'GitHub Releases', - previewUrl: '/github/downloads/atom/atom/latest/total.svg', - keywords: ['github'], - documentation: githubDoc, - }, - { - title: 'GitHub Pre-Releases', - previewUrl: '/github/downloads-pre/atom/atom/latest/total.svg', - keywords: ['github'], - documentation: githubDoc, - }, - { - title: 'GitHub Releases (by Release)', - previewUrl: '/github/downloads/atom/atom/v0.190.0/total.svg', - keywords: ['github'], - documentation: githubDoc, - }, - { - title: 'GitHub Releases (by Asset)', - previewUrl: '/github/downloads/atom/atom/latest/atom-amd64.deb.svg', - keywords: ['github'], - documentation: githubDoc, - }, - { - title: 'GitHub Pre-Releases (by Asset)', - previewUrl: '/github/downloads-pre/atom/atom/latest/atom-amd64.deb.svg', - keywords: ['github'], - documentation: githubDoc, - }, { title: 'Chocolatey', previewUrl: '/chocolatey/dt/scriptcs.svg', @@ -167,122 +108,7 @@ const allBadgeExamples = [ id: 'issue-tracking', name: 'Issue Tracking', }, - examples: [ - { - title: 'GitHub issues', - previewUrl: '/github/issues/badges/shields.svg', - keywords: ['GitHub', 'issue'], - documentation: githubDoc, - }, - { - title: 'GitHub issues', - previewUrl: '/github/issues-raw/badges/shields.svg', - keywords: ['GitHub', 'issue'], - documentation: githubDoc, - }, - { - title: 'GitHub pull requests', - previewUrl: '/github/issues-pr/cdnjs/cdnjs.svg', - keywords: ['GitHub', 'pullrequest', 'pr'], - documentation: githubDoc, - }, - { - title: 'GitHub pull requests', - previewUrl: '/github/issues-pr-raw/cdnjs/cdnjs.svg', - keywords: ['GitHub', 'pullrequest', 'pr'], - documentation: githubDoc, - }, - { - title: 'GitHub closed issues', - previewUrl: '/github/issues-closed/badges/shields.svg', - keywords: ['GitHub', 'issue'], - documentation: githubDoc, - }, - { - title: 'GitHub closed issues', - previewUrl: '/github/issues-closed-raw/badges/shields.svg', - keywords: ['GitHub', 'issue'], - documentation: githubDoc, - }, - { - title: 'GitHub closed pull requests', - previewUrl: '/github/issues-pr-closed/cdnjs/cdnjs.svg', - keywords: ['GitHub', 'pullrequest', 'pr'], - documentation: githubDoc, - }, - { - title: 'GitHub closed pull requests', - previewUrl: '/github/issues-pr-closed-raw/cdnjs/cdnjs.svg', - keywords: ['GitHub', 'pullrequest', 'pr'], - documentation: githubDoc, - }, - { - title: 'GitHub issues by-label', - previewUrl: '/github/issues/badges/shields/service-badge.svg', - keywords: ['GitHub', 'issue', 'label'], - documentation: githubDoc, - }, - { - title: 'GitHub issues by-label', - previewUrl: '/github/issues-raw/badges/shields/service-badge.svg', - keywords: ['GitHub', 'issue', 'label'], - documentation: githubDoc, - }, - { - title: 'GitHub pull requests by-label', - previewUrl: '/github/issues-pr/badges/shields/service-badge.svg', - keywords: ['GitHub', 'pullrequests', 'label'], - documentation: githubDoc, - }, - { - title: 'GitHub pull requests by-label', - previewUrl: '/github/issues-pr-raw/badges/shields/service-badge.svg', - keywords: ['GitHub', 'pullrequests', 'label'], - documentation: githubDoc, - }, - { - title: 'GitHub issue/pull request state', - previewUrl: '/github/issues/detail/s/badges/shields/979.svg', - keywords: ['GitHub', 'issue', 'pullrequest', 'detail'], - documentation: githubDoc, - }, - { - title: 'GitHub issue/pull request title', - previewUrl: '/github/issues/detail/title/badges/shields/1290.svg', - keywords: ['GitHub', 'issue', 'pullrequest', 'detail'], - documentation: githubDoc, - }, - { - title: 'GitHub issue/pull request author', - previewUrl: '/github/issues/detail/u/badges/shields/979.svg', - keywords: ['GitHub', 'issue', 'pullrequest', 'detail'], - documentation: githubDoc, - }, - { - title: 'GitHub issue/pull request label', - previewUrl: '/github/issues/detail/label/badges/shields/979.svg', - keywords: ['GitHub', 'issue', 'pullrqeuest', 'detail'], - documentation: githubDoc, - }, - { - title: 'GitHub issue/pull request comments', - previewUrl: '/github/issues/detail/comments/badges/shields/979.svg', - keywords: ['GitHub', 'issue', 'pullrequest', 'detail'], - documentation: githubDoc, - }, - { - title: 'GitHub issue/pull request age', - previewUrl: '/github/issues/detail/age/badges/shields/979.svg', - keywords: ['GitHub', 'issue', 'pullrequest', 'detail'], - documentation: githubDoc, - }, - { - title: 'GitHub issue/pull request last update', - previewUrl: '/github/issues/detail/last-update/badges/shields/979.svg', - keywords: ['GitHub', 'issue', 'pullrequest', 'detail'], - documentation: githubDoc, - }, - ], + examples: [], }, { category: { @@ -290,12 +116,6 @@ const allBadgeExamples = [ name: 'License', }, examples: [ - { - title: 'GitHub', - previewUrl: '/github/license/mashape/apistatus.svg', - keywords: ['GitHub', 'license'], - documentation: githubDoc, - }, { title: 'Crates.io', previewUrl: '/crates/l/rustc-serialize.svg', @@ -409,29 +229,7 @@ const allBadgeExamples = [ id: 'social', name: 'Social', }, - examples: [ - { - title: 'GitHub forks', - previewUrl: '/github/forks/badges/shields.svg?style=social&label=Fork', - documentation: githubDoc, - }, - { - title: 'GitHub stars', - previewUrl: '/github/stars/badges/shields.svg?style=social&label=Stars', - documentation: githubDoc, - }, - { - title: 'GitHub watchers', - previewUrl: - '/github/watchers/badges/shields.svg?style=social&label=Watch', - documentation: githubDoc, - }, - { - title: 'GitHub followers', - previewUrl: '/github/followers/espadrine.svg?style=social&label=Follow', - documentation: githubDoc, - }, - ], + examples: [], }, { category: { @@ -463,54 +261,6 @@ const allBadgeExamples = [ previewUrl: '/packagist/vpre/symfony/symfony.svg', keywords: ['PHP'], }, - { - title: 'GitHub tag (latest SemVer)', - previewUrl: '/github/tag/expressjs/express.svg', - documentation: githubDoc, - }, - { - title: 'GitHub tag (latest SemVer pre-release)', - previewUrl: '/github/tag-pre/expressjs/express.svg', - documentation: githubDoc, - }, - { - title: 'GitHub tag (latest by date)', - previewUrl: '/github/tag-date/expressjs/express.svg', - documentation: githubDoc, - }, - { - title: 'GitHub package version', - previewUrl: '/github/package-json/v/badges/shields.svg', - documentation: githubDoc, - }, - { - title: 'GitHub manifest version', - previewUrl: '/github/manifest-json/v/RedSparr0w/IndieGala-Helper.svg', - documentation: githubDoc, - }, - { - title: 'GitHub release', - previewUrl: '/github/release/qubyte/rubidium.svg', - documentation: githubDoc, - }, - { - title: 'GitHub (pre-)release', - previewUrl: '/github/release-pre/qubyte/rubidium.svg', - documentation: githubDoc, - }, - { - title: 'GitHub commits', - previewUrl: '/github/commits-since/SubtitleEdit/subtitleedit/3.4.7.svg', - keywords: ['GitHub', 'commit'], - documentation: githubDoc, - }, - { - title: 'GitHub commits (since latest release)', - previewUrl: - '/github/commits-since/SubtitleEdit/subtitleedit/latest.svg', - keywords: ['GitHub', 'commit'], - documentation: githubDoc, - }, { title: 'NuGet', previewUrl: '/nuget/v/Nuget.Core.svg', @@ -625,67 +375,6 @@ const allBadgeExamples = [ name: 'Other', }, examples: [ - { - title: 'GitHub Release Date', - previewUrl: '/github/release-date/SubtitleEdit/subtitleedit.svg', - keywords: ['GitHub', 'release', 'date'], - documentation: githubDoc, - }, - { - title: 'GitHub (Pre-)Release Date', - previewUrl: '/github/release-date-pre/Cockatrice/Cockatrice.svg', - keywords: ['GitHub', 'release', 'date'], - documentation: githubDoc, - }, - { - title: 'GitHub commit merge status', - previewUrl: - '/github/commit-status/badges/shields/master/5d4ab86b1b5ddfb3c4a70a70bd19932c52603b8c.svg', - keywords: ['GitHub', 'commit', 'branch', 'merge'], - documentation: githubDoc, - }, - { - title: 'GitHub contributors', - previewUrl: '/github/contributors/cdnjs/cdnjs.svg', - keywords: ['GitHub', 'contributor'], - documentation: githubDoc, - }, - { - title: 'GitHub search hit counter', - previewUrl: '/github/search/torvalds/linux/goto.svg', - keywords: ['GitHub', 'search', 'hit', 'counter'], - documentation: githubDoc, - }, - { - title: 'GitHub commit activity the past week, 4 weeks, year', - previewUrl: '/github/commit-activity/y/eslint/eslint.svg', - keywords: ['GitHub', 'commit', 'commits', 'activity'], - documentation: githubDoc, - }, - { - title: 'GitHub last commit', - previewUrl: '/github/last-commit/google/skia.svg', - keywords: ['GitHub', 'last', 'latest', 'commit'], - documentation: githubDoc, - }, - { - title: 'GitHub last commit (branch)', - previewUrl: '/github/last-commit/google/skia/infra/config.svg', - keywords: ['GitHub', 'last', 'latest', 'commit'], - documentation: githubDoc, - }, - { - title: 'GitHub top language', - previewUrl: '/github/languages/top/badges/shields.svg', - keywords: ['GitHub', 'top', 'language'], - documentation: githubDoc, - }, - { - title: 'GitHub language count', - previewUrl: '/github/languages/count/badges/shields.svg', - keywords: ['GitHub', 'language', 'count'], - documentation: githubDoc, - }, { title: 'Puppet Forge', previewUrl: '/puppetforge/e/camptocamp/openssl.svg', diff --git a/services/github/github-commit-activity.service.js b/services/github/github-commit-activity.service.js index df0dcda677f44312536dbd7187cb5b881cb4dc0c..7bc93cd87b9411c5ba8f9a9af97bcfb67451244f 100644 --- a/services/github/github-commit-activity.service.js +++ b/services/github/github-commit-activity.service.js @@ -7,10 +7,32 @@ const { } = require('../../lib/badge-data') const { metric } = require('../../lib/text-formatters') const { + documentation, checkErrorResponse: githubCheckErrorResponse, } = require('./github-helpers') module.exports = class GithubCommitActivity extends LegacyService { + static get category() { + return 'version' + } + + static get route() { + return { + base: 'github/commit-activity', + } + } + + static get examples() { + return [ + { + title: 'GitHub commit activity the past week, 4 weeks, year', + previewUrl: 'y/eslint/eslint', + keywords: ['GitHub', 'commit', 'commits', 'activity'], + documentation, + }, + ] + } + static registerLegacyRouteHandler({ camp, cache, githubApiProvider }) { camp.route( /^\/github\/commit-activity\/(y|4w|w)\/([^/]+)\/([^/]+)\.(svg|png|gif|jpg|json)$/, diff --git a/services/github/github-commit-status.service.js b/services/github/github-commit-status.service.js index 756519649514fdf4a82435d13940be9b37759de6..be8767a4bd1400ce21116d5aa4839ae585ff7b8f 100644 --- a/services/github/github-commit-status.service.js +++ b/services/github/github-commit-status.service.js @@ -3,10 +3,33 @@ const LegacyService = require('../legacy-service') const { makeBadgeData: getBadgeData } = require('../../lib/badge-data') const { + documentation, checkErrorResponse: githubCheckErrorResponse, } = require('./github-helpers') module.exports = class GithubCommitStatus extends LegacyService { + static get category() { + return 'other' + } + + static get route() { + return { + base: 'github/commit-status', + } + } + + static get examples() { + return [ + { + title: 'GitHub commit merge status', + previewUrl: + 'badges/shields/master/5d4ab86b1b5ddfb3c4a70a70bd19932c52603b8c', + keywords: ['GitHub', 'commit', 'branch', 'merge'], + documentation, + }, + ] + } + static registerLegacyRouteHandler({ camp, cache, githubApiProvider }) { camp.route( /^\/github\/commit-status\/([^/]+)\/([^/]+)\/([^/]+)\/([^/]+)\.(svg|png|gif|jpg|json)$/, diff --git a/services/github/github-commits-since.service.js b/services/github/github-commits-since.service.js index 2414496aad9333a4c310f7eaee32ac6ae93a5473..2d7954ee1b963538cee4401fc0a91706ee4ceeda 100644 --- a/services/github/github-commits-since.service.js +++ b/services/github/github-commits-since.service.js @@ -6,8 +6,36 @@ const { makeLabel: getLabel, makeLogo: getLogo, } = require('../../lib/badge-data') +const { documentation } = require('./github-helpers') module.exports = class GithubCommitsSince extends LegacyService { + static get category() { + return 'version' + } + + static get route() { + return { + base: 'github/commits-since', + } + } + + static get examples() { + return [ + { + title: 'GitHub commits', + previewUrl: 'SubtitleEdit/subtitleedit/3.4.7', + keywords: ['GitHub', 'commit'], + documentation, + }, + { + title: 'GitHub commits (since latest release)', + previewUrl: 'SubtitleEdit/subtitleedit/latest', + keywords: ['GitHub', 'commit'], + documentation, + }, + ] + } + static registerLegacyRouteHandler({ camp, cache, githubApiProvider }) { camp.route( /^\/github\/commits-since\/([^/]+)\/([^/]+)\/([^/]+)\.(svg|png|gif|jpg|json)$/, diff --git a/services/github/github-contributors.service.js b/services/github/github-contributors.service.js index 4fb9687b6b2d6a1351e2ee87fcabe1b87afc862f..ff7367ae59943e61f82ad41caa644a1ad9ff135a 100644 --- a/services/github/github-contributors.service.js +++ b/services/github/github-contributors.service.js @@ -7,10 +7,32 @@ const { } = require('../../lib/badge-data') const { metric } = require('../../lib/text-formatters') const { + documentation, checkErrorResponse: githubCheckErrorResponse, } = require('./github-helpers') module.exports = class GithubContributors extends LegacyService { + static get category() { + return 'other' + } + + static get route() { + return { + base: 'github', + } + } + + static get examples() { + return [ + { + title: 'GitHub contributors', + previewUrl: 'contributors/cdnjs/cdnjs', + keywords: ['GitHub', 'contributor'], + documentation, + }, + ] + } + static registerLegacyRouteHandler({ camp, cache, githubApiProvider }) { camp.route( /^\/github\/contributors(-anon)?\/([^/]+)\/([^/]+)\.(svg|png|gif|jpg|json)$/, diff --git a/services/github/github-downloads.service.js b/services/github/github-downloads.service.js index 65c4f1e5be6acb098b7474e0a885637f4b48a815..f4cc345ed175b0e5654e7210e27146697b6da75f 100644 --- a/services/github/github-downloads.service.js +++ b/services/github/github-downloads.service.js @@ -7,10 +7,62 @@ const { } = require('../../lib/badge-data') const { metric } = require('../../lib/text-formatters') const { + documentation, checkErrorResponse: githubCheckErrorResponse, } = require('./github-helpers') module.exports = class GithubDownloads extends LegacyService { + static get category() { + return 'downloads' + } + + static get route() { + return { + base: 'github', + } + } + + static get examples() { + return [ + { + title: 'GitHub All Releases', + previewUrl: 'downloads/atom/atom/total', + keywords: ['github'], + documentation, + }, + { + title: 'GitHub Releases', + previewUrl: 'downloads/atom/atom/latest/total', + keywords: ['github'], + documentation, + }, + { + title: 'GitHub Pre-Releases', + previewUrl: 'downloads-pre/atom/atom/latest/total', + keywords: ['github'], + documentation, + }, + { + title: 'GitHub Releases (by Release)', + previewUrl: 'downloads/atom/atom/v0.190.0/total', + keywords: ['github'], + documentation, + }, + { + title: 'GitHub Releases (by Asset)', + previewUrl: 'downloads/atom/atom/latest/atom-amd64.deb', + keywords: ['github'], + documentation, + }, + { + title: 'GitHub Pre-Releases (by Asset)', + previewUrl: 'downloads-pre/atom/atom/latest/atom-amd64.deb', + keywords: ['github'], + documentation, + }, + ] + } + static registerLegacyRouteHandler({ camp, cache, githubApiProvider }) { camp.route( /^\/github\/(downloads|downloads-pre)\/([^/]+)\/([^/]+)(\/.+)?\/([^/]+)\.(svg|png|gif|jpg|json)$/, diff --git a/services/github/github-followers.service.js b/services/github/github-followers.service.js index 7703a3f3319760500bde284b8866d46158cde1ce..136f2e25142b62af03cf8d9f5b2124431b01c1d9 100644 --- a/services/github/github-followers.service.js +++ b/services/github/github-followers.service.js @@ -6,10 +6,32 @@ const { makeLogo: getLogo, } = require('../../lib/badge-data') const { + documentation, checkErrorResponse: githubCheckErrorResponse, } = require('./github-helpers') module.exports = class GithubFollowers extends LegacyService { + static get category() { + return 'social' + } + + static get route() { + return { + base: 'github/followers', + } + } + + static get examples() { + return [ + { + title: 'GitHub followers', + previewUrl: 'espadrine', + query: { style: 'social', label: 'Follow' }, + documentation, + }, + ] + } + static registerLegacyRouteHandler({ camp, cache, githubApiProvider }) { camp.route( /^\/github\/followers\/([^/]+)\.(svg|png|gif|jpg|json)$/, diff --git a/services/github/github-forks.service.js b/services/github/github-forks.service.js index 17ff0ac0e9edc595d283a0119d3fbefbe7a7d52c..a6089da25e3aee4ed7e9ea799ecd5eeec6e931f2 100644 --- a/services/github/github-forks.service.js +++ b/services/github/github-forks.service.js @@ -6,10 +6,32 @@ const { makeLogo: getLogo, } = require('../../lib/badge-data') const { + documentation, checkErrorResponse: githubCheckErrorResponse, } = require('./github-helpers') module.exports = class GithubForks extends LegacyService { + static get category() { + return 'social' + } + + static get route() { + return { + base: 'github/forks', + } + } + + static get examples() { + return [ + { + title: 'GitHub forks', + previewUrl: 'badges/shields', + query: { style: 'social', label: 'Fork' }, + documentation, + }, + ] + } + static registerLegacyRouteHandler({ camp, cache, githubApiProvider }) { camp.route( /^\/github\/forks\/([^/]+)\/([^/]+)\.(svg|png|gif|jpg|json)$/, diff --git a/services/github/github-issue-detail.service.js b/services/github/github-issue-detail.service.js index 9dcf6399cc2fb1d2955413b02c8c1e11bf251657..fbbddb0b331e316c8f0ebd23d380c788fb2452b1 100644 --- a/services/github/github-issue-detail.service.js +++ b/services/github/github-issue-detail.service.js @@ -10,12 +10,70 @@ const { const { formatDate } = require('../../lib/text-formatters') const { age: ageColor } = require('../../lib/color-formatters') const { + documentation, stateColor: githubStateColor, commentsColor: githubCommentsColor, checkErrorResponse: githubCheckErrorResponse, } = require('./github-helpers') module.exports = class GithubIssueDetail extends LegacyService { + static get category() { + return 'issue-tracking' + } + + static get route() { + return { + base: 'github/issues/detail', + } + } + + static get examples() { + return [ + { + title: 'GitHub issue/pull request state', + previewUrl: 's/badges/shields/979', + keywords: ['GitHub', 'issue', 'pullrequest', 'detail'], + documentation, + }, + { + title: 'GitHub issue/pull request title', + previewUrl: 'title/badges/shields/1290', + keywords: ['GitHub', 'issue', 'pullrequest', 'detail'], + documentation, + }, + { + title: 'GitHub issue/pull request author', + previewUrl: 'u/badges/shields/979', + keywords: ['GitHub', 'issue', 'pullrequest', 'detail'], + documentation, + }, + { + title: 'GitHub issue/pull request label', + previewUrl: 'label/badges/shields/979', + keywords: ['GitHub', 'issue', 'pullrqeuest', 'detail'], + documentation, + }, + { + title: 'GitHub issue/pull request comments', + previewUrl: 'comments/badges/shields/979', + keywords: ['GitHub', 'issue', 'pullrequest', 'detail'], + documentation, + }, + { + title: 'GitHub issue/pull request age', + previewUrl: 'age/badges/shields/979', + keywords: ['GitHub', 'issue', 'pullrequest', 'detail'], + documentation, + }, + { + title: 'GitHub issue/pull request last update', + previewUrl: 'last-update/badges/shields/979', + keywords: ['GitHub', 'issue', 'pullrequest', 'detail'], + documentation, + }, + ] + } + static registerLegacyRouteHandler({ camp, cache, githubApiProvider }) { camp.route( /^\/github\/(?:issues|pulls)\/detail\/(s|title|u|label|comments|age|last-update)\/([^/]+)\/([^/]+)\/(\d+)\.(svg|png|gif|jpg|json)$/, diff --git a/services/github/github-issues.service.js b/services/github/github-issues.service.js index c3b3453a44009bc5dbf457472aaf528568c39904..475b9012d470b99828995143703b8c6071f0ce56 100644 --- a/services/github/github-issues.service.js +++ b/services/github/github-issues.service.js @@ -7,10 +7,98 @@ const { } = require('../../lib/badge-data') const { metric } = require('../../lib/text-formatters') const { + documentation, checkErrorResponse: githubCheckErrorResponse, } = require('./github-helpers') module.exports = class GithubIssues extends LegacyService { + static get category() { + return 'issue-tracking' + } + + static get route() { + return { + base: 'github', + } + } + + static get examples() { + return [ + { + title: 'GitHub issues', + previewUrl: 'issues/badges/shields', + keywords: ['GitHub', 'issue'], + documentation, + }, + { + title: 'GitHub issues', + previewUrl: 'issues-raw/badges/shields', + keywords: ['GitHub', 'issue'], + documentation, + }, + { + title: 'GitHub pull requests', + previewUrl: 'issues-pr/cdnjs/cdnjs', + keywords: ['GitHub', 'pullrequest', 'pr'], + documentation, + }, + { + title: 'GitHub pull requests', + previewUrl: 'issues-pr-raw/cdnjs/cdnjs', + keywords: ['GitHub', 'pullrequest', 'pr'], + documentation, + }, + { + title: 'GitHub closed issues', + previewUrl: 'issues-closed/badges/shields', + keywords: ['GitHub', 'issue'], + documentation, + }, + { + title: 'GitHub closed issues', + previewUrl: 'issues-closed-raw/badges/shields', + keywords: ['GitHub', 'issue'], + documentation, + }, + { + title: 'GitHub closed pull requests', + previewUrl: 'issues-pr-closed/cdnjs/cdnjs', + keywords: ['GitHub', 'pullrequest', 'pr'], + documentation, + }, + { + title: 'GitHub closed pull requests', + previewUrl: 'issues-pr-closed-raw/cdnjs/cdnjs', + keywords: ['GitHub', 'pullrequest', 'pr'], + documentation, + }, + { + title: 'GitHub issues by-label', + previewUrl: 'issues/badges/shields/service-badge', + keywords: ['GitHub', 'issue', 'label'], + documentation, + }, + { + title: 'GitHub issues by-label', + previewUrl: 'issues-raw/badges/shields/service-badge', + keywords: ['GitHub', 'issue', 'label'], + documentation, + }, + { + title: 'GitHub pull requests by-label', + previewUrl: 'issues-pr/badges/shields/service-badge', + keywords: ['GitHub', 'pullrequests', 'label'], + documentation, + }, + { + title: 'GitHub pull requests by-label', + previewUrl: 'issues-pr-raw/badges/shields/service-badge', + keywords: ['GitHub', 'pullrequests', 'label'], + documentation, + }, + ] + } + static registerLegacyRouteHandler({ camp, cache, githubApiProvider }) { camp.route( /^\/github\/issues(-pr)?(-closed)?(-raw)?\/(?!detail)([^/]+)\/([^/]+)\/?(.+)?\.(svg|png|gif|jpg|json)$/, diff --git a/services/github/github-languages.service.js b/services/github/github-languages.service.js index a857cb238ffad45fede660b17e8e2e302ce186f3..d204970d9d93d9dce856bc7f0e0acdd5f92b0834 100644 --- a/services/github/github-languages.service.js +++ b/services/github/github-languages.service.js @@ -8,10 +8,63 @@ const { makeLabel: getLabel, } = require('../../lib/badge-data') const { + documentation, checkErrorResponse: githubCheckErrorResponse, } = require('./github-helpers') -module.exports = class GithubLanguages extends LegacyService { +class GithubCodeSize extends LegacyService { + static get category() { + return 'size' + } + + static get route() { + return { + base: 'github/languages/code-size', + } + } + + static get examples() { + return [ + { + title: 'GitHub code size in bytes', + previewUrl: 'badges/shields', + keywords: ['GitHub', 'byte', 'code', 'size'], + documentation, + }, + ] + } + + static registerLegacyRouteHandler() {} +} + +class GithubLanguages extends LegacyService { + static get category() { + return 'other' + } + + static get route() { + return { + base: 'github/languages', + } + } + + static get examples() { + return [ + { + title: 'GitHub top language', + previewUrl: 'top/badges/shields', + keywords: ['GitHub', 'top', 'language'], + documentation, + }, + { + title: 'GitHub language count', + previewUrl: 'count/badges/shields', + keywords: ['GitHub', 'language', 'count'], + documentation, + }, + ] + } + static registerLegacyRouteHandler({ camp, cache, githubApiProvider }) { camp.route( /^\/github\/languages\/(top|count|code-size)\/([^/]+)\/([^/]+)\.(svg|png|gif|jpg|json)$/, @@ -83,3 +136,5 @@ module.exports = class GithubLanguages extends LegacyService { ) } } + +module.exports = { GithubCodeSize, GithubLanguages } diff --git a/services/github/github-last-commit.service.js b/services/github/github-last-commit.service.js index 041029116d7a9de6bc18d0f0fb503cae1150447d..f8ec4a9150b1488d7db4c4ee2cbf0ab70b2cf7ca 100644 --- a/services/github/github-last-commit.service.js +++ b/services/github/github-last-commit.service.js @@ -8,10 +8,38 @@ const { const { formatDate } = require('../../lib/text-formatters') const { age: ageColor } = require('../../lib/color-formatters') const { + documentation, checkErrorResponse: githubCheckErrorResponse, } = require('./github-helpers') module.exports = class GithubLastCommit extends LegacyService { + static get category() { + return 'other' + } + + static get route() { + return { + base: 'github/last-commit', + } + } + + static get examples() { + return [ + { + title: 'GitHub last commit', + previewUrl: 'google/skia', + keywords: ['GitHub', 'last', 'latest', 'commit'], + documentation, + }, + { + title: 'GitHub last commit (branch)', + previewUrl: 'google/skia/infra/config', + keywords: ['GitHub', 'last', 'latest', 'commit'], + documentation, + }, + ] + } + static registerLegacyRouteHandler({ camp, cache, githubApiProvider }) { camp.route( /^\/github\/last-commit\/([^/]+)\/([^/]+)(?:\/(.+))?\.(svg|png|gif|jpg|json)$/, diff --git a/services/github/github-license.service.js b/services/github/github-license.service.js index 81b7b9234d7983c9887f0850a947f216d4e3be73..8a823126b48dbaf086e4ef97078f21e4dcc1a9df 100644 --- a/services/github/github-license.service.js +++ b/services/github/github-license.service.js @@ -8,12 +8,33 @@ const { } = require('../../lib/badge-data') const { licenseToColor } = require('../../lib/licenses') const { + documentation, checkErrorResponse: githubCheckErrorResponse, } = require('./github-helpers') module.exports = class GithubLicense extends LegacyService { + static get category() { + return 'license' + } + + static get route() { + return { + base: 'github/license', + } + } + + static get examples() { + return [ + { + title: 'GitHub', + previewUrl: 'mashape/apistatus', + keywords: ['GitHub', 'license'], + documentation, + }, + ] + } + static registerLegacyRouteHandler({ camp, cache, githubApiProvider }) { - // GitHub license integration. camp.route( /^\/github\/license\/([^/]+)\/([^/]+)\.(svg|png|gif|jpg|json)$/, cache((data, match, sendBadge, request) => { diff --git a/services/github/github-manifest-version.service.js b/services/github/github-manifest-version.service.js index 63f2f4505608e6e5ddc0d5ad9eed10e19f4573c3..6d3aebc1810596292cfe43d6062d48f4add327d0 100644 --- a/services/github/github-manifest-version.service.js +++ b/services/github/github-manifest-version.service.js @@ -8,11 +8,36 @@ const { const { addv: versionText } = require('../../lib/text-formatters') const { version: versionColor } = require('../../lib/color-formatters') const { + documentation, checkErrorResponse: githubCheckErrorResponse, } = require('./github-helpers') -// For GitHub package and manifest version. module.exports = class GithubManifestVersion extends LegacyService { + static get category() { + return 'version' + } + + static get route() { + return { + base: 'github', + } + } + + static get examples() { + return [ + { + title: 'GitHub package version', + previewUrl: 'package-json/v/badges/shields', + documentation, + }, + { + title: 'GitHub manifest version', + previewUrl: 'manifest-json/v/RedSparr0w/IndieGala-Helper', + documentation, + }, + ] + } + static registerLegacyRouteHandler({ camp, cache }) { camp.route( /^\/github\/(package|manifest)-json\/([^/]+)\/([^/]+)\/([^/]+)\/?([^/]+)?\.(svg|png|gif|jpg|json)$/, diff --git a/services/github/github-release-date.service.js b/services/github/github-release-date.service.js index 9956d636cd64a5dd479efcd19e1262192264a11c..bb56433bf76d02a3baf0bd7e90229ea69f802429 100644 --- a/services/github/github-release-date.service.js +++ b/services/github/github-release-date.service.js @@ -8,9 +8,36 @@ const { } = require('../../lib/badge-data') const { formatDate } = require('../../lib/text-formatters') const { age } = require('../../lib/color-formatters') +const { documentation } = require('./github-helpers') -// For Github Release & Pre-Release Date release-date-pre (?:\/(all))? module.exports = class GithubReleaseDate extends LegacyService { + static get category() { + return 'other' + } + + static get route() { + return { + base: 'github', + } + } + + static get examples() { + return [ + { + title: 'GitHub Release Date', + previewUrl: 'release-date/SubtitleEdit/subtitleedit', + keywords: ['GitHub', 'release', 'date'], + documentation, + }, + { + title: 'GitHub (Pre-)Release Date', + previewUrl: 'release-date-pre/Cockatrice/Cockatrice', + keywords: ['GitHub', 'release', 'date'], + documentation, + }, + ] + } + static registerLegacyRouteHandler({ camp, cache, githubApiProvider }) { camp.route( /^\/github\/(release-date|release-date-pre)\/([^/]+)\/([^/]+)\.(svg|png|gif|jpg|json)$/, diff --git a/services/github/github-release.service.js b/services/github/github-release.service.js index 29b896b36b7006a402ca7a28a14f5e3685296990..608488bd509eff32cc5397845794fe0935217003 100644 --- a/services/github/github-release.service.js +++ b/services/github/github-release.service.js @@ -7,10 +7,36 @@ const { } = require('../../lib/badge-data') const { addv: versionText } = require('../../lib/text-formatters') const { + documentation, checkErrorResponse: githubCheckErrorResponse, } = require('./github-helpers') module.exports = class GithubRelease extends LegacyService { + static get category() { + return 'version' + } + + static get route() { + return { + base: 'github', + } + } + + static get examples() { + return [ + { + title: 'GitHub release', + previewUrl: 'release/qubyte/rubidium', + documentation, + }, + { + title: 'GitHub (pre-)release', + previewUrl: 'release-pre/qubyte/rubidium', + documentation, + }, + ] + } + static registerLegacyRouteHandler({ camp, cache, githubApiProvider }) { camp.route( /^\/github\/release(-pre)?\/([^/]+\/[^/]+)(?:\/(all))?\.(svg|png|gif|jpg|json)$/, diff --git a/services/github/github-repo-size.service.js b/services/github/github-repo-size.service.js index 64e8ef2001b65fb88bef3b1a24473511dd1a01ba..089eced795658840db1f7890723a13f648c08344 100644 --- a/services/github/github-repo-size.service.js +++ b/services/github/github-repo-size.service.js @@ -7,10 +7,32 @@ const { makeLogo: getLogo, } = require('../../lib/badge-data') const { + documentation, checkErrorResponse: githubCheckErrorResponse, } = require('./github-helpers') module.exports = class GithubRepoSize extends LegacyService { + static get category() { + return 'size' + } + + static get route() { + return { + base: 'github/repo-size', + } + } + + static get examples() { + return [ + { + title: 'GitHub repo size in bytes', + previewUrl: 'badges/shields', + keywords: ['GitHub', 'repo', 'size'], + documentation, + }, + ] + } + static registerLegacyRouteHandler({ camp, cache, githubApiProvider }) { camp.route( /^\/github\/repo-size\/([^/]+)\/([^/]+)\.(svg|png|gif|jpg|json)$/, diff --git a/services/github/github-search.service.js b/services/github/github-search.service.js index c00ac644e3de8174a697dced06899a68507c48a9..4bb20fb473390b4bcfc8f71dd94ed56c33f476ad 100644 --- a/services/github/github-search.service.js +++ b/services/github/github-search.service.js @@ -4,12 +4,33 @@ const LegacyService = require('../legacy-service') const { makeBadgeData: getBadgeData } = require('../../lib/badge-data') const { metric } = require('../../lib/text-formatters') const { + documentation, checkErrorResponse: githubCheckErrorResponse, } = require('./github-helpers') module.exports = class GithubSearch extends LegacyService { + static get category() { + return 'other' + } + + static get route() { + return { + base: 'github/search', + } + } + + static get examples() { + return [ + { + title: 'GitHub search hit counter', + previewUrl: 'torvalds/linux/goto', + keywords: ['GitHub', 'search', 'hit', 'counter'], + documentation, + }, + ] + } + static registerLegacyRouteHandler({ camp, cache, githubApiProvider }) { - // GitHub search hit counter. camp.route( /^\/github\/search\/([^/]+)\/([^/]+)\/(.*)\.(svg|png|gif|jpg|json)$/, cache((data, match, sendBadge, request) => { diff --git a/services/github/github-size.service.js b/services/github/github-size.service.js index 3c73266547d715498b10598a9326a9abe16b4f7d..0b8dea75f3db0cb463d6fba62f2310f8fc0507ef 100644 --- a/services/github/github-size.service.js +++ b/services/github/github-size.service.js @@ -7,10 +7,32 @@ const { makeLogo: getLogo, } = require('../../lib/badge-data') const { + documentation, checkErrorResponse: githubCheckErrorResponse, } = require('./github-helpers') module.exports = class GithubSize extends LegacyService { + static get category() { + return 'size' + } + + static get route() { + return { + base: 'github/size', + } + } + + static get examples() { + return [ + { + title: 'GitHub repo size in bytes', + previewUrl: 'webcaetano/craft/build/phaser-craft.min.js', + keywords: ['GitHub', 'file', 'size'], + documentation, + }, + ] + } + static registerLegacyRouteHandler({ camp, cache, githubApiProvider }) { camp.route( /^\/github\/size\/([^/]+)\/([^/]+)\/(.*)\.(svg|png|gif|jpg|json)$/, diff --git a/services/github/github-stars.service.js b/services/github/github-stars.service.js index 011a947fd45e2721f5c2edbb15ad5452482e313a..ba959e4a6943cb50a2694b0d54eced4d06ef6a48 100644 --- a/services/github/github-stars.service.js +++ b/services/github/github-stars.service.js @@ -7,10 +7,32 @@ const { } = require('../../lib/badge-data') const { metric } = require('../../lib/text-formatters') const { + documentation, checkErrorResponse: githubCheckErrorResponse, } = require('./github-helpers') module.exports = class GithubStars extends LegacyService { + static get category() { + return 'social' + } + + static get route() { + return { + base: 'github/stars', + } + } + + static get examples() { + return [ + { + title: 'GitHub stars', + previewUrl: 'badges/shields', + query: { style: 'social', label: 'Stars' }, + documentation, + }, + ] + } + static registerLegacyRouteHandler({ camp, cache, githubApiProvider }) { camp.route( /^\/github\/stars\/([^/]+)\/([^/]+)\.(svg|png|gif|jpg|json)$/, diff --git a/services/github/github-tag.service.js b/services/github/github-tag.service.js index 59e3e3f54e8520043ed3c49dba940bdfa12a4fb0..f6644fb694e074e568ecf4f50807d626d8d8f584 100644 --- a/services/github/github-tag.service.js +++ b/services/github/github-tag.service.js @@ -9,10 +9,41 @@ const { addv: versionText } = require('../../lib/text-formatters') const { version: versionColor } = require('../../lib/color-formatters') const { latest: latestVersion } = require('../../lib/version') const { + documentation, checkErrorResponse: githubCheckErrorResponse, } = require('./github-helpers') module.exports = class GithubTag extends LegacyService { + static get category() { + return 'version' + } + + static get route() { + return { + base: 'github', + } + } + + static get examples() { + return [ + { + title: 'GitHub tag (latest SemVer)', + previewUrl: 'tag/expressjs/express', + documentation, + }, + { + title: 'GitHub tag (latest SemVer pre-release)', + previewUrl: 'tag-pre/expressjs/express', + documentation, + }, + { + title: 'GitHub tag (latest by date)', + previewUrl: 'tag-date/expressjs/express', + documentation, + }, + ] + } + static registerLegacyRouteHandler({ camp, cache, githubApiProvider }) { camp.route( /^\/github\/(tag-pre|tag-date|tag)\/([^/]+)\/([^/]+)\.(svg|png|gif|jpg|json)$/, diff --git a/services/github/github-watchers.service.js b/services/github/github-watchers.service.js index a073ec14ae13f8713fa547cb4da3049026d74923..24abf3e2fa5695dd6fdf5094fc7ab0749cc5ab76 100644 --- a/services/github/github-watchers.service.js +++ b/services/github/github-watchers.service.js @@ -6,10 +6,32 @@ const { makeLogo: getLogo, } = require('../../lib/badge-data') const { + documentation, checkErrorResponse: githubCheckErrorResponse, } = require('./github-helpers') module.exports = class GithubWatchers extends LegacyService { + static get category() { + return 'social' + } + + static get route() { + return { + base: 'github/watchers', + } + } + + static get examples() { + return [ + { + title: 'GitHub watchers', + previewUrl: 'badges/shields', + query: { style: 'social', label: 'Watch' }, + documentation, + }, + ] + } + static registerLegacyRouteHandler({ camp, cache, githubApiProvider }) { camp.route( /^\/github\/watchers\/([^/]+)\/([^/]+)\.(svg|png|gif|jpg|json)$/,