Skip to content
/ rsx Public

Micro CLI for interactive execution of npm & yarn scripts.

License

Notifications You must be signed in to change notification settings

norskeld/rsx

Folders and files

NameName
Last commit message
Last commit date

Latest commit

a865a0d · Apr 17, 2024

History

58 Commits
Oct 27, 2022
Oct 27, 2022
Apr 17, 2024
Feb 11, 2021
Sep 30, 2021
Mar 9, 2023
Apr 16, 2024
Mar 9, 2023
Mar 9, 2023
Dec 4, 2021
Oct 27, 2022

Repository files navigation

» rsx

Checks

Rusty Scripts Executor

Micro CLI for interactive execution of npm & yarn scripts.

Preview

asciicast

Motivation

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.

Installation

macOS Intel (Homebrew)

brew tap norskeld/tap
brew install norskeld/tap/rsx

macOS / Linux / Windows (Cargo)

Make sure to install Rust toolchain first. After that you can install rsx via Cargo:

cargo install --locked --git https://github.com/norskeld/rsx

Features

Implemented

You can:

  • Interactively select and run scripts from package.json in 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.

Planned

  • 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 packageManager field in package.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

  • Maybe support monorepos.

License

MIT.

About

Micro CLI for interactive execution of npm & yarn scripts.

Topics

Resources

License

Stars

Watchers

Forks

Languages