badgen.net/README.md

121 wiersze
6.9 KiB
Markdown
Czysty Zwykły widok Historia

2018-08-18 17:00:35 +00:00
<p align="center">
<img height="60px" width="60px" src="https://badgen.net/static/badgen-logo.svg" />
<h1 align="center">Badgen Service</h1>
</p>
2018-08-18 17:28:08 +00:00
2018-08-18 17:00:35 +00:00
<p align="center">
<a href="https://status.badgen.net/"><img src="https://badgen.net/uptime-robot/week/m780862024-50db2c44c703e5c68d6b1ebb?label=past%20week%20uptime" /></a>
2018-08-23 05:59:43 +00:00
<a href="https://stats.uptimerobot.com/z6nqBfYGB/780862024"><img src="https://badgen.net/uptime-robot/response/m780862024-50db2c44c703e5c68d6b1ebb" /></a>
2018-08-18 17:00:35 +00:00
<a href="LICENSE.md"><img src="https://badgen.net/github/license/amio/badgen-service" /></a>
2019-06-09 13:08:41 +00:00
<a href="https://twitter.com/badgen_net"><img src="https://badgen.net/badge/twitter/@badgen_net/1DA1F2?icon&label" /></a>
2019-06-19 01:22:20 +00:00
<a href="https://opencollective.com/badgen"><img src="https://badgen.net/badge/support/badgen/3988FB"/></a>
2018-08-18 17:00:35 +00:00
</p>
2018-07-21 13:56:29 +00:00
2018-08-18 17:28:08 +00:00
<p align="center">Home of <a href="https://badgen.net">badgen.net</a>, fast badge generating service.</p>
2018-07-21 13:56:29 +00:00
2018-08-08 18:23:50 +00:00
## The Badgen Story
> That's a service, that's a library, hooorey! - [@tunnckoCore](https://github.com/amio/badgen-service/pull/17)
2018-08-15 13:06:12 +00:00
> Finally something to replace http://shields.io - [@EGOIST](https://twitter.com/_egoistlily/status/1024202206185119744)
> Epic work on Badgen! Porting the @dependabot badges over to it now. ⚡️ - [@greybaker](https://twitter.com/greybaker/status/1023253585021333504)
2018-09-05 14:27:34 +00:00
The [badgen](https://github.com/amio/badgen) library was born as an exploration of "is it possible to generate badge SVG markup directly with JavaScript (without using pdfkit/canvas/puppeteer to measure text length)?". The result is better than I expected, Verdana (the de-facto font for badges) text width can be calculated precisely with a prebuilt [char-width-table](https://github.com/amio/badgen/blob/master/lib/widths-verdana-110.json), even no need to worry about kerning 🤯
2018-08-08 18:23:50 +00:00
2018-08-21 10:03:01 +00:00
Then, logically, [Badgen Service](https://badgen.net) was born. I had a good time with [shields.io](https://shields.io), but as time goes by Shields gets slower, leaves more and more broken badges in READMEs. Badgen is trying to be a fast alternative with simplicity and flexibility. Its codebase is simple (<b title="cloc . --exclude-dir node_modules --match-f '.js$'">2K LoCs</b> vs Shields' 22K LoCs), well structured and fun to develop - it is pretty easy to add badge(s) for new service(s).
2018-08-08 18:23:50 +00:00
In the beginning, I was considering both [Now](https://zeit.co/now) and [Google Cloud Functions](https://cloud.google.com/functions/). Then Zeit announced [Now CDN](https://zeit.co/blog/now-cdn) on the same day as badgen.now.sh (the PoC of Badgen Service)'s reveal, what a fate! Cloudflare powered Now CDN is a perfect choice for such service, caching and scalability in simplicity. Badgen is the fastest possible badge generating service out there. It's fast, it's reliable, it's globally distributed and cached, thanks to Now.
2018-08-08 18:23:50 +00:00
At the time of badgen.now.sh's reveal, it had only four live badges as demonstrations. Since then, thanks to [awesome people](https://github.com/amio/badgen-service/graphs/contributors)'s help, Badgen keeps getting better at a fast pace. Welcome to join us, let's build the best badge service in the universe 🔥
2018-08-08 18:23:50 +00:00
## Anatomy
2018-08-07 09:34:21 +00:00
2019-06-11 08:02:25 +00:00
- Written in TypeScript
- Using [badgen](https://github.com/amio/badgen) library to generate svg on the fly
- Two styles
2018-08-07 09:34:21 +00:00
- https://badgen.net - classic style badges
- https://flat.badgen.net - flat & square style badges
- Two badge types
2019-06-20 03:50:12 +00:00
- static badge - URL defined badge (label, status, color)
- live badge - Show live status from 3rd party services
- Builtin Icons & External Icon Support
- see [badgen-icons](https://github.com/badgen/badgen-icons)
2019-06-11 08:02:25 +00:00
- Docker image [amio/badgen](https://hub.docker.com/r/amio/badgen)
2018-07-15 14:49:46 +00:00
## Developing
2018-08-31 17:01:12 +00:00
[![Contributors][contributors-src]][contributors-href]
[![StandardJS][standard-src]][standard-href]
[![Dependencies][dependencies-src]][dependencies-href]
2018-08-14 08:41:00 +00:00
[![Maintainability][maintainability-src]][maintainability-href]
[![Code Quality][codequality-src]][codequality-href]
2019-06-11 08:02:25 +00:00
[![Docker image][docker-src]][docker-href]
2018-07-22 13:57:45 +00:00
We are using [StandardJS][standard-href] style, make sure you have ESLint/Standard plugin on your editor and have autofix enabled.
2019-06-18 14:02:42 +00:00
**start dev server**
npm run dev
2019-07-06 10:15:06 +00:00
**run with docker**
2019-06-18 14:02:42 +00:00
docker run -p 3000:3000 amio/badgen
2019-06-10 11:39:39 +00:00
### Add Live Badge
2019-07-19 04:57:36 +00:00
If a service you wish to have is still missing here, we welcome new contributions. Basically, you need to add a file in `endpoints/[name-of-service].ts` and that's it. Take [/crates](https://badgen.net/crates) as an example:
2018-08-01 04:56:12 +00:00
2019-06-02 14:17:50 +00:00
- [endpoints/crates.ts](endpoints/crates.ts) - main function for [crates](https://badgen.net/docs/crates) badges
- [libs/badge-list.ts](libs/badge-list.ts) - contains index of all live badges
2019-06-02 14:17:50 +00:00
To ensure that your addition is working correctly, start the development server with `npm run dev`.
2018-07-10 08:17:58 +00:00
2019-06-18 13:53:35 +00:00
__NOTES__
- You can create live badge without touching badgen.net's code. Checkout docs for [/runkit](https://badgen.net/docs/runkit) or [/https](https://badgen.net/docs/https).
2019-07-19 04:57:36 +00:00
- The [/runkit](https://badgen.net/docs/runkit) support would be super handy for prototyping a new live badge.
2018-09-19 08:11:50 +00:00
2019-06-10 11:39:39 +00:00
### Add Icon
2018-08-07 09:34:21 +00:00
2019-01-04 14:29:13 +00:00
You can contribute icons to [badgen-icons](https://github.com/badgen/badgen-icons). Please make sure new icon is optimized using [svgomg](https://jakearchibald.github.io/svgomg/).
2018-08-07 09:34:21 +00:00
2018-08-10 07:40:17 +00:00
## Tracking Policy
2019-07-26 09:29:34 +00:00
Badgen use [Sentry](https://sentry.io) to collect errors for improving service, use Google Analytics on doc pages ([home](https://badgen.net), [/github](https://badgen.net/github), [/packagephobia](https://badgen.net/packagephobia), etc.) to understand overall usage.
2018-08-10 07:40:17 +00:00
2019-06-10 11:39:39 +00:00
Badgen do not collect any identifying information.
2018-08-10 07:40:17 +00:00
2019-06-10 11:39:39 +00:00
## Contributors
2019-06-19 01:22:20 +00:00
Thanks to our [contributors][contributors-href] 🎉👏
2018-06-26 05:39:49 +00:00
2019-08-24 15:57:03 +00:00
[![](https://opencollective.com/badgen/contributors.svg?width=980&button=false)][contributors-href]
2018-07-22 13:57:45 +00:00
2019-06-19 01:22:20 +00:00
## Support Badgen
We are on OpenCollective https://opencollective.com/badgen
Support this project by donation, help Badgen continue and evolving!
[[Become a backer](https://opencollective.com/badgen#backer)]
2019-06-30 03:03:06 +00:00
## Sponsors
2019-08-24 15:57:03 +00:00
<a href="https://sentry.io"><img src="https://sentry-brand.storage.googleapis.com/sentry-logo-black.png" height="64px" /></a>
2019-06-30 03:03:06 +00:00
2019-06-19 01:22:20 +00:00
[dependencies-src]: https://badgen.net/david/dep/badgen/badgen.net?label=deps
[dependencies-href]: https://david-dm.org/badgen/badgen.net
[standard-src]: https://badgen.net/badge/code%20style/standard/pink
2018-08-08 18:23:50 +00:00
[standard-href]: https://standardjs.com
2019-06-19 01:22:20 +00:00
[maintainability-src]: https://badgen.net/codeclimate/maintainability/badgen/badgen.net
[maintainability-href]: https://codeclimate.com/github/badgen/badgen.net
[codequality-src]: https://badgen.net/lgtm/grade/javascript/g/badgen/badgen.net
[codequality-href]: https://lgtm.com/projects/g/badgen/badgen.net/context:javascript
[contributors-src]: https://badgen.net/github/contributors/badgen/badgen.net
[contributors-href]: https://github.com/badgen/badgen.net/graphs/contributors
2019-06-11 08:02:25 +00:00
[docker-src]: https://badgen.net/badge/docker/amio%2Fbadgen?label&icon=docker
[docker-href]: https://hub.docker.com/r/amio/badgen