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 🙏

© 2024 – Pkg Stats / Ryan Hefner

npm-confirm

v2.0.0

Published

Confirm your package manager before running NPM install!

Downloads

44

Readme

npm Confirm Banner

What is npmc?

npmc is a wrapper for the npm command that confirms with you if it detects you using another package manager.

When confirming, you can choose to do 3 things:

  1. Run your command, adapted for the new package manager
  2. Run your original command
  3. Cancel the operation

Now, you can just copy and paste npm install commands from documentation without needing to manually edit the package manager!

When aliased to just npm, npmc serves as a quick way to run commands copied from external sources without needing to modify it at all, as opposed to ni, which reqires you to still swap out the npm install bit.

However, these tools can serve as compliments.

  • If you are typing commands directly, you can still choose to use ni.
  • You can use npmc in addition for copying and pasting or to catch occasional slipups.

Installation

npm install -g npm-confirm

This will give you access to the npmc command, which acts like the npm command, but confirms with you.

I strongly recommend aliasing npmc to just npm so you can use npm like normal.

To do this in zsh or bash add this to your .zshrc or .bashrc:

alias npm='npmc'

You may also want the pnpm, bun, and yarn commands to give confirmation when used with the wrong package manager.

By default, npmc acts as npm when no other package managers are detected. However, you can change that default by simply passing a --[NAME]-alias flag.

For example, if I run npmc --pnpm-alias, it will act as pnpm and confirm with you if you are using a non-pnpm package manager.

Again, I recommend aliasing these in .zshrc:

# npm
alias npm='npmc'

# pnpm
alias pnpm='npmc --pnpm-alias'

# bun
alias bun='npmc --bun-alias'

# yarn
alias yarn='npmc --yarn-alias'

Features

Automatic Command Adaptation

npmc will automatically adapt agent subcommands and flags from one package manager to the other.

For example, NPM's ci command will automagically be converted to bun install --no-save for Bun, and accordingly for other package managers.

Command Preview

npmc always shows you what command will be run, both when using the adapted package manager, or even the one you ran the command with.

This maximizes transparency, and ensures npmc never does something you didn't mean when adapting commands.

Have a problem with command adaptation? Submit an issue!

Smart Confirmations

npmc only confirms when you run certain commands, such as install, uninstall, run, upgrade, and their variants for the various package managers. This means that when you truly meant to use the other package manager, npmc will not stand in your way. Furthermore, all global installations are directly done directly with whatever you ran it with!