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

@libria/clean-publish

v1.0.0

Published

A CLI tool for publishing clean npm packages

Readme

@libria/clean-publish

A CLI tool for publishing clean npm packages. Stage only the files you need, sanitize your package.json, and publish a minimal, production-ready package.

Why?

When you publish a package to npm, you often include unnecessary files like tests, source code, configs, and development scripts. This tool lets you:

  • Copy only the files you want to publish (using glob patterns)
  • Remove devDependencies, scripts, and other fields from package.json
  • Preview what will be published before actually publishing
  • Skip publishing when nothing has changed (hash-based detection)

Installation

npm install -D @libria/clean-publish

Or use it directly with npx:

npx @libria/clean-publish <command>

Quick Start

# Initialize config file
lb-clean-publish init

# Preview what will be staged
lb-clean-publish dry-run

# Stage files for publishing
lb-clean-publish build

# Publish to npm
lb-clean-publish publish

Commands

| Command | Description | | --------- | ---------------------------------------------- | | init | Create a .clnpb.json config file | | build | Stage files to temp directory and sanitize pkg | | dry-run | Preview matched files and package.json rules | | pack | Generate an npm tarball from staged files | | publish | Publish staged files to npm registry |

Configuration

Create a .clnpb.json file in your project root (or run lb-clean-publish init):

{
  "tmpDir": ".tmp-clean-publish",
  "copy": [
    "dist/**",
    "README.md",
    "LICENSE"
  ],
  "packageJson": {
    "remove": {
      "scripts": true,
      "devDependencies": true
    }
  }
}

Config Options

tmpDir

Type: string

Directory where files are staged before publishing.

copy

Type: string[]

Glob patterns for files to include in the published package. Uses fast-glob syntax.

packageJson

Rules for sanitizing package.json:

| Option | Type | Description | | ----------------------------- | ---------- | --------------------------------------------- | | remove.scripts | boolean | Remove all scripts | | remove.devDependencies | boolean | Remove devDependencies | | remove.optionalDependencies | boolean | Remove optionalDependencies | | keepScripts | string[] | Scripts to keep when remove.scripts is true | | removeFields | string[] | Additional top-level fields to remove |

Example: Keep specific scripts

{
  "tmpDir": ".tmp-clean-publish",
  "copy": ["dist/**", "README.md"],
  "packageJson": {
    "remove": {
      "scripts": true,
      "devDependencies": true
    },
    "keepScripts": ["postinstall"]
  }
}

Example: Remove custom fields

{
  "tmpDir": ".tmp-clean-publish",
  "copy": ["dist/**", "README.md"],
  "packageJson": {
    "remove": {
      "scripts": true,
      "devDependencies": true,
      "optionalDependencies": true
    },
    "removeFields": ["prettier", "eslintConfig", "jest"]
  }
}

Workflow

  1. Build your project - Compile TypeScript, bundle, etc.
  2. Run lb-clean-publish build - Stages files to temp directory
  3. Run lb-clean-publish pack (optional) - Creates a tarball to inspect
  4. Run lb-clean-publish publish - Publishes to npm

The publish command automatically skips if nothing has changed since the last publish (using content hashing).

License

MIT