npmlist

Pretty npm list

npmlist

Sugar wrapped npm list with optional depth

Project initiated using nblocks

Why?

Current npm's (v1.4.3 and v.1.4.4) list (ls) function at depth=0 is broken. npm list depth=n is now fixed, but this looks aesthetically better than the original (such colors. oooohh~)

Installation

  $ npm install -g npmlist

Usage (sans color)

  $ npmlist
  Installed npm packages: (global)
 
  bower....................[1.2.8]
  brewcleaner..............[1.1.0]
  chai.....................[1.9.0]
  coffee-script............[1.7.1]
  connect.................[2.13.0]
  dispatch-proxy...........[0.1.2]
  express..................[3.4.8]
  gulp.....................[3.5.2]
  mocha..................[1.17.1*]
  nodemon.................[1.0.15]
  npm......................[1.4.4]
  yo.......................[1.1.2]

An asterisk by a version name signifies you are using a linked version of the package rather than one installed from a registry.

Other options include:

Display help message

Display version number

List local packages

List global packages

Displays current color scheme. More on color below in Color Customization

Specify depth to display (same as npm's depth)

Filter by package name (prepend _ for fuzzy match)

Uses colors (one-off)

Set colors for persistence i.e. default colors

Set scope for persistence i.e. default scope

The color of the output can be changed through a few options.

  # One-off colorscheme 
  $ npmlist -c=red,yellow,blue,magenta,cyan
  ...
 
  # Setting persistent colorscheme 
  $ npmlist -s=red,yellow,blue,magenta,cyan
 
  Current colorscheme:
 
  Package...................red
  Version................yellow
  Banner...................blue
  Dots..................magenta
  Sub-package..............cyan
 
  # Get current colorscheme 
  $ npmlist -k
 
  Current colorscheme:
 
  Package...................red
  Version................yellow
  Banner...................blue
  Dots..................magenta
  Sub-package..............cyan

As you can see from above, there are five variable colors for npmlist: Package name, version, banner, dots, and sub-packages. When specifying more than 1 color, they will populate in the order as above. When only one color is given, everything will be that color. The default colorscheme is the same as previous versions of npmlist:

defaultColors =
COLORS =
  pkg:      'magenta'
  version:  'cyan'
  banner:   'blue'
  dots:     'grey'
  subpkg:   'grey'

For persistent color settings, the colors are saved as a variable in $HOME/.npmrc as npmlist.colors.

To see what colors are avaialble, check out colors here.

  • Allow for package filtering (useful for > 0 depth view of a package)
  • Fix empty module list from throwing error
  • Signify if using linked package or installed
  • Fix extraneous package mark
  • Better package versioning...
  • Refactor out CLI parser (or use optimist?)
  • Clean up code
  • Possibly use npm depth=0 now that it is fixed

nblocks

Copyright © Nicholas Hwang nick.joosung.hwang@gmail.com