🌐 AI搜索 & 代理 主页
Skip to content

zokugun/nsx

Repository files navigation

MIT licensed NPM Version Donation Donation Donation

nsx is command-line interface which allows you to run a npm script by:

  • its full name (compile);
  • the first letters (comp for compile);
  • a shortened alias (bd for build: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/nsx

Usage

nsx l --fix # run: npm lint -- --fix

Options

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 compile runs the compile script.
  • Prefix matching: type the first letters of the script name.
    • nsx comp can match compile if 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 example build:devbd).
    • The -s, --separator option lets you change which characters are considered separators for alias generation.
    • Example: nsx bd matches build:dev when the alias bd is unique.
  • Special patterns supported for matching:
    • a..z (four characters with two dots): matches scripts starting with a and ending with z.
    • foo#bar#baz (hash # used between fragments): treated as foo.*bar.*baz and 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,test
  • nsx b,l,t
  • nsx "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" (if build fails the serie continues to lint)

Parallel (run at the same time)

Separate requests with a plus +.

Examples:

  • nsx build+test
  • nsx b+t
  • nsx "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.

Ko-fi ko-fi.com/daiyam
Liberapay liberapay.com/daiyam/donate
PayPal paypal.me/daiyam99

License

Copyright © 2025-present Baptiste Augrain

Licensed under the MIT license.

About

Quickly run npm scripts

Resources

License

Stars

Watchers

Forks

Sponsor this project

Packages

No packages published

Languages