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

@tops_praful/my-npm-package

v1.0.1

Published

This guide explains how to create, test, and publish an NPM package. Follow these steps to get your package up and running.

Downloads

1

Readme

Creating and Deploying an NPM Package

This guide explains how to create, test, and publish an NPM package. Follow these steps to get your package up and running.


Step 1: Set Up Your Environment

  1. Install Node.js: Download and install Node.js from Node.js official website. NPM is included with Node.js.

  2. Log in to NPM:

    npm login

    Provide your username, password, and email associated with your NPM account. If you don't have an account, create one on npmjs.com.


Step 2: Create Your Package

  1. Create a New Folder:

    mkdir my-npm-package
    cd my-npm-package
  2. Initialize Your Package:

    npm init

    Follow the prompts to fill out package.json. Use -y to skip prompts and use default values:

    npm init -y
  3. Write Your Code: Create a main file for your package (e.g., index.js):

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

Step 3: Prepare for Publishing

  1. Add a .gitignore File: Create a .gitignore file to exclude unnecessary files:

    node_modules/
    .env
  2. Test Your Package Locally: Link your package to test it before publishing:

    npm link

    In another project, link your package:

    npm link my-npm-package
  3. Versioning: Update the version of your package using semantic versioning:

    npm version [patch|minor|major]
    • patch: For bug fixes (e.g., 1.0.0 -> 1.0.1)
    • minor: For new features (e.g., 1.0.0 -> 1.1.0)
    • major: For breaking changes (e.g., 1.0.0 -> 2.0.0)

Step 4: Publish Your Package

  1. Check Package Name Availability:

    npm search <package-name>
  2. Publish: Run the following command to publish your package:

    npm publish

    For scoped packages (e.g., @yourname/mypackage), publish with:

    npm publish --access public

Step 5: Use Your Package

  1. Install your package in another project:

    npm install my-npm-package
  2. Import and use it in your code:

    const greet = require('my-npm-package');
    console.log(greet('World')); // Output: Hello, World!

Additional Tips

  1. Automated Testing: Use testing libraries like Jest or Mocha to ensure your package works correctly.

  2. Documentation: Include a README.md file with instructions for users to understand and use your package.

  3. Updating Your Package: After making changes, update the version:

    npm version [patch|minor|major]

    Then, publish again:

    npm publish