digitalbutter/cookbook-node — pull request #12 by pseudomuto (2014-01-19 16:28:14+00:00)
Title: Installing NPM Packages

@digitalbutter please review

# Problem

Currently there is no way to add an NPM package to a role without creating a recipe/cookbook that calls `node_npm`.

While creating the recipe is easy enough, I thought it would be nice to not require that step. In my particular case I don't have a recipe for the role in question and didn't want to create one just to install a few packages.

# Solution

Added `node[:node][:packages]` attribute that will be used to install each package specified in the array.

## Usage

Add packages to the _default_attributes_ or __override_attributes_ in your role. Here's a sample role file:

```
run_list(
...
...
'recipe[node]'
)

default_attributes({
node: {
packages: ['coffee-script', 'lineman']
}
})
```

The new attribute is completely optional. It has been defaulted to `[]` to avoid any breaking changes with the current functionality.

Also, I've updated the README to include a description and usage for the new attribute.