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