⚡ sx
Micro CLI for interactive running npm & yarn scripts.
Gosh, why?
First, I wanted to practise creating public CLI packages/libraries.
Secondly, I'm lazy. Like, really lazy. I don't even like to type much. And sometimes I'm perplexed
by amount of steps required to run an npm or yarn script. Especially if you can't remember what
scripts a project even has without diving into an IDE or cat
ing (less
ing, bat
ing) a
package.json
.
Thirdly, if you seek for autocompletion, I would suggest you to use this zsh enhancement. If you are like me—read on.
Installation
Node v12.18.0 or higher is required
$ npm i -g @arcdelta/sx
Usage
Basic
Just type at the root of your project:
$ sx
This will run an interactive prompt with scripts from package.json
as selectable options.
You pick one, hit Enter and that's it.
I have plans on adding lerna support and picking multiple scripts.
Options
Option | Description |
---|---|
-n , --npm
|
Use npm to run a script. |
-p , --pnpm
|
Use pnpm to run a script. |
-y , --yarn
|
Use yarn to run a script. |
-v , --version
|
Output the current version. |
-h , --help
|
Output help message. |
Package manager
If you use yarn instead of npm, you can instruct sx
to use it as a
default package manager by exposing a SX_PM=yarn
environment variable in your
shell's rc file (.zshrc
, .bash_profile
, etc).
Deps
This project relies only on ansi-colors.
License
MIT.