chore: add `.editorconfig` (#446)

Fix whitespace & missing newline issues.
pull/450/head
Dario Vladović 2020-11-08 03:39:19 +01:00 zatwierdzone przez GitHub
rodzic 839cf3aa64
commit 5ad28dad43
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 4AEE18F83AFDEB23
15 zmienionych plików z 113 dodań i 103 usunięć

13
.editorconfig 100644
Wyświetl plik

@ -0,0 +1,13 @@
# editorconfig.org
root = true
[*]
charset = utf-8
indent_size = 2
indent_style = space
end_of_line = lf
trim_trailing_whitespace = true
insert_final_newline = true
[*.md]
trim_trailing_whitespace = false

Wyświetl plik

@ -41,4 +41,3 @@ rules:
react/no-unused-prop-types: warn
react/react-in-jsx-scope: off
react/prop-types: off # TODO: open later

Wyświetl plik

@ -1,2 +1,2 @@
<!-- Love badgen? Please consider supporting our collective:
👉 https://opencollective.com/badgen/donate -->
👉 https://opencollective.com/badgen/donate -->

Wyświetl plik

@ -47,7 +47,7 @@ jobs:
with:
languages: ${{ matrix.language }}
# If you wish to specify custom queries, you can do so here or in a config file.
# By default, queries listed here will override any specified in a config file.
# By default, queries listed here will override any specified in a config file.
# Prefix the list here with "+" to use these queries and those in the config file.
# queries: ./path/to/local/query, your-org/your-repo/queries@main

Wyświetl plik

@ -1,3 +1,3 @@
{
"typescript.tsdk": "node_modules/typescript/lib"
}
}

Wyświetl plik

@ -36,4 +36,3 @@ async function handler ({ label, status, color }: PathArgs) {
// '/badge/platform/ios,macos,tvos?list=|': 'list (custom seprator)'
// }
// }

Wyświetl plik

@ -1,34 +1,34 @@
import got from '../libs/got'
import { version as versionName, versionColor } from '../libs/utils'
import { createBadgenHandler, PathArgs } from '../libs/create-badgen-handler'
export default createBadgenHandler({
title: 'Cocoapods',
examples: {
'/cocoapods/v/AFNetworking': 'version',
'/cocoapods/p/AFNetworking': 'platform',
},
handlers: {
'/cocoapods/:topic<v|p>/:pod': handler
}
})
async function handler ({topic, pod}: PathArgs) {
const endpoint = `https://trunk.cocoapods.org/api/v1/pods/${pod}/specs/latest`
const { version, platforms } = await got(endpoint).json<any>()
switch (topic) {
case 'v':
return {
subject: 'pod',
status: versionName(version),
color: versionColor(version)
}
case 'p':
return {
subject: 'platform',
status: Object.keys(platforms).join(' | '),
color: 'grey'
}
}
}
import got from '../libs/got'
import { version as versionName, versionColor } from '../libs/utils'
import { createBadgenHandler, PathArgs } from '../libs/create-badgen-handler'
export default createBadgenHandler({
title: 'Cocoapods',
examples: {
'/cocoapods/v/AFNetworking': 'version',
'/cocoapods/p/AFNetworking': 'platform',
},
handlers: {
'/cocoapods/:topic<v|p>/:pod': handler
}
})
async function handler ({topic, pod}: PathArgs) {
const endpoint = `https://trunk.cocoapods.org/api/v1/pods/${pod}/specs/latest`
const { version, platforms } = await got(endpoint).json<any>()
switch (topic) {
case 'v':
return {
subject: 'pod',
status: versionName(version),
color: versionColor(version)
}
case 'p':
return {
subject: 'platform',
status: Object.keys(platforms).join(' | '),
color: 'grey'
}
}
}

Wyświetl plik

@ -131,7 +131,7 @@ async function layersHandler ({ scope, name, tag, architecture, variant }: PathA
tag = tag ? tag : 'latest'
architecture = architecture ? architecture : 'amd64'
variant = variant ? variant : ''
const token = (await getDockerAuthToken(scope, name)).token
const manifest_list = await getManifestList(scope, name, tag, architecture, variant, token)
@ -160,7 +160,7 @@ async function metadataHandler ({ type, scope, name, tag, architecture, variant
tag = tag ? tag : 'latest'
architecture = architecture ? architecture : 'amd64'
variant = variant ? variant : ''
const token = (await getDockerAuthToken(scope, name)).token
const manifest_list = await getManifestList(scope, name, tag, architecture, variant, token)

Wyświetl plik

@ -262,4 +262,3 @@ const fullResponsePaths =
'tags',
'contributors'
]

Wyświetl plik

@ -1,55 +1,55 @@
import cheerio from 'cheerio'
import got from '../libs/got'
import { version as versionName, versionColor } from '../libs/utils'
import { createBadgenHandler, PathArgs } from '../libs/create-badgen-handler'
export default createBadgenHandler({
title: 'Maven',
examples: {
'/maven/v/maven-central/com.google.code.gson/gson': 'version (maven-central)',
'/maven/v/metadata-url/https/repo1.maven.org/maven2/com/google/code/gson/gson/maven-metadata.xml': 'version (maven metadata url)',
},
handlers: {
'/maven/v/maven-central/:group/:artifact': mavenCentralHandler,
'/maven/v/metadata-url/:path+': mavenUrlHandler,
}
})
async function mavenCentralHandler ({group, artifact}: PathArgs) {
group = group.replace(/\./g, '/')
const xml = await got(`https://repo1.maven.org/maven2/${group}/${artifact}/maven-metadata.xml`).text()
const version = getLastVersionFromMetadata(xml)
return {
subject: 'maven-central',
status: versionName(version),
color: versionColor(version)
}
}
async function mavenUrlHandler ({path}: PathArgs) {
if (path.startsWith('http/')) {
path = path.slice(0, 4) + ':/' + path.slice(4)
} else if (path.startsWith('https/')) {
path = path.slice(0, 5) + ':/' + path.slice(5)
} else if (path.startsWith('http:/')) {
path = path.slice(0, 5) + '/' + path.slice(5)
} else if (path.startsWith('https:/')) {
path = path.slice(0, 6) + '/' + path.slice(6)
}
const xml = await got(path).text()
const version = getLastVersionFromMetadata(xml)
return {
subject: 'maven',
status: versionName(version),
color: versionColor(version)
}
}
const getLastVersionFromMetadata = (xml: string) => {
const $ = cheerio.load(xml, {xmlMode: true})
const versions = $('metadata').children('versioning').children('versions').children('version')
if (versions.length === 0) {
return 'unknown'
}
return versions.last().text()
}
import cheerio from 'cheerio'
import got from '../libs/got'
import { version as versionName, versionColor } from '../libs/utils'
import { createBadgenHandler, PathArgs } from '../libs/create-badgen-handler'
export default createBadgenHandler({
title: 'Maven',
examples: {
'/maven/v/maven-central/com.google.code.gson/gson': 'version (maven-central)',
'/maven/v/metadata-url/https/repo1.maven.org/maven2/com/google/code/gson/gson/maven-metadata.xml': 'version (maven metadata url)',
},
handlers: {
'/maven/v/maven-central/:group/:artifact': mavenCentralHandler,
'/maven/v/metadata-url/:path+': mavenUrlHandler,
}
})
async function mavenCentralHandler ({group, artifact}: PathArgs) {
group = group.replace(/\./g, '/')
const xml = await got(`https://repo1.maven.org/maven2/${group}/${artifact}/maven-metadata.xml`).text()
const version = getLastVersionFromMetadata(xml)
return {
subject: 'maven-central',
status: versionName(version),
color: versionColor(version)
}
}
async function mavenUrlHandler ({path}: PathArgs) {
if (path.startsWith('http/')) {
path = path.slice(0, 4) + ':/' + path.slice(4)
} else if (path.startsWith('https/')) {
path = path.slice(0, 5) + ':/' + path.slice(5)
} else if (path.startsWith('http:/')) {
path = path.slice(0, 5) + '/' + path.slice(5)
} else if (path.startsWith('https:/')) {
path = path.slice(0, 6) + '/' + path.slice(6)
}
const xml = await got(path).text()
const version = getLastVersionFromMetadata(xml)
return {
subject: 'maven',
status: versionName(version),
color: versionColor(version)
}
}
const getLastVersionFromMetadata = (xml: string) => {
const $ = cheerio.load(xml, {xmlMode: true})
const versions = $('metadata').children('versioning').children('versions').children('version')
if (versions.length === 0) {
return 'unknown'
}
return versions.last().text()
}

Wyświetl plik

@ -83,7 +83,7 @@ async function npmMetadata (pkg: string, ver = 'latest'): Promise<any> {
}
const endpoint = `${host}/${pkg}/${ver}`
return got(endpoint).json<any>()
}
async function pkgJson (pkg: string, tag = 'latest'): Promise<any> {

Wyświetl plik

@ -59,7 +59,7 @@ async function handler ({ topic, pkg }: PathArgs) {
function getPackageInfo(html: string): PackageInfo {
const info: PackageInfo = { version: '', license: '', downloads: NaN }
const $ = cheerio.load(html)
const text = (selector: any) => $(selector).text().trim()

Wyświetl plik

@ -110,7 +110,7 @@ async function handler ({ topic, appId }: PathArgs) {
case 'v': {
const versions = await fetchVersions(appId)
const ver = last(versions).toString()
return {
subject: 'winget',
status: version(ver),

Wyświetl plik

@ -9,7 +9,7 @@ export function getDockerAuthToken<T = any>(scope: string, name: string) {
service: service,
scope: `repository:${scope}/${name}:pull`
}
const resp = got.get("token", { prefixUrl, searchParams }).json<T>()
if (! resp) {
@ -86,4 +86,4 @@ export async function getImageConfig<T = any>(scope: string, name: string, diges
throw new BadgenError({ status: 'image config error' })
}
return image_config
}
}

Wyświetl plik

@ -1 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 717.11 249.68"><title>sentry-logo-black</title><path d="M430.56,143.76,386.07,86.33H375v77h11.22v-59l45.74,59h9.82v-77H430.56Zm-112-14.27H358.4v-10H318.52V96.31h45v-10H307.07v77h57v-10H318.52Zm-46.84-9.78c-15.57-3.72-19.83-6.69-19.83-13.84,0-6.46,5.71-10.81,14.22-10.81,7.09,0,14.07,2.51,21.3,7.67l6.06-8.54c-8-6.13-16.65-9-27.13-9-15.25,0-25.89,9-25.89,21.92,0,13.84,9,18.63,25.5,22.63,14.51,3.35,18.93,6.5,18.93,13.5s-6,11.38-15.35,11.38c-9.07,0-16.81-3-25-9.82l-6.79,8.08a47.82,47.82,0,0,0,31.41,11.6c16.49,0,27.14-8.87,27.14-22.6C296.27,130.23,289.38,124,271.68,119.71Zm373.9-33.37-23.19,36.31-23-36.31H586l30.51,46.54v30.47h11.56V132.53l30.5-46.19ZM450.87,96.76H476.1v66.58h11.57V96.76h25.23V86.33h-62ZM566.4,133.28c11.64-3.21,18-11.37,18-23,0-14.78-10.84-24-28.28-24H522v77h11.45V135.62h19.42l19.54,27.72h13.37l-21.1-29.58Zm-33-7.52V96.53H555c11.27,0,17.74,5.31,17.74,14.56,0,8.91-6.92,14.67-17.62,14.67ZM144.9,65.43a13.75,13.75,0,0,0-23.81,0l-19.6,33.95,5,2.87a96.14,96.14,0,0,1,47.83,77.4H140.56a82.4,82.4,0,0,0-41-65.54l-5-2.86L76.3,143l5,2.87a46.35,46.35,0,0,1,22.46,33.78H72.33a2.27,2.27,0,0,1-2-3.41l8.76-15.17a31.87,31.87,0,0,0-10-5.71L60.42,170.5a13.75,13.75,0,0,0,11.91,20.62h43.25v-5.73A57.16,57.16,0,0,0,91.84,139l6.88-11.92a70.93,70.93,0,0,1,30.56,58.26v5.74h36.65v-5.73A107.62,107.62,0,0,0,117.09,95.3L131,71.17a2.27,2.27,0,0,1,3.93,0l60.66,105.07a2.27,2.27,0,0,1-2,3.41H179.4c.18,3.83.2,7.66,0,11.48h14.24a13.75,13.75,0,0,0,11.91-20.62Z" style="fill:#221f20"/></svg>
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 717.11 249.68"><title>sentry-logo-black</title><path d="M430.56,143.76,386.07,86.33H375v77h11.22v-59l45.74,59h9.82v-77H430.56Zm-112-14.27H358.4v-10H318.52V96.31h45v-10H307.07v77h57v-10H318.52Zm-46.84-9.78c-15.57-3.72-19.83-6.69-19.83-13.84,0-6.46,5.71-10.81,14.22-10.81,7.09,0,14.07,2.51,21.3,7.67l6.06-8.54c-8-6.13-16.65-9-27.13-9-15.25,0-25.89,9-25.89,21.92,0,13.84,9,18.63,25.5,22.63,14.51,3.35,18.93,6.5,18.93,13.5s-6,11.38-15.35,11.38c-9.07,0-16.81-3-25-9.82l-6.79,8.08a47.82,47.82,0,0,0,31.41,11.6c16.49,0,27.14-8.87,27.14-22.6C296.27,130.23,289.38,124,271.68,119.71Zm373.9-33.37-23.19,36.31-23-36.31H586l30.51,46.54v30.47h11.56V132.53l30.5-46.19ZM450.87,96.76H476.1v66.58h11.57V96.76h25.23V86.33h-62ZM566.4,133.28c11.64-3.21,18-11.37,18-23,0-14.78-10.84-24-28.28-24H522v77h11.45V135.62h19.42l19.54,27.72h13.37l-21.1-29.58Zm-33-7.52V96.53H555c11.27,0,17.74,5.31,17.74,14.56,0,8.91-6.92,14.67-17.62,14.67ZM144.9,65.43a13.75,13.75,0,0,0-23.81,0l-19.6,33.95,5,2.87a96.14,96.14,0,0,1,47.83,77.4H140.56a82.4,82.4,0,0,0-41-65.54l-5-2.86L76.3,143l5,2.87a46.35,46.35,0,0,1,22.46,33.78H72.33a2.27,2.27,0,0,1-2-3.41l8.76-15.17a31.87,31.87,0,0,0-10-5.71L60.42,170.5a13.75,13.75,0,0,0,11.91,20.62h43.25v-5.73A57.16,57.16,0,0,0,91.84,139l6.88-11.92a70.93,70.93,0,0,1,30.56,58.26v5.74h36.65v-5.73A107.62,107.62,0,0,0,117.09,95.3L131,71.17a2.27,2.27,0,0,1,3.93,0l60.66,105.07a2.27,2.27,0,0,1-2,3.41H179.4c.18,3.83.2,7.66,0,11.48h14.24a13.75,13.75,0,0,0,11.91-20.62Z" style="fill:#221f20"/></svg>

Przed

Szerokość:  |  Wysokość:  |  Rozmiar: 1.5 KiB

Po

Szerokość:  |  Wysokość:  |  Rozmiar: 1.5 KiB