fiveisprime the more you node...

Npm Tips

Here are some quick tips to help you be more productive with npm.

npm outdated

Use this to see any module dependencies that are out of date. This can get kind of ugly though so specify the depth to see only your outdated dependencies.

$ npm outdated --depth 0

npm link

The link command creates a symbolic link to a module on your machine. Use this to easily consume modules that you are working on. You can also link a global module to your path when working on a command line module.

To use a local module, change to the directory of your project and run

$ npm link /path/to/module

You will then have access to that module from your project.

npm version

Use npm version to update the version of your module. This will update the package.json version for the module and commit the change.

$ npm version 0.1.1

.npmignore

Use this ignore file to prevent your test sources from being published along with your module. This works the same way as .gitignore.

# do not publish unnecessary files:
.travis.yml
.jshintrc
Makefile
spec
coverage

Shortcuts

npm has some helpful shortcuts to make your life easier, here are some common ones.

$ npm i <module>      # short for npm install
$ npm i <module> -S   # short for npm install --save
$ npm i <module> -D   # short for npm install --save-dev
$ npm i <module> -g   # short for npm install --global
$ npm r <module>      # short for npm uninstall