🖥️

package.json “—help” CLI

 

1. Installation (optional)

Install the “fx” package from npm globally. It’s a JSON Explorer UI in the terminal
npm i -g fx
if you wish to skip this step, replace all the instances of fx with npx fx
 

2. Create Alias

Create this alias in your terminal rc. For bash it will be ~/.bashrc and Zsh it will be ~/.zshrc
alias npm-help="cat package.json | fx '.scripts'"
 

3. Restart the terminal session

Either close the terminal and repoen it, or run source on teh file you just added the alias to
ex source ~/.zshrc
 

4. Use the new npm help command!

> npm-help

{
  "dev": "next",
  "dev:storybook": "npm run storybook",
  "build": "next build",
  "start": "next start",
  "storybook": "start-storybook -p 6006",
  "build-storybook": "build-storybook"
}
 

(extra) Use grep for larger projects

> npm-help | grep 'storybook'

  "dev:storybook": "npm run storybook",
  "storybook": "start-storybook -p 6006",
  "build-storybook": "build-storybook"