feat: Deprecate /opam/dm (#548)

opam doesn't provide download statistics any more.
pull/549/head
Simmo Saan 2022-03-27 06:50:30 +03:00 zatwierdzone przez GitHub
rodzic fc8bf4cc70
commit 2fa35aa4e6
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 4AEE18F83AFDEB23
1 zmienionych plików z 1 dodań i 10 usunięć

Wyświetl plik

@ -1,5 +1,5 @@
import got from '../libs/got'
import { millify, version, versionColor } from '../libs/utils'
import { version, versionColor } from '../libs/utils'
import { createBadgenHandler, PathArgs } from '../libs/create-badgen-handler'
const OPAM_REPO_URL = 'https://opam.ocaml.org/packages/'
@ -9,7 +9,6 @@ export default createBadgenHandler({
examples: {
'/opam/v/merlin': 'version',
'/opam/v/ocamlformat': 'version',
'/opam/dm/lwt': 'monthly downloads',
'/opam/license/cohttp': 'license'
},
handlers: {
@ -37,13 +36,5 @@ async function handler ({ topic, pkg }: PathArgs) {
color: 'blue'
}
}
case 'dm': {
const downloads = Number(html.match(/<th>statistics<\/th>\s*<td>installed\s*<strong>([^<]+)<\//i)?.[1])
return {
subject: 'downloads',
status: millify(downloads) + '/month',
color: 'green'
}
}
}
}