kalvn logo kalvn

Optimize the terminal usage with Node thanks to aliases

I work a lot with Node.js lately, and I realized that there are some terminal commands I type dozens or even hundreds of times a day.

It may sound obvious for script kiddies who have used Linux forever, but I have a tendency to limit customization of my tools, to limit the hassle when configuring a new environment from scratch. And this tendency prevented me from thinking to this simple yet efficient solution.

Commands I use the most are:

npm install

npm run dev
# or its modern equivalent
node --run dev

npm run build
# or
node --run build

npm run test
# or (you start getting the point)
node --run test

npm outdated

As my preferred terminal is Git Bash, I simply added the following aliases at the end of my ~/.bash_profile file:

alias ni='npm install'
alias nrd='node --run dev'
alias nrb='node --run build'
alias nrt='node --run test'
alias no='npm outdated'

It takes a couple of hours to get used to them, but in the long run it'll save you years.

Ok maybe not.

But it's worth the try.