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 🙏

© 2025 – Pkg Stats / Ryan Hefner

npm-quick-run

v1.18.0

Published

Quickly run NPM script by prefix without typing the full name

Readme

npm-quick-run

Quickly run NPM script by prefix without typing the full name

NPM

ci status semantic-release manpm standard

Install

Install as a global tool npm install -g npm-quick-run. This creates two aliases nrun and nr

Use example

$ nr t      # runs script starting with "t"
$ nr m -w   # runs a script starting with "m", probably "npm run mocha -- -w"
$ nr -i     # runs npm-quick-run in interactive mode
$ nr c-r    # find script that has two+ words
            # first starts with "c", second with "r"
$ nr c-r.   # find script with exactly two words
            # first starts with "c", second with "r"

Demo

Watch the video NPM Quick Run

Watch this screencast to see npm-quick-run in action. I am using nr alias

demo

Interactive Mode

Demo: Interactive Mode

Details

Take a look at the scripts inside your package.json. You probably have something like this

"scripts": {
  "test": "...",
  "lint": "..."
}

You can quickly run tests using nr t and run the linter using nr l, assuming there are no other script names starting with t or l. If there are, just be more specific and provide more unique prefix.

Separate words

If your scripts have separate words, you can specify prefix for each one. For example, the package.json file below has 3 scripts

{
  "scripts": {
    "cypress:open": "cypress open",
    "cypress:run": "cypress run",
    "cypress:run:record": "cypress run --record"
  }
}

You can quickly open Cypress using

nr c:o
# same as
nr c-o
# same as
nr cy-open

Characters : and - are interchangeable and can be used in the prefix or in the script names.

In the above situation

nr c-r
# returns both "cypress:run" and "cypress:run:record"
nr c-r-r
# executes "cypress:run:record"

Separate words with count

Sometimes you want to match a script with one word, but there are multiple two and three word scripts matching the prefix.

{
  "scripts": {
    "cypress": "cypress -help",
    "cypress:open": "cypress open",
    "cypress:run": "cypress run",
    "cypress:run:record": "cypress run --record"
  }
}

In order to run "cypress" script use prefix with "." at the end:

# same as "npm run cypress"
$ nr c. # only finds single word starting with "c"

# same as "npm run cypress:open"
$ nr c-o.

# same as "npm run cypress:run"
$ nr c-r.

Extra arguments

You can pass extra arguments right after the prefix string

nr t --watch

would be the same as

npm run test -- --watch

which can run Mocha unit tests in the watching mode for example.

Error handling

If there are no scripts starting with the given prefix, an error message will be shown. If there are multiple scripts, they will be printed to the console and an error will be shown.

Similar projects

  • as-a adds env variables before running a command
  • json-package quickly shows value from package.json by property name prefix
  • npm-run run locally-installed executables to avoid using long string node node_modules/.bin/some-alias ...
  • nrun is very similar to this project, but the script name completion is done via shell script, see the relevant issue

Benefits compared to similar projects

  • npm-quick-run is cross platform - the command completion is done in JS
  • Boilerplate NPM error output is filtered out automatically
  • Most commands require typing only 3 characters - 2 for the tool itself "nr" and 1 character for the the script label

Debug

If something is not working as expected, you can see the verbose debug messages by running

DEBUG=quick nr ...

Small print

Author: Gleb Bahmutov © 2015

License: MIT - do anything with the code, but don't blame me if it does not work.

Spread the word: tweet, star on github, etc.

Support: if you find any problems with this module, email / tweet / open issue on Github

MIT License

Copyright (c) 2015 Gleb Bahmutov

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.