From 30ba3286e759605a23f3ae74028c93f6f4ce3b8e Mon Sep 17 00:00:00 2001 From: Amio Date: Wed, 1 Aug 2018 11:38:16 +0800 Subject: [PATCH 1/3] life-fns: use semColor on crates & pypi --- libs/live-fns/crates.js | 7 ++++--- libs/live-fns/pypi.js | 3 ++- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/libs/live-fns/crates.js b/libs/live-fns/crates.js index 04b0511..c699a31 100644 --- a/libs/live-fns/crates.js +++ b/libs/live-fns/crates.js @@ -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 { diff --git a/libs/live-fns/pypi.js b/libs/live-fns/pypi.js index 8faefcc..7d9045c 100644 --- a/libs/live-fns/pypi.js +++ b/libs/live-fns/pypi.js @@ -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 { From 47c56feb7910df08411bd4b2e21c96555fbb294c Mon Sep 17 00:00:00 2001 From: Amio Date: Wed, 1 Aug 2018 12:56:12 +0800 Subject: [PATCH 2/3] docs: update developing section --- README.md | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index d386928..8e8da1d 100644 --- a/README.md +++ b/README.md @@ -29,13 +29,17 @@ We are using [StandardJS][standard-href] style, make sure you have ESLint/Standa ### Add live badge -If a service you wish to have is still missing here, we welcome new contirbutions. Check out [live-fns/crates.js](libs/live-fns/crates.js) and [live-fns/_index.js](libs/live-fns/_index.js) to get a quick impression. Basically, you need to add a file in `libs/live-fns/[name-of-service].js` and that's it. +If a service you wish to have is still missing here, we welcome new contirbutions. Basically, you need to add a file in `libs/live-fns/[name-of-service].js` and that's it. Take [crates](https://badgen.net/#crates) as an example: + +- [libs/live-fns/crates.js](libs/live-fns/crates.js) - the main function for [crates.io](https://crates.io) +- [libs/live-fns/_index.js](libs/live-fns/_index.js) - the list of all live-badges +- [libs/index.md](libs/index.md) - the `index.md` holds examples To ensure that your addition is working correctly start the development server with `npm run dev`. -### Deploy your own Badgen +### Deploy to Now Cloud -Badgen generate badges on the fly, which means it's stateless (not rely on any db service). Deploy your own Badgen instance to [Now Cloud](https://zeit.co/now) with one single command: +Badgen generate badges on the fly, which means it's stateless (not rely on any db service). Deploy your own Badgen Service to [Now Cloud](https://zeit.co/now) with one single command: ``` now amio/badgen-service ``` From 32f14eb13d4a8f39ce86092b91f820ea44128d63 Mon Sep 17 00:00:00 2001 From: Amio Date: Wed, 1 Aug 2018 17:09:53 +0800 Subject: [PATCH 3/3] docs: bolder footer --- libs/index.md | 8 -------- libs/serve-index.js | 31 ++++++++++++++++++++++++++++++- 2 files changed, 30 insertions(+), 9 deletions(-) diff --git a/libs/index.md b/libs/index.md index 7a45405..b3e82c6 100644 --- a/libs/index.md +++ b/libs/index.md @@ -180,14 +180,6 @@ Available icons: } -## About - -Made with ❤️ by [Amio](https://github.com/amio) - - GitHub | - Twitter - -