3.7 KiB
title | description |
---|---|
Node.js Versions | Node.js versions support in Renovate |
Node.js Versions
Renovate can upgrade the Node.js runtime used by your project. This way you're using the latest bug fixes, performance improvements, security mitigations, etc.
File Support
Renovate can manage the Node.js version in the following files:
- The
engines
field inpackage.json
- The
volta
field inpackage.json
- The
.nvmrc
file for the Node Version Manager - The
node_js
field in.travis.yml
How It Works
Node.js renovation in package.json > engines
and in .nvmrc
is enabled by default, if your existing version is pinned.
To enable .travis.yml
renovation, you must:
- Enable Travis renovation explicitly by setting the following Renovate configuration:
"travis": { "enabled": true }
- Optionally, configure a support policy (As documented below)
When Renovate processes your project's repository it will look for the files listed above and submit a single pull request that upgrades all Node.js versions simultaneously.
Configuring Support Policy
Renovate supports a supportPolicy
option that can be passed the following values and associated versions (current as of April 2021):
Default: lts
supportPolicy | versions | description |
---|---|---|
all | 12, 14, 15, 16 | All releases that have not passed their end date |
lts | 12, 14 | All releases classified as LTS, including in maintenance |
active | 14, 16 | All releases not in maintenance |
lts_active | 14 | All releases both LTS and active |
lts_latest | 14 | The latest LTS release |
current | 16 | The latest release from "all" |
The version numbers associated with each support policy will be updated as new versions of Node.js are released, moved to LTS or maintenance, etc.
For example, to instruct Renovate to upgrade your project to the latest Long-term Support release, you can use the following configuration:
"supportPolicy": ["lts_latest"]
We recommend that you define this support policy inside the node
configuration object.
This way, it is applied to all Node.js-related files.
For additional language support see the supportPolicy
documentation.
Configuring which version of npm Renovate uses
When binarySource=docker
, such as in the hosted WhiteSource Renovate App, Renovate will choose and install an npm
version dynamically.
To control which version or constraint is installed, you should use the engines.npm
property in your package.json
file.
Renovate bot will then use that version constraint for npm when it creates a pull request.
For example, if you want to use at least npm 6.14.11
and also allow newer versions of npm in the 6.x
range, you would put this in your package.json
file:
{
"engines": {
"npm": "^6.14.11"
}
}