You can use:
npm run
to list all commands. (Yarn also features similar functionality on yarn run
.)
This behavior is made explicit in the help page of npm help run
:
This runs an arbitrary command from a package's "scripts" object. If no "command" is provided, it will list the available scripts.
To get a quick overview if you have jq installed:
jq .scripts package.json
You can still pipe that subset to less
if you need to
jq .scripts package.json | less
Furthermore, you can use tab completion via npm-completion and then you should see a list of possible commands when hitting tab and completes the commands if there is only one option left.
You can set it up temporarily via
source <(npm completion)
Depending on your terminal, you can make it persistent behavior by adding to your relevant config file:
npm completion >> ~/.bashrc
npm completion >> ~/.zshrc