kopia lustrzana https://github.com/badgen/badgen.net
life-fns: use semColor on crates & pypi
rodzic
d6677628a8
commit
30ba3286e7
|
@ -1,8 +1,9 @@
|
|||
const axios = require('../axios.js')
|
||||
const millify = require('millify')
|
||||
const semColor = require('../utils/sem-color.js')
|
||||
|
||||
module.exports = async function (topic, ...args) {
|
||||
const endpoint = `https://crates.io/api/v1/crates/${args[0]}`
|
||||
module.exports = async function (topic, pkg) {
|
||||
const endpoint = `https://crates.io/api/v1/crates/${pkg}`
|
||||
const { crate } = await axios.get(endpoint).then(res => res.data)
|
||||
|
||||
switch (topic) {
|
||||
|
@ -10,7 +11,7 @@ module.exports = async function (topic, ...args) {
|
|||
return {
|
||||
subject: 'crates.io',
|
||||
status: 'v' + crate.max_version,
|
||||
color: crate.max_version[0] === '0' ? 'orange' : 'blue'
|
||||
color: semColor(crate.max_version)
|
||||
}
|
||||
case 'd':
|
||||
return {
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
const axios = require('../axios.js')
|
||||
const semColor = require('../utils/sem-color.js')
|
||||
|
||||
module.exports = async function (method, project) {
|
||||
const endpoint = `https://pypi.org/pypi/${project}/json`
|
||||
|
@ -9,7 +10,7 @@ module.exports = async function (method, project) {
|
|||
return {
|
||||
subject: 'pypi',
|
||||
status: 'v' + info.version,
|
||||
color: info.version[0] === '0' ? 'orange' : 'blue'
|
||||
color: semColor(info.version)
|
||||
}
|
||||
default:
|
||||
return {
|
||||
|
|
Ładowanie…
Reference in New Issue