npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@bfra.me/badge-config

v0.2.0

Published

TypeScript API for generating shields.io badge URLs with preset generators

Readme

@bfra.me/badge-config

A TypeScript API for generating shields.io badge URLs with presets for common use cases.

Installation

pnpm add @bfra.me/badge-config

Usage

Basic Usage

Create a simple badge by providing a label, message, and color.

import { createBadge } from '@bfra.me/badge-config';

const badgeUrl = createBadge({
  label: 'build',
  message: 'passing',
  color: 'green',
});

console.log(badgeUrl);
// => https://img.shields.io/badge/build-passing-green

Using Presets

The package includes preset generators for common badges like build status, coverage, version, and license.

Build Status

import { buildStatus } from '@bfra.me/badge-config/generators';

const successBadge = buildStatus('success');
// => https://img.shields.io/badge/build-success-green

const failureBadge = buildStatus('failure');
// => https://img.shields.io/badge/build-failure-red

Coverage

The coverage preset automatically adjusts the color based on the percentage.

import { coverage } from '@bfra.me/badge-config/generators';

const highCoverage = coverage(95);
// => https://img.shields.io/badge/coverage-95%25-green

const lowCoverage = coverage(45);
// => https://img.shields.io/badge/coverage-45%25-red

API

createBadge(options)

Generates a shields.io badge URL.

  • options (BadgeOptions): Configuration object.
    • label (string): The text on the left side of the badge.
    • message (string): The text on the right side of the badge.
    • color (string): The color of the right side of the badge.
    • style ('plastic' | 'flat' | 'flat-square' | 'for-the-badge' | 'social'): The badge style.
    • logo (string): A named logo from simple-icons.
    • logoColor (string): The color of the logo.

Preset Generators

buildStatus(status)

  • status ('success' | 'failure' | 'pending' | 'running'): The build status.

coverage(percentage)

  • percentage (number): The code coverage percentage (0-100).

version(versionString)

  • versionString (string): A semantic version string.

license(licenseType)

  • licenseType ('MIT' | 'Apache-2.0' | 'GPL-3.0'): The license type.

CI/CD Integration

You can use @bfra.me/badge-config in your CI/CD pipeline to generate dynamic badges.

GitHub Actions Example

# .github/workflows/ci.yml
name: CI

on: [push]

jobs:
  build:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v3
      - uses: pnpm/action-setup@v2
        with:
          version: 8
      - name: Install dependencies
        run: pnpm install
      - name: Generate Badges
        id: generate_badges
        run: |
          # Example script to generate badges
          # You would replace this with your own script using @bfra.me/badge-config
          echo "::set-output name=build_badge::https://img.shields.io/badge/build-passing-green"
      - name: Update README
        run: |
          # Example of updating README with the new badge
          # This is a simplified example. A more robust solution would use a templating engine.
          sed -i "s|!\[Build Status\].*|![Build Status](${{ steps.generate_badges.outputs.build_badge }})|" README.md

Performance

URL generation is synchronous and very fast. For applications requiring thousands of badges, consider caching the results to avoid redundant computations.


This README was generated with the help of GitHub Copilot.