@zokugun/nsx
v0.4.1
Published
Quickly run npm scripts
Downloads
328
Maintainers
Readme
@zokugun/nsx
nsx is command-line interface which allows you to run a npm script by:
- its full name (
compile); - the first letters (
compforcompile); - a shortened alias (
bdforbuild:dev).
If the name can't be matched to a single script, a prompt will asked you to desired script to run.
You can pass arguments to the script without any additional --.
Install
With node previously installed:
npm install @zokugun/nsxUsage
nsx l --fix # run: npm lint -- --fixOptions
| Option | Default | Description |
| ------------------- | ------- | --------------------------------------------- |
| -c, --confirm | false | Confirm before running the selected script. |
| -p, --path | "." | Path to the folder containing package.json. |
| -s, --separator | ":" | The separator for shortened alias. |
Syntax (short, alias, and matching)
nsx supports several handy ways to refer to scripts:
- Full name: call the script by its full npm script name.
nsx compileruns thecompilescript.
- Prefix matching: type the first letters of the script name.
nsx compcan matchcompileif it's unambiguous.
- Shortened alias: an alias composed of the first letter of each part of the script name (parts are split by a separator).
- By default the separator includes
:and-(for examplebuild:dev→bd). - The
-s, --separatoroption lets you change which characters are considered separators for alias generation. - Example:
nsx bdmatchesbuild:devwhen the aliasbdis unique.
- By default the separator includes
- Special patterns supported for matching:
a..z(four characters with two dots): matches scripts starting withaand ending withz.foo#bar#baz(hash#used between fragments): treated asfoo.*bar.*bazand matched anywhere in the script name.
Running in series and parallel
You can run a single script, a sequence of scripts (serie), or multiple scripts in parallel.
Series (run one after the other)
Separate requests with a comma ,.
Examples:
nsx build,lint,testnsx b,l,tnsx "build --prod,lint --fix"(each request can have its own arguments)nsx b,'l --fix'
Use a trailing $ on a request to continue to the next request even if that request fails, for example:
nsx "build$,lint"(ifbuildfails the serie continues tolint)
Parallel (run at the same time)
Separate requests with a plus +.
Examples:
nsx build+testnsx b+tnsx "build --prod+test --watch"nsx b+'test --watch'
When running in parallel, each script is started concurrently and their results are reported individually.
Arguments and quoting:
When using multiple requests or arguments containing spaces, quote the whole query so the shell passes it as a single argument.
Examples:
nsx "build --prod,lint --fix"nsx "build --prod+test --watch"
These matching rules make it quick to run scripts using short forms, aliases, and combined series/parallel requests.
Donations
Support this project by becoming a financial contributor.
License
Copyright © 2025-present Baptiste Augrain
Licensed under the MIT license.
