After I've started using
npm to install my Node package dependencies, after using Bundler it felt extremely verbose, so much that it actually started to bother me. I had to find a way to make it shut the hell up and only talk to me when it's really necessary. Enter the Unix philosophy:
The 'Silence is Golden' rule
One of the most important attributes of a well written Unix command line tool is unobtrusiveness:
The rule of silence, also referred to as the silence is golden rule, is an important part of the Unix philosophy that states that when a program has nothing surprising, interesting or useful to say, it should say nothing. It means that well-behaved programs should treat their users' attention and concentration as being valuable and thus perform their tasks as unobtrusively as possible. That is, silence in itself is a virtue.
Bundle all the things
The Ruby community has a very good package manager and dependency resolver called Bundler. I assume you are familiar with the basics of Bundler itself, but I'd like to drive your attention to the output it presents when you install your application's dependencies:
$ bundle Using rake 10.3.2 Using i18n 0.6.9 Using json 1.8.1 Using minitest 5.3.5 Using thread_safe 0.3.4 Using tzinfo 1.2.1 Using activesupport 4.1.2 Using builder 3.2.2 # ... similar output omitted for clarity Using redis 3.1.0 Using rspec-support 3.0.2 Using rspec-core 3.0.2 Using rspec-expectations 3.0.2 Using rspec-mocks 3.0.2 Using rspec-rails 3.0.1 Using sdoc 0.4.0 Using spring 1.1.3 Using webmock 1.18.0 Your bundle is complete! Use `bundle show [gemname]` to see where a bundled gem is installed.
We declare our direct dependencies of our application explicitly, upon bundling these up Bundler shows all recursive dependencies that have been resolved. This isn't quite zero-output but you could argue that this is still useful information.
Enter NPM install
If you develop with Node you must have used NPM that is effectively the Bundler equivalent in the Node ecosystem. Only, it's much more verbose, and when I write much more I actually mean it. When you install packages using
npm install it reports the following:
- Compilation output where packages use your machine's compiler
- HTTP responses when fetching the packages (wat?!)
- Versions of packages that have been matched against my
package.json(this is pretty much the only reasonable and interesting output)
- The list of recursive dependants of my explicit dependencies
On a relatively small application this is an output of a total of 1135 (!!!) lines (see the full output here).
You can make NPM less noisy by setting the
loglevel configuration setting:
$ npm config set loglevel warn
Doing this from your
$HOME directlry makes sense because then
npm will store the configuration in a
.npmrc file and every consequent call to
$HOME will use these configuration directoves by default.
$ cat ~/.npmrc loglevel=warn
And when something goes wrong?
On any failure all logs are written to
npm-debug.log in the current working directory anyway.
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