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

pr-scene

v1.7.0

Published

Demo your action: render believable pull request scenes

Readme

pr-scene

Render a believable pull request — comments, checks, reviews and merge state — from plain JSON, so your GitHub Action's demo page can show what it does before anyone installs it. Framework-agnostic HTML in one scoped stylesheet.

The playground lives at https://radomir.dev/pr-scene/.

Install

npm i pr-scene

Quick start

import { renderScene } from "pr-scene";
import "pr-scene/styles.css";

const scene = {
  pr: {
    title: "feat(api): add a sliding-window rate limiter",
    number: 482,
    author: "alex-dev",
    base: "main",
    head: "feat/rate-limiter",
    state: "open",
  },
  timeline: [
    {
      kind: "comment",
      comment: {
        author: "github-actions",
        bot: true,
        createdAt: "2026-11-26T11:58:00Z",
        body: "### CI\n\n- [x] Lint\n- [ ] Tests",
      },
    },
    { kind: "checks" },
  ],
  checks: [
    { name: "Lint", status: "passed", workflow: "CI", duration: "14s" },
    { name: "Tests", status: "running", workflow: "CI", duration: "32s" },
  ],
  mergeable: true,
};

document.querySelector("#pr").innerHTML = renderScene(scene, { theme: "light" });

renderScene returns the whole page: .ps-root carrying the theme, and .ps-page inside it. Pass now to freeze relative timestamps for screenshots.

The scene

pr, timeline, checks, mergeable and view are documented with their types in docs/scene.md. A minimal scene is just { pr }; the checks box then reports that status is pending.

Timeline items render in order:

  1. { kind: "comment", comment } — a card with avatar, author, optional bot pill, relative time, edited marker and sanitised markdown.
  2. { kind: "checks" } — the checks box and merge footer, with a status badge on the timeline rail.
  3. { kind: "review", review } — approved, changes-requested or commented.
  4. { kind: "merged", actor?, sha?, at? } — the purple merge event.

Theming

The stylesheet ships light and dark tokens switched by data-theme on .ps-root. renderScene(scene, { theme }) sets it, and scene.view.theme is the fallback when no option is given.

Markdown

Comment bodies run through marked with GFM, are sanitised with DOMPurify, and get GitHub's task-list classes with their checkboxes enabled. renderMarkdown(source, { mode: "source" }) returns an escaped pre instead, which keeps <!-- slot:name --> markers visible.

Known gaps

Fenced code with a language renders as plain code; GitHub wraps it in syntax-highlighted spans, and pr-scene does not. GitHub alerts (> [!NOTE], TIP, IMPORTANT, WARNING, CAUTION) are supported and covered by the golden fixtures.

Editing a comment

The helpers mirror the radomir-dev/actions contract, so a demo can react the way a workflow does:

import { countTasks, flipTask, replaceSlot, replaceSlots, hasSlot } from "pr-scene";

const body = "- [ ] preview\n- [ ] visual\n\n<!-- slot:footer -->\n\n<!-- /slot:footer -->";
flipTask(body, 1); // ticks the second task
replaceSlots(body, { footer: "[Workflow run](https://github.com/acme/app/actions/runs/1)" });
hasSlot(body, "footer"); // true
countTasks(body); // 2

Validation

validateScene(value) returns messages that name the offending path, and renderScene throws with the same text. The JSON Schema ships as pr-scene/scene.schema.json and is committed at schema/scene.schema.json.

API reference

Generated from the TypeScript types into docs/api/. npm run docs regenerates it; npm run docs:check fails when it is stale, and CI regenerates it on main.

Development

  1. npm install installs dependencies and the lefthook hooks.
  2. npm run dev serves the playground.
  3. npm run doctor runs every check: typecheck, lint, format, docs, coverage, build, dist verification and end-to-end tests.
  4. npm run doctor -- --fast skips the slow end-to-end step, which is what CI runs.
  5. npm run shots writes one screenshot per scenario into screenshots/.

Files stop at 150 lines, functions at 30, cognitive complexity at 5.

Releasing

  1. npm run doctor
  2. npm run build
  3. npm publish --access public from the release commit.

Published by hand for now; switching the release workflow to npm trusted publishing is follow-up work (#15).

The package is ESM-only. files ships dist/, which holds the compiled modules, declarations, styles.css and scene.schema.json; sideEffects names the stylesheet so the JavaScript stays tree-shakeable.

License

MIT