Allow user to specify npm CLI options
Esse commit está contido em:
@@ -67,6 +67,10 @@ include_recipe "nodejs::npm"
|
||||
* use a `String` to specify json file
|
||||
|
||||
Packages can be installed globally (by default) or in a directory (by using `attribute :path`)
|
||||
|
||||
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).
|
||||
|
||||
|
||||
@@ -31,6 +31,9 @@ end
|
||||
def npm_options
|
||||
options = ''
|
||||
options << ' -global' unless new_resource.path
|
||||
new_resource.options.each do |option|
|
||||
options << " #{option}"
|
||||
end
|
||||
options << " #{npm_package}"
|
||||
end
|
||||
|
||||
|
||||
@@ -27,6 +27,7 @@ attribute :version, :kind_of => String
|
||||
attribute :path, :kind_of => String
|
||||
attribute :url, :kind_of => String
|
||||
attribute :json, :kind_of => [String, TrueClass]
|
||||
attribute :options, :kind_of => Array, :default => []
|
||||
|
||||
attribute :user, :kind_of => String
|
||||
attribute :group, :kind_of => String
|
||||
|
||||
@@ -26,3 +26,7 @@ nodejs_npm 'grunt' do
|
||||
json true
|
||||
user 'random'
|
||||
end
|
||||
|
||||
nodejs_npm 'mocha' do
|
||||
options ['--force', '--production']
|
||||
end
|
||||
|
||||
Referência em uma Nova Issue
Bloquear um usuário