$ cnpm install npm-quick-run -g
Quickly run NPM script by prefix without typing the full name
Install as a global tool npm install -g npm-quick-run
. This creates two aliases nrun
and nr
$ 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
Watch this screencast to see npm-quick-run
in action. I am using nr
alias
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.
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.
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.
package.json
by property name prefixnode node_modules/.bin/some-alias ...
npm-quick-run
is cross platform - the command completion is done in JSIf something is not working as expected, you can see the verbose debug messages by running
DEBUG=quick nr ...
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
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.
Copyright 2014 - 2017 © taobao.org |