feat(node-version-file): support parsing devEngines field

Signed-off-by: Ferdinand Thiessen <opensource@fthiessen.de>
This commit is contained in:
Ferdinand Thiessen 2025-04-20 13:12:45 +02:00
parent 49933ea528
commit 88483fd687
No known key found for this signature in database
GPG key ID: 45FAE7268762B400
5 changed files with 80 additions and 19 deletions

View file

@ -71,7 +71,35 @@ steps:
- run: npm test
```
When using the `package.json` input, the action will look for `volta.node` first. If `volta.node` isn't defined, then it will look for `engines.node`.
When using the `package.json` input, the action will look in following field for a specified Node version:
1. It checks `volta.node` first.
2. Then it checks `devEngines.runtime`.
3. Then it will look for `engines.node`.
4. Otherwise it tries to resolve the file defined by [`volta.extends`](https://docs.volta.sh/advanced/workspaces)
and look for `volta.node` or `engines.node` recursively.
### Example with `devEngines`
When a runtime engine (`engines.node`) is defined but also a development engine (`devEngines.runtime`) then the `devEngine` runtime version is used.
This example will install a Node version based on the `^20.10` pattern.
```json
{
"engines": {
"node": "^20 || ^22"
},
"devEngines": {
"runtime": {
"name": "node",
"version": "^20.10"
}
}
}
```
### Example with volta pinned Node version
When both `engines.node` and `volta.node` is defined the value in `volta.node` is used.
```json
{
@ -84,8 +112,6 @@ When using the `package.json` input, the action will look for `volta.node` first
}
```
Otherwise, when [`volta.extends`](https://docs.volta.sh/advanced/workspaces) is defined, then it will resolve the corresponding file and look for `volta.node` or `engines.node` recursively.
## Architecture
You can use any of the [supported operating systems](https://docs.github.com/en/actions/using-github-hosted-runners/about-github-hosted-runners), and the compatible `architecture` can be selected using `architecture`. Values are `x86`, `x64`, `arm64`, `armv6l`, `armv7l`, `ppc64le`, `s390x` (not all of the architectures are available on all platforms).