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

pkg-guard

v0.6.0

Published

Guard npm package manifests, entry points, and release workflows before publishing.

Readme

pkg-guard

Guard npm package manifests, entry points, and release workflows before publishing.

pkg-guard is a TypeScript CLI for npm package publishing hygiene. It audits package metadata, declared entry points, packed package contents, TypeScript declaration settings, GitHub Actions npm publishing workflows, conservative dependency risks, publishable workspace packages, and editor-ready diagnostics through an experimental analysis API.

Product site: https://jeremyaaron.github.io/pkg-guard/

Install

npm install -D pkg-guard

Usage

npx pkg-guard check
npx pkg-guard check --format json
npx pkg-guard check --format diagnostics-json --mode fast
npx pkg-guard check --format sarif
npx pkg-guard fix --dry-run
npx pkg-guard init --dry-run
npx pkg-guard init-release

check is read-only and exits with 1 when errors are found. Warnings do not fail the command unless promoted through strict config.

Use --mode fast, --mode default, or --mode smoke to choose check cost. fast runs source-tree analysis only and skips npm pack and consumer smoke checks. default matches normal pkg-guard check behavior, including npm pack inspection. smoke runs default analysis plus consumer smoke checks. The existing --consumer-smoke flag remains supported as a readable alias for --mode smoke.

fix applies only conservative package.json metadata fixes such as packageManager, repository metadata, types, files, scoped package access, inferred Node engines, and low-risk sideEffects. Use --dry-run to preview changes.

init adds a local pkg:check script and conservative pkgGuard config when it can infer package intent safely. Use --dry-run to preview changes.

init-release creates .github/workflows/release.yml for npm trusted publishing and refuses to overwrite an existing release workflow.

Workspaces

Run checks across publishable workspace packages:

npx pkg-guard check --workspaces
npx pkg-guard check --workspaces --format diagnostics-json --mode fast
npx pkg-guard check --workspaces --format sarif > pkg-guard.sarif
npx pkg-guard fix --workspaces --dry-run
npx pkg-guard init --workspaces

Select one package by package name or repository-relative path:

npx pkg-guard check --workspace @scope/pkg
npx pkg-guard fix --workspace packages/pkg

Workspace mode reads package.json workspaces, package.json workspaces.packages, and pnpm-workspace.yaml packages. It skips packages with private: true by default. Add --include-private to include private packages and --include-root to include the workspace root when using --workspaces; a private root also needs --include-private.

Diagnostics JSON

--format json is the stable release-gate report format built around findings. It remains compatible with earlier versions and does not include diagnostic-only fields.

--format diagnostics-json is the tooling-oriented format for editors, pre-commit hooks, wrappers, and non-TypeScript integrations:

npx pkg-guard check --format diagnostics-json
npx pkg-guard check --format diagnostics-json --mode fast
npx pkg-guard check --workspaces --format diagnostics-json --mode smoke

Diagnostics include source, layer, cost, and optional location.range metadata. Ranges are zero-based: line 0 is the first line, column 0 is the first UTF-16 code unit in the line, and offset is a zero-based UTF-16 code unit offset when present.

See diagnostics CLI output.

Configuration

Optional config lives in package.json:

{
  "pkgGuard": {
    "preset": "typescript-library",
    "ignore": ["dependencies.runtime-in-dev"],
    "strict": ["manifest.files-missing"]
  }
}

pkg-guard infers cli, typescript-library, or generic from package metadata. Configure preset when the inferred intent is too broad or too narrow for the package.

In workspace mode, each package uses its own package.json pkgGuard config. Root config is not silently inherited by workspace packages.

See configuration and check IDs.

Experimental Analysis API

Tooling integrations can import diagnostic analysis from the experimental subpath:

import { analyzePackageForDiagnostics } from "pkg-guard/experimental/analysis";

const result = await analyzePackageForDiagnostics({
  cwd: process.cwd(),
  mode: "fast"
});

The API supports fast, default, and smoke modes, returns diagnostics with source, layer, cost, and optional zero-based source ranges, and includes a workspace variant for package families. The subpath is documented and tested, but it may change in minor releases before 1.0.0.

See experimental analysis API.

Docs

Development

npm install
npm run lint
npm run typecheck
npm test
npm run build
node dist/cli/index.js check