Completed [mavencentral mavenmetadata microbadger mozillaobservatory myget netlify] static classes into static props (#5591)
* 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 * Completed refactoring of [lgtm liberapay librariesio localizely luarocks] * Convert defaultBadgeData to object * Completed some classes[maven-central maven-metadata microbadger mozilla-observatory myget netlify] into props * Completed some classes[maven-central maven-metadata microbadger mozilla-observatory myget netlify] into props * changed the title * Added todo in mozilla-observatory service Co-authored-by: Jabbar Memon <jabbar@zoop.one>
This commit is contained in:
@@ -52,7 +52,9 @@ module.exports = class MavenCentral extends BaseXmlService {
|
||||
},
|
||||
]
|
||||
|
||||
static defaultBadgeData = { label: 'maven-central' }
|
||||
static defaultBadgeData = {
|
||||
label: 'maven-central',
|
||||
}
|
||||
|
||||
async fetch({ groupId, artifactId }) {
|
||||
const group = encodeURIComponent(groupId).replace(/\./g, '/')
|
||||
|
||||
@@ -20,34 +20,28 @@ const schema = Joi.object({
|
||||
}).required()
|
||||
|
||||
module.exports = class MavenMetadata extends BaseXmlService {
|
||||
static get category() {
|
||||
return 'version'
|
||||
static category = 'version'
|
||||
|
||||
static route = {
|
||||
base: 'maven-metadata',
|
||||
pattern: 'v',
|
||||
queryParamSchema,
|
||||
}
|
||||
|
||||
static get route() {
|
||||
return {
|
||||
base: 'maven-metadata',
|
||||
pattern: 'v',
|
||||
queryParamSchema,
|
||||
}
|
||||
}
|
||||
|
||||
static get examples() {
|
||||
return [
|
||||
{
|
||||
title: 'Maven metadata URL',
|
||||
namedParams: {},
|
||||
queryParams: {
|
||||
metadataUrl:
|
||||
'https://repo1.maven.org/maven2/com/google/code/gson/gson/maven-metadata.xml',
|
||||
},
|
||||
staticPreview: renderVersionBadge({ version: '2.8.5' }),
|
||||
static examples = [
|
||||
{
|
||||
title: 'Maven metadata URL',
|
||||
namedParams: {},
|
||||
queryParams: {
|
||||
metadataUrl:
|
||||
'https://repo1.maven.org/maven2/com/google/code/gson/gson/maven-metadata.xml',
|
||||
},
|
||||
]
|
||||
}
|
||||
staticPreview: renderVersionBadge({ version: '2.8.5' }),
|
||||
},
|
||||
]
|
||||
|
||||
static get defaultBadgeData() {
|
||||
return { label: 'maven' }
|
||||
static defaultBadgeData = {
|
||||
label: 'maven',
|
||||
}
|
||||
|
||||
async fetch({ metadataUrl }) {
|
||||
|
||||
@@ -26,9 +26,7 @@ const schema = Joi.object({
|
||||
}).required()
|
||||
|
||||
module.exports = class BaseMicrobadgerService extends BaseJsonService {
|
||||
static get category() {
|
||||
return 'size'
|
||||
}
|
||||
static category = 'size'
|
||||
|
||||
async fetch({ user, repo }) {
|
||||
if (user === '_') {
|
||||
|
||||
@@ -3,35 +3,29 @@
|
||||
const BaseMicrobadgerService = require('./microbadger-base')
|
||||
|
||||
module.exports = class MicrobadgerLayers extends BaseMicrobadgerService {
|
||||
static get route() {
|
||||
return {
|
||||
base: 'microbadger/layers',
|
||||
pattern: ':user/:repo/:tag*',
|
||||
}
|
||||
static route = {
|
||||
base: 'microbadger/layers',
|
||||
pattern: ':user/:repo/:tag*',
|
||||
}
|
||||
|
||||
static get examples() {
|
||||
return [
|
||||
{
|
||||
title: 'MicroBadger Layers',
|
||||
pattern: ':user/:repo',
|
||||
namedParams: { user: '_', repo: 'alpine' },
|
||||
staticPreview: this.render({ layers: 15 }),
|
||||
keywords: ['docker'],
|
||||
},
|
||||
{
|
||||
title: 'MicroBadger Layers (tag)',
|
||||
pattern: ':user/:repo/:tag',
|
||||
namedParams: { user: '_', repo: 'alpine', tag: '2.7' },
|
||||
staticPreview: this.render({ layers: 12 }),
|
||||
keywords: ['docker'],
|
||||
},
|
||||
]
|
||||
}
|
||||
static examples = [
|
||||
{
|
||||
title: 'MicroBadger Layers',
|
||||
pattern: ':user/:repo',
|
||||
namedParams: { user: '_', repo: 'alpine' },
|
||||
staticPreview: this.render({ layers: 15 }),
|
||||
keywords: ['docker'],
|
||||
},
|
||||
{
|
||||
title: 'MicroBadger Layers (tag)',
|
||||
pattern: ':user/:repo/:tag',
|
||||
namedParams: { user: '_', repo: 'alpine', tag: '2.7' },
|
||||
staticPreview: this.render({ layers: 12 }),
|
||||
keywords: ['docker'],
|
||||
},
|
||||
]
|
||||
|
||||
static get defaultBadgeData() {
|
||||
return { label: 'layers' }
|
||||
}
|
||||
static defaultBadgeData = { label: 'layers' }
|
||||
|
||||
static render({ layers }) {
|
||||
return {
|
||||
|
||||
@@ -6,13 +6,13 @@ const BaseMicrobadgerService = require('./microbadger-base')
|
||||
|
||||
const documentation = `
|
||||
<p>
|
||||
The MicroBadger API can sometimes be a bit temperamental when it comes to retrieving the size of your image.
|
||||
If the website indicates "Layer information not yet retrieved" for your image, Shields.io will display the size as unknown in its badge.
|
||||
The MicroBadger API can sometimes be a bit temperamental when it comes to retrieving the size of your image.
|
||||
If the website indicates "Layer information not yet retrieved" for your image, Shields.io will display the size as unknown in its badge.
|
||||
In some cases, the size is also reported as 0.
|
||||
</p>
|
||||
<p>
|
||||
To speed things up on the MicroBadger side of things, you may want to hit their webhook manually.
|
||||
Simply go to your image's page on the MicroBadger website, click "Get the webhook" and follow the instructions listed there.
|
||||
To speed things up on the MicroBadger side of things, you may want to hit their webhook manually.
|
||||
Simply go to your image's page on the MicroBadger website, click "Get the webhook" and follow the instructions listed there.
|
||||
Please be patient, it may still take several minutes for the information to be made available to Shields.io!
|
||||
</p>
|
||||
<p>
|
||||
@@ -28,36 +28,32 @@ const documentation = `
|
||||
`
|
||||
|
||||
module.exports = class MicrobadgerSize extends BaseMicrobadgerService {
|
||||
static get route() {
|
||||
return {
|
||||
base: 'microbadger/image-size',
|
||||
pattern: ':user/:repo/:tag*',
|
||||
}
|
||||
static route = {
|
||||
base: 'microbadger/image-size',
|
||||
pattern: ':user/:repo/:tag*',
|
||||
}
|
||||
|
||||
static get examples() {
|
||||
return [
|
||||
{
|
||||
title: 'MicroBadger Size',
|
||||
pattern: ':user/:repo',
|
||||
namedParams: { user: 'fedora', repo: 'apache' },
|
||||
staticPreview: this.render({ size: 126000000 }),
|
||||
keywords: ['docker'],
|
||||
documentation,
|
||||
},
|
||||
{
|
||||
title: 'MicroBadger Size (tag)',
|
||||
pattern: ':user/:repo/:tag',
|
||||
namedParams: { user: 'fedora', repo: 'apache', tag: 'latest' },
|
||||
staticPreview: this.render({ size: 103000000 }),
|
||||
keywords: ['docker'],
|
||||
documentation,
|
||||
},
|
||||
]
|
||||
}
|
||||
static examples = [
|
||||
{
|
||||
title: 'MicroBadger Size',
|
||||
pattern: ':user/:repo',
|
||||
namedParams: { user: 'fedora', repo: 'apache' },
|
||||
staticPreview: this.render({ size: 126000000 }),
|
||||
keywords: ['docker'],
|
||||
documentation,
|
||||
},
|
||||
{
|
||||
title: 'MicroBadger Size (tag)',
|
||||
pattern: ':user/:repo/:tag',
|
||||
namedParams: { user: 'fedora', repo: 'apache', tag: 'latest' },
|
||||
staticPreview: this.render({ size: 103000000 }),
|
||||
keywords: ['docker'],
|
||||
documentation,
|
||||
},
|
||||
]
|
||||
|
||||
static get defaultBadgeData() {
|
||||
return { label: 'image size' }
|
||||
static defaultBadgeData = {
|
||||
label: 'image size',
|
||||
}
|
||||
|
||||
static render({ size }) {
|
||||
|
||||
@@ -46,42 +46,34 @@ const documentation = `
|
||||
`
|
||||
|
||||
module.exports = class MozillaObservatory extends BaseJsonService {
|
||||
static get category() {
|
||||
// TODO: Once created, change to a more appropriate category,
|
||||
// see https://github.com/badges/shields/pull/2926#issuecomment-460777017
|
||||
return 'monitoring'
|
||||
// TODO: Once created, change to a more appropriate category,
|
||||
// see https://github.com/badges/shields/pull/2926#issuecomment-460777017
|
||||
static category = 'monitoring'
|
||||
|
||||
static route = {
|
||||
base: 'mozilla-observatory',
|
||||
pattern: ':format(grade|grade-score)/:host',
|
||||
queryParamSchema,
|
||||
}
|
||||
|
||||
static get route() {
|
||||
return {
|
||||
base: 'mozilla-observatory',
|
||||
pattern: ':format(grade|grade-score)/:host',
|
||||
queryParamSchema,
|
||||
}
|
||||
}
|
||||
static examples = [
|
||||
{
|
||||
title: 'Mozilla HTTP Observatory Grade',
|
||||
namedParams: { format: 'grade', host: 'github.com' },
|
||||
staticPreview: this.render({
|
||||
format: 'grade',
|
||||
state: 'FINISHED',
|
||||
grade: 'A+',
|
||||
score: 115,
|
||||
}),
|
||||
queryParams: { publish: null },
|
||||
keywords: ['scanner', 'security'],
|
||||
documentation,
|
||||
},
|
||||
]
|
||||
|
||||
static get examples() {
|
||||
return [
|
||||
{
|
||||
title: 'Mozilla HTTP Observatory Grade',
|
||||
namedParams: { format: 'grade', host: 'github.com' },
|
||||
staticPreview: this.render({
|
||||
format: 'grade',
|
||||
state: 'FINISHED',
|
||||
grade: 'A+',
|
||||
score: 115,
|
||||
}),
|
||||
queryParams: { publish: null },
|
||||
keywords: ['scanner', 'security'],
|
||||
documentation,
|
||||
},
|
||||
]
|
||||
}
|
||||
|
||||
static get defaultBadgeData() {
|
||||
return {
|
||||
label: 'observatory',
|
||||
}
|
||||
static defaultBadgeData = {
|
||||
label: 'observatory',
|
||||
}
|
||||
|
||||
static render({ format, state, grade, score }) {
|
||||
|
||||
@@ -12,55 +12,51 @@ const {
|
||||
})
|
||||
|
||||
class MyGetVersionService extends Version {
|
||||
static get examples() {
|
||||
return [
|
||||
{
|
||||
title: 'MyGet',
|
||||
pattern: 'myget/:feed/v/:packageName',
|
||||
namedParams: { feed: 'mongodb', packageName: 'MongoDB.Driver.Core' },
|
||||
staticPreview: this.render({ version: '2.6.1' }),
|
||||
static examples = [
|
||||
{
|
||||
title: 'MyGet',
|
||||
pattern: 'myget/:feed/v/:packageName',
|
||||
namedParams: { feed: 'mongodb', packageName: 'MongoDB.Driver.Core' },
|
||||
staticPreview: this.render({ version: '2.6.1' }),
|
||||
},
|
||||
{
|
||||
title: 'MyGet (with prereleases)',
|
||||
pattern: 'myget/:feed/vpre/:packageName',
|
||||
namedParams: { feed: 'mongodb', packageName: 'MongoDB.Driver.Core' },
|
||||
staticPreview: this.render({ version: '2.7.0-beta0001' }),
|
||||
},
|
||||
{
|
||||
title: 'MyGet tenant',
|
||||
pattern: ':tenant.myget/:feed/v/:packageName',
|
||||
namedParams: {
|
||||
tenant: 'dotnet',
|
||||
feed: 'dotnet-coreclr',
|
||||
packageName: 'Microsoft.DotNet.CoreCLR',
|
||||
},
|
||||
{
|
||||
title: 'MyGet (with prereleases)',
|
||||
pattern: 'myget/:feed/vpre/:packageName',
|
||||
namedParams: { feed: 'mongodb', packageName: 'MongoDB.Driver.Core' },
|
||||
staticPreview: this.render({ version: '2.7.0-beta0001' }),
|
||||
},
|
||||
{
|
||||
title: 'MyGet tenant',
|
||||
pattern: ':tenant.myget/:feed/v/:packageName',
|
||||
namedParams: {
|
||||
tenant: 'dotnet',
|
||||
feed: 'dotnet-coreclr',
|
||||
packageName: 'Microsoft.DotNet.CoreCLR',
|
||||
},
|
||||
staticPreview: this.render({ version: '1.0.2-prerelease' }),
|
||||
},
|
||||
]
|
||||
}
|
||||
staticPreview: this.render({ version: '1.0.2-prerelease' }),
|
||||
},
|
||||
]
|
||||
}
|
||||
|
||||
class MyGetDownloadService extends Downloads {
|
||||
static get examples() {
|
||||
return [
|
||||
{
|
||||
title: 'MyGet',
|
||||
pattern: 'myget/:feed/dt/:packageName',
|
||||
namedParams: { feed: 'mongodb', packageName: 'MongoDB.Driver.Core' },
|
||||
staticPreview: this.render({ downloads: 419 }),
|
||||
static examples = [
|
||||
{
|
||||
title: 'MyGet',
|
||||
pattern: 'myget/:feed/dt/:packageName',
|
||||
namedParams: { feed: 'mongodb', packageName: 'MongoDB.Driver.Core' },
|
||||
staticPreview: this.render({ downloads: 419 }),
|
||||
},
|
||||
{
|
||||
title: 'MyGet tenant',
|
||||
pattern: ':tenant.myget/:feed/dt/:packageName',
|
||||
namedParams: {
|
||||
tenant: 'dotnet',
|
||||
feed: 'dotnet-coreclr',
|
||||
packageName: 'Microsoft.DotNet.CoreCLR',
|
||||
},
|
||||
{
|
||||
title: 'MyGet tenant',
|
||||
pattern: ':tenant.myget/:feed/dt/:packageName',
|
||||
namedParams: {
|
||||
tenant: 'dotnet',
|
||||
feed: 'dotnet-coreclr',
|
||||
packageName: 'Microsoft.DotNet.CoreCLR',
|
||||
},
|
||||
staticPreview: this.render({ downloads: 9748 }),
|
||||
},
|
||||
]
|
||||
}
|
||||
staticPreview: this.render({ downloads: 9748 }),
|
||||
},
|
||||
]
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
|
||||
@@ -17,35 +17,27 @@ const statusMap = {
|
||||
}
|
||||
|
||||
module.exports = class Netlify extends BaseSvgScrapingService {
|
||||
static get category() {
|
||||
return 'build'
|
||||
static category = 'build'
|
||||
|
||||
static route = {
|
||||
base: 'netlify',
|
||||
pattern: ':projectId',
|
||||
}
|
||||
|
||||
static get route() {
|
||||
return {
|
||||
base: 'netlify',
|
||||
pattern: ':projectId',
|
||||
}
|
||||
}
|
||||
|
||||
static get examples() {
|
||||
return [
|
||||
{
|
||||
title: 'Netlify',
|
||||
namedParams: {
|
||||
projectId: 'e6d5a4e0-dee1-4261-833e-2f47f509c68f',
|
||||
},
|
||||
documentation:
|
||||
'To locate your project id, visit your project settings, scroll to "Status badges" under "General", and copy the ID between "/api/v1/badges/" and "/deploy-status" in the code sample',
|
||||
staticPreview: renderBuildStatusBadge({ status: 'passing' }),
|
||||
static examples = [
|
||||
{
|
||||
title: 'Netlify',
|
||||
namedParams: {
|
||||
projectId: 'e6d5a4e0-dee1-4261-833e-2f47f509c68f',
|
||||
},
|
||||
]
|
||||
}
|
||||
documentation:
|
||||
'To locate your project id, visit your project settings, scroll to "Status badges" under "General", and copy the ID between "/api/v1/badges/" and "/deploy-status" in the code sample',
|
||||
staticPreview: renderBuildStatusBadge({ status: 'passing' }),
|
||||
},
|
||||
]
|
||||
|
||||
static get defaultBadgeData() {
|
||||
return {
|
||||
label: 'netlify',
|
||||
}
|
||||
static defaultBadgeData = {
|
||||
label: 'netlify',
|
||||
}
|
||||
|
||||
static render({ status }) {
|
||||
|
||||
Reference in New Issue
Block a user