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

performance-budget-enforcer

v1.1.0

Published

CI plugin that scans React/Next.js builds, detects bundle size regressions, and fails CI if budgets are exceeded

Readme

Performance Budget Enforcer

A CI plugin that scans React/Next.js builds, detects bundle size regressions, and fails CI if performance budgets are exceeded.

Features

  • 🔍 Analyzes bundle sizes from Webpack, Vite, and Next.js builds
  • 📊 Identifies which dependencies caused bloat
  • 🚫 Fails CI when budgets are exceeded
  • 📈 Compares against baseline for regression detection
  • 💬 Posts PR comments with detailed reports
  • 📢 Sends Slack notifications on budget failures

Installation

npm install performance-budget-enforcer --save-dev

Usage

Initialize config

npx perf-budget init

This creates a perf-budget.json config file.

Analyze bundles

npx perf-budget analyze --dir .next

Check budget

npx perf-budget check --dir .next

Regression detection with baseline

# First run: save baseline
npx perf-budget analyze --dir .next -o baseline.json

# Later runs: compare against baseline
npx perf-budget check --dir .next --baseline baseline.json

Configuration

Edit perf-budget.json:

{
  "maxTotalSize": 500000,
  "maxGzippedSize": 150000,
  "maxChunkSize": 250000,
  "maxDependencySize": 100000,
  "thresholds": {
    "warning": 10,
    "error": 20
  }
}
  • All sizes are in bytes
  • maxTotalSize: Maximum total bundle size
  • maxGzippedSize: Maximum gzipped size
  • maxChunkSize: Maximum size for any single chunk
  • maxDependencySize: Maximum size for any dependency
  • thresholds.error: % growth vs baseline that triggers CI failure (default: 20%)

GitHub Integration

The tool automatically posts PR comments when budgets fail.

Set these environment variables in your CI:

- name: Performance Budget Check
  run: npx perf-budget check --dir .next
  env:
    GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
    GITHUB_PR_NUMBER: ${{ github.event.pull_request.number }}
    GITHUB_REPOSITORY: ${{ github.repository }}

Slack Integration

Get a webhook URL: https://api.slack.com/messaging/webhooks

Add environment variable:

- name: Performance Budget Check
  run: npx perf-budget check --dir .next
  env:
    SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
    SLACK_CHANNEL: #performance  # optional

Optional env vars:

  • SLACK_WEBHOOK_URL - Required webhook URL
  • SLACK_CHANNEL - Override default channel
  • SLACK_USERNAME - Custom username
  • SLACK_ICON_EMOJI - Custom emoji (default: :package:)

GitHub Actions Integration

name: Performance Budget

on:
  push:
    branches: [main]
  pull_request:
    branches: [main]

jobs:
  perf-budget:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4

      - uses: actions/setup-node@v4
        with:
          node-version: '20'
          cache: 'npm'

      - name: Install dependencies
        run: npm ci

      - name: Build
        run: npm run build

      - name: Download baseline
        if: github.event_name == 'pull_request'
        uses: actions/download-artifact@v4
        with:
          name: bundle-baseline
          path: .
        continue-on-error: true

      - name: Performance Budget Check
        run: npx perf-budget check --dir .next
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
          GITHUB_PR_NUMBER: ${{ github.event.pull_request.number }}
          GITHUB_REPOSITORY: ${{ github.repository }}
          SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}

      - name: Upload baseline
        if: github.ref == 'refs/heads/main'
        uses: actions/upload-artifact@v4
        with:
          name: bundle-baseline
          path: baseline.json

Commands

  • perf-budget analyze [options] - Analyze bundle sizes
  • perf-budget check [options] - Check against budget
  • perf-budget init - Create config file

Options

  • -d, --dir <path> - Build directory (default: ./build)
  • -c, --config <path> - Config file (default: ./perf-budget.json)
  • -b, --baseline <path> - Baseline file for regression detection
  • -o, --output <path> - Output JSON file
  • --fail - Exit with code 1 if budget exceeded (default: true)