Ready to take your JavaScript development to the next level? Meet npm Enterprise - the ultimate in enterprise JavaScript. Learn more »

npm-quick-run

1.16.1 • Public • Published

npm-quick-run

Quickly run NPM script by prefix without typing the full name

NPM

Build 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

Demo

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.

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.

install

npm i npm-quick-run

Downloadsweekly downloads

59

version

1.16.1

license

MIT

homepage

github.com

repository

Gitgithub

last publish

collaborators

  • avatar
Report a vulnerability