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

@preview-comments/github

v0.3.1

Published

GitHub adapter for [preview-comments](https://github.com/Swalden/preview-comments). Stores each comment thread as a single issue comment on a PR, so preview feedback lives on the pull request itself — no separate backend.

Downloads

2,105

Readme

@preview-comments/github

GitHub adapter for preview-comments. Stores each comment thread as a single issue comment on a PR, so preview feedback lives on the pull request itself — no separate backend.

Usage

import { mount } from '@preview-comments/ui'
import { createGitHubAdapter } from '@preview-comments/github'

const adapter = createGitHubAdapter({
  issuesPath: 'my-org/my-repo/issues/123', // the PR number
  getToken: () => localStorage.getItem('preview-comments:github-token'),
})

mount({ adapter, githubClientId: '...', githubCallbackUrl: '...' })

The token needs Issues read/write on the repo. When using a GitHub App for OAuth, scope the app to Issues: Read and write only and install it on just the target repo — user tokens inherit the installation's permissions, so a widget token should not be able to do anything beyond posting comments.

Comment format

Each thread is one issue comment:

📌 **Preview comment** on `/some/path`

**alice:**
Looks off on mobile

---

**bob:**
Fixed in abc123

<!-- preview-comments:{"anchor":{...},"resolved":false} -->

The trailing HTML comment holds machine-readable metadata: the pin anchor and the thread's resolved state. Resolving a thread edits the comment in place (it never deletes discussion).

Blocking merges on unresolved comments

GitHub can't require issue comments to be resolved natively, but the metadata marker makes it easy to gate merges with a required status check — the same pattern Vercel uses for its preview comments check.

Add a workflow that recomputes the status whenever comments change or the PR gets new commits:

name: Preview Comments Gate
on:
  issue_comment:
    types: [created, edited, deleted]
  pull_request:
    types: [opened, synchronize, reopened]
permissions:
  statuses: write
  pull-requests: read
  issues: read
jobs:
  gate:
    if: github.event_name == 'pull_request' || github.event.issue.pull_request
    runs-on: ubuntu-latest
    steps:
      - uses: actions/github-script@v7
        with:
          script: |
            const prNumber =
              context.payload.pull_request?.number ?? context.payload.issue.number
            const { data: pr } = await github.rest.pulls.get({
              ...context.repo, pull_number: prNumber,
            })
            const comments = await github.paginate(github.rest.issues.listComments, {
              ...context.repo, issue_number: prNumber, per_page: 100,
            })
            const MARKER = '<!-- preview-comments:'
            let unresolved = 0, total = 0
            for (const { body = '' } of comments) {
              const start = body.indexOf(MARKER)
              if (start === -1) continue
              const end = body.indexOf(' -->', start)
              if (end === -1) continue
              total += 1
              try {
                if (!JSON.parse(body.slice(start + MARKER.length, end)).resolved) unresolved += 1
              } catch { unresolved += 1 }
            }
            await github.rest.repos.createCommitStatus({
              ...context.repo,
              sha: pr.head.sha,
              context: 'preview-comments',
              state: unresolved === 0 ? 'success' : 'failure',
              description: total === 0
                ? 'No preview comments'
                : `${unresolved} unresolved of ${total} preview comment(s)`,
            })

The check is informational by default. To make it block merges, add preview-comments to the required status checks in the branch protection (or ruleset) for your default branch:

gh api repos/{owner}/{repo}/branches/main/protection/required_status_checks/contexts \
  -X POST -f "contexts[]=preview-comments"

Resolving the last open pin in the preview UI flips the check green within seconds — the widget's Resolve button edits the comment, which re-fires the workflow.