A while ago I started a thread on Twitter with a few terminal tips. There are lots of command line interfaces in NPM and they can be very handy in our daily work.
Here they are. If you like them, you can follow me on twitter for more tips :)
1. list-scripts and npm-list-scripts give you a list of available npm script including what each script does. Useful for documentation:
— Leonardo Faria (@leozera) January 30, 2019
? npm i -g list-scripts npm-list-scripts
? https://t.co/QvvFEpEMeQ https://t.co/6MFQXbHPLW#terminal #npm #cli #protip pic.twitter.com/84dwGqVviX
2. ncu checks the packages in your package.json file and gives you major and minor package updates info
— Leonardo Faria (@leozera) January 30, 2019
? npm i -g npm-check-updates
? https://t.co/H9NIGetGKy#terminal #npm #cli #protip pic.twitter.com/EPmx3YKJwE
3. npm-scripts-tree is helpful when you have scripts calling other scripts and you are lost trying to understand the dependencies between them. Really handy for documentation:
— Leonardo Faria (@leozera) January 30, 2019
? npm i -g npm-scripts-tree
? https://t.co/4NVKocfDuY#terminal #npm #cli #protip pic.twitter.com/7NWn2FBPBK
4. space-hogs shows large directories - imagine a better du:
— Leonardo Faria (@leozera) January 30, 2019
? npm i -g space-hogs
? https://t.co/xPlGzYjLJk#terminal #npm #cli #protip pic.twitter.com/HKZQP9NMgq
5. see is an improved cat (aka syntax highlight)
— Leonardo Faria (@leozera) January 30, 2019
? npm i -g see-cli
? https://t.co/bEAjBJjhGt#terminal #npm #cli #protip pic.twitter.com/o6rx8MZbel
6. colorls is a ruby script that changes the ls output with color and icons
— Leonardo Faria (@leozera) January 30, 2019
? gem install colorls
? https://t.co/9F3n6v3FnA#terminal #ruby #cli #protip pic.twitter.com/NF675JfdPx
7. You can use repeat in zsh and the speed-test cli from @sindresorhus to keep monitoring your internet speed
— Leonardo Faria (@leozera) January 30, 2019
? repeat 10000 { date +"%T"; speed-test; sleep 1 }
? https://t.co/BP4Rj4qI5r pic.twitter.com/22j1YV6Kf1
8. You can configure git to push to the current branch:
— Leonardo Faria (@leozera) February 8, 2019
git config --global push.default current
So instead of:
git push origin your-feature-branch
You can just do:
git push #protip #terminal #git
9. Writing a PR? Maybe you want a list of your commits:
— Leonardo Faria (@leozera) October 5, 2019
git log origin/master..HEAD --no-merges --pretty=format:'- %s' --reverse#protip #terminal #git @github pic.twitter.com/od8e8LPpPa
10. Running out of space? Maybe too many node_modules folders:
— Leonardo Faria (@leozera) January 9, 2020
? npx npkill
? https://t.co/zyj9s6eCj9
Saved 10GB+ here ~ #terminal #npm #cli #protip pic.twitter.com/y31i7gS9af
Photo credit: Unsplash
Also posted on my blog. If you like this content, follow me on Twitter and GitHub.
By the way - Thinkific is hiring for several positions if you are interested.