Upgrade nodejs to the latest version from the repo

This is possible in newer versions of the nodejs cookbook, by setting
the `node["nodejs"]["package_action"]["nodejs"]` attribute to `:upgrade`
This commit is contained in:
Greg Karékinian
2021-03-30 13:58:55 +02:00
parent 9fc49deafe
commit edf2e071e4
18 changed files with 234 additions and 77 deletions

View File

@@ -16,7 +16,7 @@
# limitations under the License.
#
Chef::Recipe.send(:include, NodeJs::Helper)
Chef::DSL::Recipe.include NodeJs::Helper
# Shamelessly borrowed from http://docs.chef.io/dsl_recipe_method_platform.html
# Surely there's a more canonical way to get arch?
@@ -47,6 +47,7 @@ archive_name = 'nodejs-binary'
binaries = ['bin/node']
binaries.push('bin/npm') if node['nodejs']['npm']['install_method'] == 'embedded'
binaries.push('bin/npx') if node['nodejs']['npm']['install_method'] == 'embedded'
if node['nodejs']['binary']['url']
nodejs_bin_url = node['nodejs']['binary']['url']
@@ -61,5 +62,6 @@ ark archive_name do
version node['nodejs']['version']
checksum checksum
has_binaries binaries
append_env_path node['nodejs']['binary']['append_env_path']
action :install
end