attilagyorffy.com

Configuring npm for fun and profit

Introduction

Attila Györffy

Attila Györffy

I'm a Ruby/JS dev/trainer with a focus on quality. An ex-Londoner, @terracycle, @ubxd, @lastfm. Follow me at http://twitter.com/attilagyorffy


node.js npm cli

Configuring npm for fun and profit

Posted by Attila Györffy on .
Featured

node.js npm cli

Configuring npm for fun and profit

Posted by Attila Györffy on .

As it occurred to me that some people don't quite realise how they can tame their npm to behave like a good UNIX citizen.

What do I mean? Well let's look at my ~/.npmrc configuration:

~/.npmrc is loaded and interpreted every single time you run an npm command. The first two parameters (spin and progress) turn off the progress bar that results in 2x as fast installs. Yup, that's right. Have you not heard of the famous progress bar issue? Take a look at it, but first make sure to have popcorn and coke ready to get the whole experience.

The loglevel parameter tells npm to brome less noisy. If you expect command line tools to behave like a good UNIX citizen then it's for you. I'm talking about the Rule of Silence. When a program has nothing surprising to say, it should say nothing and therefore be unobtrusive. This won't stop npm from still being a little too chatty but it's going to be better. By the way, did you know that even if you set npm to the highest log level silent it will still report some unnecessary information:

The rest is just configuration for module authors. Those basically authenticate npm with the registry. The above isn't so much but it's a step further to tame your cli. Also, take a look at further config options, you may find something more you could play around with.

Attila Györffy

Attila Györffy

https://attilagyorffy.com

I'm a Ruby/JS dev/trainer with a focus on quality. An ex-Londoner, @terracycle, @ubxd, @lastfm. Follow me at http://twitter.com/attilagyorffy

View Comments...