Nary a Package Missing

    @adso-ts/badges
    TypeScript icon, indicating that this package has built-in type declarations

    1.1.4 • Public • Published

    SVG badges generator for your repository

    Module installs the following binary commands:

    • coverage-badges - Jest test coverage badges from coverage-summary.json (options: --read, --save)
    • custom-badges - Configurable badges from badges.json (options: --read, --save)
    • version-badge - Package version badge from package.json (options: --save)

    Installation:

    yarn add @adso-ts/badges

    Dependencies

    For coverage-badges

    Jest coverage report must be saved as coverage-summary.json, thus requires the following entries in jest.config.js are necessary:

    module.exports = {
      ...
        collectCoverage: true,
        coverageReporters: ['json-summary'],
      ...
    };

    For custom-badges

    A config file must be present and pointed to when executing custom-badges command.

    {
      "badges": [
        {
          "badge_name": {
            "label": "Badge label",
            "value": "value to show",
            "color": "hexadecimal color for value background"
          }
        }
      ]
    }

    Generate badges:

    yarn script in package.json

    "scripts": {
        "coverage-badges": "coverage-badges --read=custom_path_to_coverage-summary.json --save=custom_badges_folder"
        "custom-badges": "custom-badges --read=custom_path_to_badges.json --save=custom_badges_folder"
        "version-badge": "version-badge --save=custom_badges_folder"
    }

    Console commands

      yarn coverage-badges
      yarn custom-badges
      yarn version-badge

    Parameters (optional)

    • read : alternative location of JSON file (coverage-summary.json or badges.json)
    • save : custom path to save badge svg files

    Usage in markdown files

    Jest test coverage

     ![Average](./badges/average.svg)  
     
     ![Lines](./badges/lines.svg)
     ![Statements](./badges/statements.svg)
     ![Branches](./badges/branches.svg)
     ![Functions](./badges/functions.svg)

    Package version

     ![Version](./badges/version.svg) 

    Custom/static badges examples

     ![npm](./badges/npm.svg)
     ![dependencies](./badges/dependencies.svg)

    Results

    Test coverage

    Average

    Lines Statements Branches Functions

    Version

    Version

    Custom/static badges examples

    npm dependencies

    Install

    npm i @adso-ts/badges

    DownloadsWeekly Downloads

    347

    Version

    1.1.4

    License

    MIT

    Unpacked Size

    44.3 kB

    Total Files

    41

    Last publish

    Collaborators

    • asokolowski