Coder Social home page Coder Social logo

badgen / badgen.net Goto Github PK

View Code? Open in Web Editor NEW
1.4K 12.0 125.0 4.36 MB

Fast badge service

Home Page: https://badgen.net

License: ISC License

JavaScript 2.19% TypeScript 95.24% Dockerfile 0.09% CSS 2.48%
badgen badge badge-generator service svg live-badges

badgen.net's Issues

[idea] bare badge

  1. What about a badge without left hand-side label? Like this one with whole blue background:
    fake bare badge example

  2. The url could be:

    1. /b/:status - b stands for "bare" or shrunk "badge"
    2. /bare/:status
    3. other proposal

The idea comes from this tweet, will it be useful? Maybe use it for twitter badge or something, I think it would be better looking than current social badge.

Take a vote, πŸ‘for useful, πŸ‘Žfor not useful, πŸ˜„πŸŽ‰πŸ˜•for url options 1/2/3.

Pass request object as 1st argument to each live badge function

This will allow more flexibility and users of the RunKit will be able to access whatever they need. For example, getting req.path parsing it and getting queryparams so depending on some params, to base some logic.

For builtin ones, this will allow for listening on the registry_uri, for example, in the npm live badge. No need to have global support (inside all live badges) for this or such query params. Even can be more, for example in the npm default export it will be passed only to the /npm/v endpoint, so no security or such issues.

So

module.exports = async function npm (req, method, ...args) {
  switch (method) {
    case 'v':
      return version(req, args)
    case 'dt':
      return download('total', args)
  }
  // code ...
}

async function version (req, args) {
  const registry = qs.parse(req.path, true).registry_uri || 'registry.npmjs.org'

  // code ...
}

So nor other npm endpoints, nor other live badges will have access to that registry_uri query param, it just won't matter.

Bug in npm badges

Again. :D

@babel/core is cyan, but shouldn't be, because it is latest.

The cyan should be only if non-latest dist-tag is passed, no matter it is scoped or not.

Support for flat icons

I see that you support flat badges in badgen, are they supported here? I'm not seeing anything about flat icons inside the docs.

Cache is too long?

Pretty much.. After the last changes related to the cache, it started to feels.

I sometimes am forced to visit the badgen badge url to trigger refresh.
Not to mention this not always works ;d

Even with F5, even with CTRL+R, even with another browser - nothing.

Testing against canary

Run tests on real production environment πŸ’ͺ

Thanks to now alias this can be so easy!

  "scripts": {
    "deploy": "now && now alias badgen-canary",
    "postdeploy": "TARGET=https://badgen-canary.now.sh npm run test"
  }

GitHub release/tag is not perfect

More of a note to me.

Currently we get the "first in response array" tag/release.
The Babel example is perferct for showing the problem.

I think with /github/release/owner/repo we should show latest stable release/tag. In the case with Babel latest one happens to be a "prerelease", so it shows it in orange.

I'm thinking for this

  • /github/release/owner/repo should show lastest stable release (e.g. Babel's v6), in blue
  • /github/release/owner/repo/prerelease show latest prerelease

Or what about /github/prerelease/owner/repo for the prereleases and /github/release for the stable ones?

Perfect would be /github/release and /github/prerelease, because this will allow for static github badges like /github/release/owner/repo/v1.2.3 ... which... actually, not make much sense because you can just /badge/release/v1.2.3/color ;d

Launch badgen.net

πŸŽ‰πŸŽ‰πŸŽ‰

Badgen gets flatten!

What about badgen.now.sh?

https://badgen.now.sh will serves exactly the same as badgen.net, as long as badgen.net exists.
Secret: they are all now aliases of same service ;)

New live badges since Badgen’s reveal:

chrome-web-store, circleci, codecov, crates, david, github, homebrew, and uptime-robot, looking foward for more!

Query params support

label, emoji, list, checkout docs for details.

Badgen is on twitter

Say hi @badgen_net πŸ€—, updates are comming πŸ’ͺ

screen shot 2018-07-23 at 4 23 28 pm

[IDEA] Use cloudflare to cache and save on bandwidth

So this is not a real issue but just an idea.

I see that today, loading badgen.net takes 144 KB of bandwidth, and it will become bigger every time new badges are added.

image

As you said on your comment, the bandwidth usage is already pretty high, and I guess the index page is a big part of it.
Also, the response time on uptime robot is now > 500ms, which is a lot more than a few weeks ago.

Maybe you could use the free plan of Cloudflare to cache live badges for a few minutes, and static badges for a whole week!
Docs and index could also be cached for a few minutes
It could even prevent occasional downtime

More live badge support

There are two kinds of live badge in badgen service:

  1. Has "official" badge service with same style, like travis, circleci.
    badgen service will respond a 302 redirect to the official address, theoretically that should be the fastest badge service.
  2. Has an api for generating badge, like npm version, npm downloads.
    badgen service will respond a 302 redirect to resolved static badge url(In favor of Now CDN, no more perf tricks πŸŽ‰πŸ’ͺ) the badge, depends on api response, and cache that response data for 60 seconds.

If you would like to propose a badge, please post it here, the api service or the official badge url schema.

There's a long list on shields.io to implement one by one, hope that won't take too long :P

Support Cirrus CI

https://cirrus-ci.org/guide/writing-tasks/#embedded-badges

But not sure for the states. Also not sure which projects uses it so to use for examples.

I'm consider switching to it in near future. The only thing that stopping me currently is environment variables handling, which i highly depend on for my full automation of auto-release, auto-update and auto-publish flow.

The cool thing about CircleCi is that it allows you to have one "global store" of environment variables, so you set it once and every old and new project you setup you can access it.

It's quite slow to do that for each project. Add cirrus config file, go to cirrus dashboard add env to that specific repo and etc. All that was one of the reason i switched from travis.

So yea, Cirrus CI is amazing and fast, but. :D

Support `suffix`, `query` and `uri` query params

Related to one answer in Reddit.

https://www.reddit.com/r/javascript/comments/91m0cn/badgen_fast_badge_generating_service_shieldsio/e2zje8w

SO: https://stackoverflow.com/questions/50122026/how-to-get-the-number-of-people-in-a-getsatisfaction-community-for-shields-io/50122101#50122101


The suffix is kinda good idea. But uri may be a bit more complex.

  • uri is for replacing the request endpoint, for example, to npm API
  • query is for selecting things from the return by uri data
  • suffix is value appeded to the right side of the badge

Support for npm downloads total

It seems it's missing.

![](https://img.shields.io/npm/dt/react.svg)

badge:


daaaamn, btw.. more often and more often Shields goes too slow.

Welcome docs

I've added a "Badgen Story" to README.md (@olstenlarck I stole you a word :P), hoping to give new comers a general idea how Badgen comes from.

While I'm not sure I spells everything correctly and didn't cause anything confusion, if you find something weird please let me know πŸ˜…

Besides that, do you think there should be a guide(some sort of anatomy of the project) helping new contributor to get hands on this quickly? What should get explained/mentioned in the guide?

Coveralls branch percentage bug?

I'm not sure if this is a bug in badgen or Coveralls API, but shields.io seems to be returning the expected 100% while badgen seems to be using a percentage from a recent PR.

Badgen URL: https://flat.badgen.net/coveralls/c/github/expressjs/morgan/master
shields.io URL: https://img.shields.io/coveralls/expressjs/morgan/master.svg?style=flat-square

Rendered:
Badgen:
shields.io:

Rename/consistency for CIs - Circle, Travis, AppVeyor

For consistency, i think it would be good all of the CIs to be build | passing or build | success, or every CI to have label its name, or every CI badge to be same, except icons

  • CircleCI or
  • TravisCI or
  • AppVeyorCI or

Always dreamed about that πŸ˜†

Would be awesoome if they include icons by default and be build | passing.

Hm. What about "icon style" at icon.badgen.net? So all badges will have their respective icons (if they have). How cool is that (btw, should add white icons too ;d)

Bugs badge

Each issue can have some labels, for example: bug. It'd be very nice to retrieve the amount of open issues labeled bug :) The label doesn't have to be named bug. Note it can be bleeding bug or buggy or something like that :)

Example badge:

travis redirect build unknown

I have a repo: https://github.com/styfle/packagephobia

I tried visiting https://badgen.now.sh/travis/styfle/packagephobia which redirects to https://api.travis-ci.com/styfle/packagephobia.svg?branch=master but that shows "build unknown".

My readme is currently using https://travis-ci.org/styfle/packagephobia.svg?branch=master which redirects to https://api.travis-ci.org/styfle/packagephobia.svg?branch=master and this correctly hows "build passing"

Note the difference here is .com vs .org.

Feature request: Support path query param for david-dm badges

david-dm supports passing a path parameter to read package.json related to the github repo + path specified in the parameter.

This makes it possible for monorepos that include multiple packages (mulitple package.json files) to list dependency information via david-dm for the specific packages. Zendesk Garden is a monorepo using this feature of david-dm: https://github.com/zendeskgarden/react-components#installation

Note that zendesk garden is using shields.io for these badges.

This feature request is for adding path support for david-dm badges to badgen.

Here is a valid david-dm URL using path to get dependency info for package in a monorepo:
https://david-dm.org/cerner/terra-framework?path=packages/terra-hookshot

Here is what I'm thinking for the badgen API for this:
https://badgen.net/david/cerner/terra-framework?path=packages/terra-hookshot

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.