Skip to content
This repository has been archived by the owner on Dec 29, 2020. It is now read-only.
/ sx Public archive

Micro CLI for interactive running npm & yarn scripts.

License

Notifications You must be signed in to change notification settings

norskeld/sx

Repository files navigation

⚡ sx

npm (scoped) semantic-release Commitizen friendly

Micro CLI to interactively run npm & yarn scripts.

Deprecated

This Node + TypeScript version is now deprecated and will not be maintained as I'm rewriting everything in Rust 🦀. The Rust version can be found here.

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 cating (lessing, bating) 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.

Features

You can:

  • Interactively select and run scripts from package.json
  • Use different package managers: npm, pnpm or yarn
  • Override default package manager (npm) via env variable

I have plans on adding support for lerna and running multiple scripts. You can check the milestones.

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.

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 or pnpm 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.