Upgrade nodejs cookbook from 7.3 to 11.0

This commit is contained in:
2026-07-10 11:19:29 +02:00
parent 86f7b68726
commit bd193567ca
46 changed files with 1002 additions and 890 deletions
+52
View File
@@ -0,0 +1,52 @@
# Migration Guide
This release is a breaking migration from recipes and node attributes to custom resources.
## What Changed
The cookbook no longer exposes `nodejs::default`, `nodejs::install`, `nodejs::repo`, `nodejs::npm`, `nodejs::npm_packages`, or the install-method recipes. The `attributes/` directory was removed. Configure Node.js through resource properties instead of `node['nodejs']` attributes.
## Recipe to Resource Mapping
| Before | After |
| ------------------------------------------------- | ------------------------------------------------------------- |
| `include_recipe 'nodejs::default'` | `nodejs_install 'nodejs'` plus optional `nodejs_npm_packages` |
| `include_recipe 'nodejs::repo'` | `nodejs_repository 'nodesource'` |
| `include_recipe 'nodejs::nodejs_from_package'` | `nodejs_install 'nodejs' do install_method 'package' end` |
| `include_recipe 'nodejs::nodejs_from_binary'` | `nodejs_install 'nodejs' do install_method 'binary' end` |
| `include_recipe 'nodejs::nodejs_from_source'` | `nodejs_install 'nodejs' do install_method 'source' end` |
| `include_recipe 'nodejs::nodejs_from_chocolatey'` | `nodejs_install 'nodejs' do install_method 'chocolatey' end` |
| `include_recipe 'nodejs::npm'` | `nodejs_npm_install 'npm'` |
| `node['nodejs']['npm_packages']` | `nodejs_npm_packages 'packages'` |
## Examples
Install Node.js from NodeSource packages:
```ruby
nodejs_install 'nodejs' do
install_method 'package'
version '24.15.0'
end
```
Install packages that used to be configured with `node['nodejs']['npm_packages']`:
```ruby
nodejs_npm_packages 'application packages' do
packages [
{ name: 'express' },
{ name: 'socket.io', version: '4.8.1' },
]
end
```
The `nodejs_npm` alias still works for the `npm_package` resource, but it no longer auto-includes any Node.js or npm recipes. Install Node.js first:
```ruby
nodejs_install 'nodejs'
nodejs_npm 'express'
```
See `test/cookbooks/test/recipes/` for runnable migration examples used by Kitchen.