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

npm-release-package

v1.0.0

Published

A simple greeting package demonstration

Readme

Publishing an NPM Package: A Step-by-Step Guide

This repository demonstrates how to create and publish a package to the NPM registry.

Prerequisites

Step 1: Set up your project

# Create a new directory for your package
mkdir my-npm-package
cd my-npm-package

# Initialize a new npm package
npm init -y

Step 2: Create your package code

Create an index.js file with your package functionality:

// index.js
function greet(name) {
  return `Hello, ${name}!`;
}

module.exports = { greet };

Step 3: Update package.json

Edit your package.json to include necessary information:

{
  "name": "your-unique-package-name",
  "version": "1.0.0",
  "description": "A simple greeting package",
  "main": "index.js",
  "keywords": ["greeting", "demo"],
  "author": "Your Name",
  "license": "MIT"
}

Important fields:

  • name: Must be unique on NPM registry
  • version: Follow semantic versioning (major.minor.patch)
  • main: Entry point to your package
  • keywords: Help users find your package

Step 4: Add a README.md

Create a README.md file to document your package:

# Your Package Name

A simple greeting package.

## Installation
```npm install your-unique-package-name```

## Usage
```javascript
const { greet } = require('your-unique-package-name');
console.log(greet('World')); // Outputs: Hello, World!

## Step 5: Create a .gitignore file

node_modules/ .DS_Store .env


## Step 6: Create an NPM account (if you don't have one)

```bash
npm adduser
# Follow prompts to log in or create account

Step 7: Publish your package

npm publish

Step 8: Updating your package

  1. Make your code changes
  2. Update the version in package.json following semantic versioning:
    • Patch (1.0.0 → 1.0.1): Bug fixes
    • Minor (1.0.0 → 1.1.0): New features, backward compatible
    • Major (1.0.0 → 2.0.0): Breaking changes
  3. Run npm publish again

Advanced Topics

Testing your package locally

# In your package directory
npm link

# In another project directory
npm link your-package-name

Creating a .npmignore file

Similar to .gitignore, but for excluding files from your NPM package:

tests/
docs/
.github/

Publishing a scoped package

Scoped packages use your username or organization name:

{
  "name": "@username/package-name"
}

To publish a scoped package:

# Public package
npm publish --access public

# Private package (requires paid account)
npm publish

Adding tests

Consider adding tests before publishing:

# Install Jest for testing
npm install --save-dev jest

# Add test script to package.json
"scripts": {
  "test": "jest"
}

# Run tests
npm test

Resources