Bläddra i källkod

Update API

Change query params to accommodate other dynamic fields.
master
TheoryOfNekomata 4 år sedan
förälder
incheckning
20ee206544
1 ändrade filer med 8 tillägg och 2 borttagningar
  1. +8
    -2
      getBadgeUrl.js

+ 8
- 2
getBadgeUrl.js Visa fil

@@ -20,11 +20,14 @@ module.exports = async ({
let badgeUrl

switch (type) {
case 'version':
case 'package':
if (!['name', 'version'].includes(kind)) {
return null
}
badgeUrl = new URL(`/badge/dynamic/json`, process.env.SHIELDS_IMAGE_BASE_URL)
badgeUrl.search = new URLSearchParams({
color,
query: '$.version',
query: `$.${kind}`,
label: repo,
style,
labelColor,
@@ -32,6 +35,9 @@ module.exports = async ({
}).toString()
return badgeUrl
case 'dependency':
if (!['dependencies', 'devDependencies', 'peerDependencies', 'optionalDependencies'].includes(kind)) {
return null
}
const brands = await loadBrands()
const libraryInfo = getLibraryColor(library, brands, RESOLVE)
const libraryColor = libraryInfo ? libraryInfo.color.replace('#', '') : `${labelColor}`


Laddar…
Avbryt
Spara