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

@percy/styleguidist

v1.0.0

Published

Percy CLI plugin for visual testing React Styleguidist components

Readme

@percy/styleguidist

Version

Percy visual testing for React Styleguidist components.

Installation

npm install --save-dev @percy/cli @percy/styleguidist

Usage

Build your styleguide, then run Percy:

# Build the styleguide
npx styleguidist build

# Run Percy snapshots
export PERCY_TOKEN="your-token"
percy styleguidist ./styleguide

Or with a running dev server:

percy styleguidist http://localhost:6060

Or run the dev server and Percy in one step:

export PERCY_TOKEN="your-token"
percy styleguidist-start --port 6060

Commands

percy styleguidist

Usage:
  $ percy styleguidist [options] <url|directory>

Options:
  -i, --include <pattern>   Include components matching pattern
  -e, --exclude <pattern>   Exclude components matching pattern
  --config <path>           Path to styleguide.config.js

Examples:
  $ percy styleguidist ./styleguide
  $ percy styleguidist http://localhost:6060
  $ percy styleguidist ./styleguide --include "Button*"
  $ percy styleguidist ./styleguide --exclude "Internal*"

Per-Component Configuration

Add a JSON sidecar file next to your component to configure Percy options:

src/components/Button/
  Button.js       # component
  Button.md       # RSG examples
  Button.json     # Percy config (optional)
{
  "percy": {
    "widths": [375, 1280],
    "percyCSS": ".tooltip { display: none; }",
    "scope": ".button-wrapper",
    "browsers": ["chrome", "firefox"],
    "regions": [
      {
        "elementSelector": { "elementCSS": ".dynamic-content" },
        "algorithm": "ignore"
      }
    ],
    "additionalSnapshots": [
      { "suffix": " - Mobile", "widths": [375] },
      { "prefix": "Tablet ", "widths": [768] }
    ]
  }
}

Supported Options

| Option | Type | Description | |---|---|---| | skip | boolean | Skip this component | | widths | int[] | Viewport widths | | minHeight | int | Minimum viewport height | | browsers | string[] | Browsers to render (chrome, firefox, etc.) | | percyCSS | string | CSS injected before capture | | scope | string | CSS selector to scope the snapshot | | domTransformation | string | JS to transform DOM before capture | | enableJavaScript | boolean | Keep JS enabled in Percy rendering | | waitForSelector | string | Wait for selector before capture | | waitForTimeout | int | Wait ms before capture | | regions | array | Ignore/layout regions for visual diffing | | additionalSnapshots | array | Extra snapshots with different options |

Additional Snapshot Options

| Option | Type | Description | |---|---|---| | name | string | Full snapshot name (overrides prefix/suffix) | | prefix | string | Prefix added to component name | | suffix | string | Suffix added to component name | | widths | int[] | Override widths for this snapshot | | percyCSS | string | Override CSS for this snapshot |

Note on JSON sidecar safety: sidecars are loaded from disk, not reviewed like JS, so we only honor an allowlist of non-executable options: the keys in the two tables above. Anything else (including execute and domTransformation) is dropped at read time with a warning. If an additionalSnapshots entry's only differentiator was a stripped key (so it would just duplicate the base snapshot), the entry itself is dropped with a Dropping additionalSnapshot ... warning.

For state-mutating snapshots, configure execute in .percy.yml (which is committed alongside JS code and reviewed) or drive captures through the Percy programmatic API.

Components without a .json file use global Percy defaults from .percy.yml.

Programmatic API

For custom orchestration (combining with other Percy plugins, filtering by git diff, integrating with a test runner), drive captures from JS:

import { Percy } from '@percy/core';
import { takeStyleguidistSnapshots } from '@percy/styleguidist';

const percy = new Percy({ delayUploads: true });
await percy.start();

try {
  const result = await takeStyleguidistSnapshots(percy, {
    baseUrl: 'http://localhost:6060',
    configPath: './styleguide.config.cjs',
    include: ['Button*'],
    exclude: ['Internal*']
  });
  console.log(`Captured ${result.captured}/${result.total}`);
} finally {
  await percy.stop();
}

takeStyleguidistSnapshots(percy, opts) returns { captured, failed, total }. It does not throw on per-component failures — your code decides whether to fail the build based on the counters.

Options:

  • baseUrl (required) — Styleguidist URL
  • configPath (optional) — path to styleguide.config.js
  • include / exclude (optional) — arrays of patterns
  • components (optional) — pre-discovered components; skips internal discovery + filtering
  • log (optional) — logger with warn/error/debug methods