convert [homebrew hsts itunes jenkins jetbrains] classes to static props (#5582)
* convert [homebrew,hsts,itunes,jenkins,jetbrains] classes to static props * Run the prettier across the files * Updated the correct values in logos.spec.js * revert back the logos.spec.js changes Co-authored-by: Jabbar Memon <jabbar@zoop.one> Co-authored-by: repo-ranger[bot] <39074581+repo-ranger[bot]@users.noreply.github.com>
This commit is contained in:
@@ -9,30 +9,18 @@ const schema = Joi.object({
|
||||
}).required()
|
||||
|
||||
module.exports = class HomebrewCask extends BaseJsonService {
|
||||
static get category() {
|
||||
return 'version'
|
||||
}
|
||||
static category = 'version'
|
||||
static route = { base: 'homebrew/cask/v', pattern: ':cask' }
|
||||
|
||||
static get route() {
|
||||
return {
|
||||
base: 'homebrew/cask/v',
|
||||
pattern: ':cask',
|
||||
}
|
||||
}
|
||||
static examples = [
|
||||
{
|
||||
title: 'homebrew cask',
|
||||
namedParams: { cask: 'iterm2' },
|
||||
staticPreview: renderVersionBadge({ version: 'v3.2.5' }),
|
||||
},
|
||||
]
|
||||
|
||||
static get examples() {
|
||||
return [
|
||||
{
|
||||
title: 'homebrew cask',
|
||||
namedParams: { cask: 'iterm2' },
|
||||
staticPreview: renderVersionBadge({ version: 'v3.2.5' }),
|
||||
},
|
||||
]
|
||||
}
|
||||
|
||||
static get defaultBadgeData() {
|
||||
return { label: 'homebrew cask' }
|
||||
}
|
||||
static defaultBadgeData = { label: 'homebrew cask' }
|
||||
|
||||
async fetch({ cask }) {
|
||||
return this._requestJson({
|
||||
|
||||
@@ -11,30 +11,19 @@ const schema = Joi.object({
|
||||
}).required()
|
||||
|
||||
module.exports = class Homebrew extends BaseJsonService {
|
||||
static get category() {
|
||||
return 'version'
|
||||
}
|
||||
static category = 'version'
|
||||
|
||||
static get route() {
|
||||
return {
|
||||
base: 'homebrew/v',
|
||||
pattern: ':formula',
|
||||
}
|
||||
}
|
||||
static route = { base: 'homebrew/v', pattern: ':formula' }
|
||||
|
||||
static get examples() {
|
||||
return [
|
||||
{
|
||||
title: 'homebrew',
|
||||
namedParams: { formula: 'cake' },
|
||||
staticPreview: renderVersionBadge({ version: 'v0.32.0' }),
|
||||
},
|
||||
]
|
||||
}
|
||||
static examples = [
|
||||
{
|
||||
title: 'homebrew',
|
||||
namedParams: { formula: 'cake' },
|
||||
staticPreview: renderVersionBadge({ version: 'v0.32.0' }),
|
||||
},
|
||||
]
|
||||
|
||||
static get defaultBadgeData() {
|
||||
return { label: 'homebrew' }
|
||||
}
|
||||
static defaultBadgeData = { label: 'homebrew' }
|
||||
|
||||
async fetch({ formula }) {
|
||||
return this._requestJson({
|
||||
|
||||
@@ -22,28 +22,22 @@ const documentation = `
|
||||
`
|
||||
|
||||
module.exports = class HSTS extends BaseJsonService {
|
||||
static get category() {
|
||||
return 'monitoring'
|
||||
static category = 'monitoring'
|
||||
|
||||
static route = {
|
||||
base: 'hsts/preload',
|
||||
pattern: ':domain',
|
||||
}
|
||||
|
||||
static get route() {
|
||||
return {
|
||||
base: 'hsts/preload',
|
||||
pattern: ':domain',
|
||||
}
|
||||
}
|
||||
|
||||
static get examples() {
|
||||
return [
|
||||
{
|
||||
title: 'Chromium HSTS preload',
|
||||
namedParams: { domain: 'github.com' },
|
||||
staticPreview: this.render({ status: 'preloaded' }),
|
||||
keywords: ['security'],
|
||||
documentation,
|
||||
},
|
||||
]
|
||||
}
|
||||
static examples = [
|
||||
{
|
||||
title: 'Chromium HSTS preload',
|
||||
namedParams: { domain: 'github.com' },
|
||||
staticPreview: this.render({ status: 'preloaded' }),
|
||||
keywords: ['security'],
|
||||
documentation,
|
||||
},
|
||||
]
|
||||
|
||||
static render({ status }) {
|
||||
let color = 'red'
|
||||
|
||||
@@ -13,30 +13,22 @@ const schema = Joi.object({
|
||||
}).required()
|
||||
|
||||
module.exports = class Itunes extends BaseJsonService {
|
||||
static get category() {
|
||||
return 'version'
|
||||
static category = 'version'
|
||||
|
||||
static route = {
|
||||
base: 'itunes/v',
|
||||
pattern: ':bundleId',
|
||||
}
|
||||
|
||||
static get route() {
|
||||
return {
|
||||
base: 'itunes/v',
|
||||
pattern: ':bundleId',
|
||||
}
|
||||
}
|
||||
static examples = [
|
||||
{
|
||||
title: 'iTunes App Store',
|
||||
namedParams: { bundleId: '803453959' },
|
||||
staticPreview: renderVersionBadge({ version: 'v3.3.3' }),
|
||||
},
|
||||
]
|
||||
|
||||
static get examples() {
|
||||
return [
|
||||
{
|
||||
title: 'iTunes App Store',
|
||||
namedParams: { bundleId: '803453959' },
|
||||
staticPreview: renderVersionBadge({ version: 'v3.3.3' }),
|
||||
},
|
||||
]
|
||||
}
|
||||
|
||||
static get defaultBadgeData() {
|
||||
return { label: 'itunes app store' }
|
||||
}
|
||||
static defaultBadgeData = { label: 'itunes app store' }
|
||||
|
||||
async fetch({ bundleId }) {
|
||||
return this._requestJson({
|
||||
|
||||
@@ -34,36 +34,26 @@ const schema = Joi.object({
|
||||
}).required()
|
||||
|
||||
module.exports = class JenkinsBuild extends JenkinsBase {
|
||||
static get category() {
|
||||
return 'build'
|
||||
static category = 'build'
|
||||
|
||||
static route = {
|
||||
base: 'jenkins',
|
||||
pattern: 'build',
|
||||
queryParamSchema,
|
||||
}
|
||||
|
||||
static get route() {
|
||||
return {
|
||||
base: 'jenkins',
|
||||
pattern: 'build',
|
||||
queryParamSchema,
|
||||
}
|
||||
}
|
||||
|
||||
static get examples() {
|
||||
return [
|
||||
{
|
||||
title: 'Jenkins',
|
||||
namedParams: {},
|
||||
queryParams: {
|
||||
jobUrl: 'https://wso2.org/jenkins/view/All%20Builds/job/archetypes',
|
||||
},
|
||||
staticPreview: renderBuildStatusBadge({ status: 'passing' }),
|
||||
static examples = [
|
||||
{
|
||||
title: 'Jenkins',
|
||||
namedParams: {},
|
||||
queryParams: {
|
||||
jobUrl: 'https://wso2.org/jenkins/view/All%20Builds/job/archetypes',
|
||||
},
|
||||
]
|
||||
}
|
||||
staticPreview: renderBuildStatusBadge({ status: 'passing' }),
|
||||
},
|
||||
]
|
||||
|
||||
static get defaultBadgeData() {
|
||||
return {
|
||||
label: 'build',
|
||||
}
|
||||
}
|
||||
static defaultBadgeData = { label: 'build' }
|
||||
|
||||
static render({ status }) {
|
||||
if (status === 'unstable') {
|
||||
|
||||
@@ -41,48 +41,40 @@ module.exports = class JenkinsPluginInstalls extends BaseJsonService {
|
||||
}
|
||||
}
|
||||
|
||||
static get category() {
|
||||
return 'downloads'
|
||||
static category = 'downloads'
|
||||
|
||||
static route = {
|
||||
base: 'jenkins/plugin/i',
|
||||
pattern: ':plugin/:version?',
|
||||
}
|
||||
|
||||
static get route() {
|
||||
return {
|
||||
base: 'jenkins/plugin/i',
|
||||
pattern: ':plugin/:version?',
|
||||
}
|
||||
}
|
||||
|
||||
static get examples() {
|
||||
return [
|
||||
{
|
||||
title: 'Jenkins Plugin installs',
|
||||
pattern: ':plugin',
|
||||
namedParams: {
|
||||
plugin: 'view-job-filters',
|
||||
},
|
||||
staticPreview: this.render({
|
||||
label: this._getLabel(),
|
||||
installs: 10247,
|
||||
}),
|
||||
static examples = [
|
||||
{
|
||||
title: 'Jenkins Plugin installs',
|
||||
pattern: ':plugin',
|
||||
namedParams: {
|
||||
plugin: 'view-job-filters',
|
||||
},
|
||||
{
|
||||
title: 'Jenkins Plugin installs (version)',
|
||||
pattern: ':plugin/:version',
|
||||
namedParams: {
|
||||
plugin: 'view-job-filters',
|
||||
version: '1.26',
|
||||
},
|
||||
staticPreview: this.render({
|
||||
label: this._getLabel('1.26'),
|
||||
installs: 955,
|
||||
}),
|
||||
staticPreview: this.render({
|
||||
label: this._getLabel(),
|
||||
installs: 10247,
|
||||
}),
|
||||
},
|
||||
{
|
||||
title: 'Jenkins Plugin installs (version)',
|
||||
pattern: ':plugin/:version',
|
||||
namedParams: {
|
||||
plugin: 'view-job-filters',
|
||||
version: '1.26',
|
||||
},
|
||||
]
|
||||
}
|
||||
staticPreview: this.render({
|
||||
label: this._getLabel('1.26'),
|
||||
installs: 955,
|
||||
}),
|
||||
},
|
||||
]
|
||||
|
||||
static get defaultBadgeData() {
|
||||
return { label: 'installs' }
|
||||
}
|
||||
static defaultBadgeData = { label: 'installs' }
|
||||
|
||||
static render({ label, installs }) {
|
||||
return {
|
||||
|
||||
@@ -6,36 +6,28 @@ const { renderVersionBadge } = require('../version')
|
||||
const { BaseService, NotFound } = require('..')
|
||||
|
||||
module.exports = class JenkinsPluginVersion extends BaseService {
|
||||
static get category() {
|
||||
return 'version'
|
||||
static category = 'version'
|
||||
|
||||
static route = {
|
||||
base: 'jenkins/plugin/v',
|
||||
pattern: ':plugin',
|
||||
}
|
||||
|
||||
static get route() {
|
||||
return {
|
||||
base: 'jenkins/plugin/v',
|
||||
pattern: ':plugin',
|
||||
}
|
||||
}
|
||||
|
||||
static get examples() {
|
||||
return [
|
||||
{
|
||||
title: 'Jenkins Plugins',
|
||||
namedParams: {
|
||||
plugin: 'blueocean',
|
||||
},
|
||||
staticPreview: {
|
||||
label: 'plugin',
|
||||
message: 'v1.10.1',
|
||||
color: 'blue',
|
||||
},
|
||||
static examples = [
|
||||
{
|
||||
title: 'Jenkins Plugins',
|
||||
namedParams: {
|
||||
plugin: 'blueocean',
|
||||
},
|
||||
]
|
||||
}
|
||||
staticPreview: {
|
||||
label: 'plugin',
|
||||
message: 'v1.10.1',
|
||||
color: 'blue',
|
||||
},
|
||||
},
|
||||
]
|
||||
|
||||
static get defaultBadgeData() {
|
||||
return { label: 'plugin' }
|
||||
}
|
||||
static defaultBadgeData = { label: 'plugin' }
|
||||
|
||||
static render({ version }) {
|
||||
return renderVersionBadge({ version })
|
||||
|
||||
@@ -36,47 +36,37 @@ const schema = Joi.object({
|
||||
}).required()
|
||||
|
||||
module.exports = class JenkinsTests extends JenkinsBase {
|
||||
static get category() {
|
||||
return 'build'
|
||||
static category = 'build'
|
||||
|
||||
static route = {
|
||||
base: 'jenkins',
|
||||
pattern: 'tests',
|
||||
queryParamSchema: queryParamSchema.concat(testResultQueryParamSchema),
|
||||
}
|
||||
|
||||
static get route() {
|
||||
return {
|
||||
base: 'jenkins',
|
||||
pattern: 'tests',
|
||||
queryParamSchema: queryParamSchema.concat(testResultQueryParamSchema),
|
||||
}
|
||||
}
|
||||
|
||||
static get examples() {
|
||||
return [
|
||||
{
|
||||
title: 'Jenkins tests',
|
||||
namedParams: {},
|
||||
queryParams: {
|
||||
compact_message: null,
|
||||
passed_label: 'passed',
|
||||
failed_label: 'failed',
|
||||
skipped_label: 'skipped',
|
||||
jobUrl: 'https://jenkins.sqlalchemy.org/job/alembic_coverage',
|
||||
},
|
||||
staticPreview: this.render({
|
||||
passed: 477,
|
||||
failed: 2,
|
||||
skipped: 0,
|
||||
total: 479,
|
||||
isCompact: false,
|
||||
}),
|
||||
documentation,
|
||||
static examples = [
|
||||
{
|
||||
title: 'Jenkins tests',
|
||||
namedParams: {},
|
||||
queryParams: {
|
||||
compact_message: null,
|
||||
passed_label: 'passed',
|
||||
failed_label: 'failed',
|
||||
skipped_label: 'skipped',
|
||||
jobUrl: 'https://jenkins.sqlalchemy.org/job/alembic_coverage',
|
||||
},
|
||||
]
|
||||
}
|
||||
staticPreview: this.render({
|
||||
passed: 477,
|
||||
failed: 2,
|
||||
skipped: 0,
|
||||
total: 479,
|
||||
isCompact: false,
|
||||
}),
|
||||
documentation,
|
||||
},
|
||||
]
|
||||
|
||||
static get defaultBadgeData() {
|
||||
return {
|
||||
label: 'tests',
|
||||
}
|
||||
}
|
||||
static defaultBadgeData = { label: 'tests' }
|
||||
|
||||
static render({
|
||||
passed,
|
||||
|
||||
@@ -23,28 +23,22 @@ const schema = Joi.object({
|
||||
}).required()
|
||||
|
||||
module.exports = class JetbrainsDownloads extends JetbrainsBase {
|
||||
static get category() {
|
||||
return 'downloads'
|
||||
static category = 'downloads'
|
||||
|
||||
static route = {
|
||||
base: 'jetbrains/plugin/d',
|
||||
pattern: ':pluginId',
|
||||
}
|
||||
|
||||
static get route() {
|
||||
return {
|
||||
base: 'jetbrains/plugin/d',
|
||||
pattern: ':pluginId',
|
||||
}
|
||||
}
|
||||
|
||||
static get examples() {
|
||||
return [
|
||||
{
|
||||
title: 'JetBrains IntelliJ plugins',
|
||||
namedParams: {
|
||||
pluginId: '1347-scala',
|
||||
},
|
||||
staticPreview: this.render({ downloads: 10200000 }),
|
||||
static examples = [
|
||||
{
|
||||
title: 'JetBrains IntelliJ plugins',
|
||||
namedParams: {
|
||||
pluginId: '1347-scala',
|
||||
},
|
||||
]
|
||||
}
|
||||
staticPreview: this.render({ downloads: 10200000 }),
|
||||
},
|
||||
]
|
||||
|
||||
static render({ downloads }) {
|
||||
return {
|
||||
|
||||
@@ -24,47 +24,39 @@ const schema = Joi.object({
|
||||
}).required()
|
||||
|
||||
module.exports = class JetbrainsRating extends JetbrainsBase {
|
||||
static get category() {
|
||||
return 'rating'
|
||||
static category = 'rating'
|
||||
|
||||
static route = {
|
||||
base: 'jetbrains/plugin/r',
|
||||
pattern: ':format(rating|stars)/:pluginId',
|
||||
}
|
||||
|
||||
static get route() {
|
||||
return {
|
||||
base: 'jetbrains/plugin/r',
|
||||
pattern: ':format(rating|stars)/:pluginId',
|
||||
}
|
||||
}
|
||||
|
||||
static get examples() {
|
||||
return [
|
||||
{
|
||||
title: 'JetBrains IntelliJ Plugins',
|
||||
pattern: 'rating/:pluginId',
|
||||
namedParams: {
|
||||
pluginId: '11941-automatic-power-saver',
|
||||
},
|
||||
staticPreview: this.render({
|
||||
rating: '4.5',
|
||||
format: 'rating',
|
||||
}),
|
||||
static examples = [
|
||||
{
|
||||
title: 'JetBrains IntelliJ Plugins',
|
||||
pattern: 'rating/:pluginId',
|
||||
namedParams: {
|
||||
pluginId: '11941-automatic-power-saver',
|
||||
},
|
||||
{
|
||||
title: 'JetBrains IntelliJ Plugins',
|
||||
pattern: 'stars/:pluginId',
|
||||
namedParams: {
|
||||
pluginId: '11941-automatic-power-saver',
|
||||
},
|
||||
staticPreview: this.render({
|
||||
rating: '4.5',
|
||||
format: 'stars',
|
||||
}),
|
||||
staticPreview: this.render({
|
||||
rating: '4.5',
|
||||
format: 'rating',
|
||||
}),
|
||||
},
|
||||
{
|
||||
title: 'JetBrains IntelliJ Plugins',
|
||||
pattern: 'stars/:pluginId',
|
||||
namedParams: {
|
||||
pluginId: '11941-automatic-power-saver',
|
||||
},
|
||||
]
|
||||
}
|
||||
staticPreview: this.render({
|
||||
rating: '4.5',
|
||||
format: 'stars',
|
||||
}),
|
||||
},
|
||||
]
|
||||
|
||||
static get defaultBadgeData() {
|
||||
return { label: 'rating' }
|
||||
}
|
||||
static defaultBadgeData = { label: 'rating' }
|
||||
|
||||
static render({ rating, format }) {
|
||||
const message =
|
||||
|
||||
@@ -21,32 +21,24 @@ const schema = Joi.object({
|
||||
}).required()
|
||||
|
||||
module.exports = class JetbrainsVersion extends JetbrainsBase {
|
||||
static get category() {
|
||||
return 'version'
|
||||
static category = 'version'
|
||||
|
||||
static route = {
|
||||
base: 'jetbrains/plugin/v',
|
||||
pattern: ':pluginId',
|
||||
}
|
||||
|
||||
static get route() {
|
||||
return {
|
||||
base: 'jetbrains/plugin/v',
|
||||
pattern: ':pluginId',
|
||||
}
|
||||
}
|
||||
|
||||
static get examples() {
|
||||
return [
|
||||
{
|
||||
title: 'JetBrains IntelliJ Plugins',
|
||||
namedParams: {
|
||||
pluginId: '9630-a8translate',
|
||||
},
|
||||
staticPreview: this.render({ version: 'v1.7' }),
|
||||
static examples = [
|
||||
{
|
||||
title: 'JetBrains IntelliJ Plugins',
|
||||
namedParams: {
|
||||
pluginId: '9630-a8translate',
|
||||
},
|
||||
]
|
||||
}
|
||||
staticPreview: this.render({ version: 'v1.7' }),
|
||||
},
|
||||
]
|
||||
|
||||
static get defaultBadgeData() {
|
||||
return { label: 'jetbrains plugin' }
|
||||
}
|
||||
static defaultBadgeData = { label: 'jetbrains plugin' }
|
||||
|
||||
static render({ version }) {
|
||||
return renderVersionBadge({ version })
|
||||
|
||||
Reference in New Issue
Block a user