Giter Club home page Giter Club logo

version-badge's Introduction

Version Badge

Create badges to display if a given version of a programming language, framework etc. is still supported or if it's EOL (end-of-life).

php 7.1 nodejs 16

Supported products and version ranges can be seen in versions.ts. If there are some versions missing or you don't find a programming language/framework you would like to use it with, PRs are welcome.

Version Badge exposes 3 endpoints that are run as Netlify Functions.

All endpoints require two parameters, lang and version.

  • lang: name of the language/framework (as written in versions.ts)
  • version: semver compatible version identifier, for example 1.2.3, 2.5, 4.6.x, >=1.0.0, v2 etc.

Shields IO

Returns Shields IO compatible data to generate a live badge image.

Endpoint: https://version-badge.netlify.app/shields/:lang/:version

Combine with https://img.shields.io/endpoint and provide version-badge endpoint as url query parameter.
Add style query parameter to use a different badge image style (see https://shields.io/#styles for available styles).

More information about using Shields IO with custom endpoint: https://shields.io/endpoint

Shields IO supports caching badges and Version Badge currently sets the cache to 24h (but you can override it with an URL parameter if needed, read more from the link above).

Note, any characters that require URL encoding in the Version Badge URL need to be double encoded as the URL is also passed as URL parameter to Shields IO, e.g. >= (see examples).

Examples

![php 7.1](https://img.shields.io/endpoint?url=https://version-badge.netlify.app/shields/php/7.1)
php 7.1

![nodejs 16](https://img.shields.io/endpoint?style=flat-square&url=https://version-badge.netlify.app/shields/nodejs/%253E%253D16)
nodejs 16

Badgen

Returns Badgen compatible data to generate a live badge image.

Endpoint: https://version-badge.netlify.app/badgen/:lang/:version

Combine with https://badgen.net/https prefix and without https://. Use https://flat.badgen.net/https prefix for flat badge image style.

More information about using Badgen with custom endpoint: https://badgen.net/https

Note, remember to URL encode any characters that require it, e.g. >=

Examples

![php 7.1](https://badgen.net/https/version-badge.netlify.app/badgen/php/7.1)
php 7.1

![nodejs 16](https://flat.badgen.net/https/version-badge.netlify.app/badgen/nodejs/%3E%3D16)
nodejs 16

Version EOL

Returns EOL informations as JSON. Can be used to create custom implementations of version EOL check. For example if you want to integrate it in a CI pipeline etc.

Endpoint: https://version-badge.netlify.app/version-eol

Response format:

type VersionResult = {
    lang: string;
    version: string;
    eol: DateString | "current"; // Date string as YYYY-MM-DD
    isEol: boolean;
    isNearEol: boolean; // true when EOL upcoming within 6 months
}

Can be called with either GET or POST request.

With GET request, provide lang and version as query parameters.

With POST request, send JSON body with an object that has keys lang and version.

Examples

GET https://version-badge.netlify.app/version-eol?lang=nodejs&version=16.0

POST https://version-badge.netlify.app/version-eol
With body { "lang": "nodejs", "version": "16.0" }

Response:

{
    "version": "16.x",
    "eol": "2024-04-30",
    "lang": "nodejs",
    "isEol": false,
    "isNearEol": false
}

version-badge's People

Contributors

cvuorinen avatar

Watchers

James Cloos avatar  avatar

Forkers

taasko

version-badge's Issues

EOL API

Instead of hard coding, maybe use some API to get EOLs. I found out that endoflife.date returns jsons too, for example: https://endoflife.date/api/postgresql.json

Requesting big-ass json for every badge would be overkill, but can Netlify utilize any kind of caching? Or how about some script to update latest version jsons once in a week with GitHub Actions ๐Ÿค”

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.