Update nodejs cookbook

This commit is contained in:
Greg Karékinian
2016-01-22 22:26:17 +00:00
parent d8681e860c
commit 0aa9ac5682
11 changed files with 97 additions and 64 deletions

View File

@@ -13,7 +13,7 @@ Include the nodejs recipe to install node on your system based on the default in
include_recipe "nodejs"
```
### Engine
### Engine
You can select different engine by setting `node['nodejs']['engine']`
```
@@ -84,11 +84,13 @@ _Warning:_ This recipe will include the `nodejs` recipe, which by default includ
Packages can be installed globally (by default) or in a directory (by using `attribute :path`)
You can specify an `NPM_TOKEN` environment variable for accessing [NPM private modules](https://docs.npmjs.com/private-modules/intro) by using `attribute :npm_token`
You can append more specific options to npm command with `attribute :options` array :
* use an array of options (w/ dash), they will be added to npm call.
* ex: `['--production','--force']` or `['--force-latest']`
This LWRP try to use npm bare as much as possible (no custom wrapper).
This LWRP attempts to use vanilla npm as much as possible (no custom wrapper).
### Packages
@@ -108,6 +110,14 @@ nodejs_npm "grunt" do
json true
user "random"
end
nodejs_npm "my_private_module" do
path "/home/random/myproject" # The root path to your project, containing a package.json file
json true
npm_token "12345-abcde-e5d4c3b2a1"
user "random"
options ['--production'] # Only install dependencies. Skip devDependencies
end
```
[Working Examples](test/cookbooks/nodejs_test/recipes/npm.rb)