RustyScripts Executor
Micro CLI for interactive execution of npm & yarn scripts.
First, I wanted to practise creating Rust command-line apps.
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 cating (lessing, bating, whatever) 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.
brew tap norskeld/tap
brew install norskeld/tap/rsxMake sure to install Rust toolchain first. After that you can install rsx via Cargo:
cargo install --locked --git https://github.com/norskeld/rsxYou can:
- Interactively select and run scripts from
package.jsonin the current working directory:- Use arrows or J / K keys to select a script.
- Press Ctrl+A / Home to jump to the beginning.
- Press Ctrl+E / End to jump to the end.
- Press Ctrl+C / Esc to abort selection.
- Use different package managers: npm, pnpm, or yarn.
- Override default package manager (npm) through env variable.
- Pass a script name directly as argument and run via the selected package manager.
- Pass additional arguments after
--to a selected script.
- Determine package manager automatically. This can be done using simple heuristics like:
- Checking the lock files, they all differ between different package managers.
- Check the
packageManagerfield inpackage.json. - Briefly check contents of the
node_modules.
- Prettify output.
- Display current package manager.
- Dim script command.
- Properly wrap too long script commands.
- Refactor status and "Executing..." message handling and styling.
- Quickly find scripts by simply typing their name.
- Select multiple scripts and run them in order.
- Maybe support monorepos.
MIT.