mirror of
https://github.com/actions/setup-node.git
synced 2025-12-20 23:37:07 +00:00
Merge 25df5cda4f into 395ad32622
This commit is contained in:
commit
122adcd5c2
6 changed files with 117 additions and 19 deletions
12
src/util.ts
12
src/util.ts
|
|
@ -26,6 +26,18 @@ export function getNodeVersionFromFile(versionFilePath: string): string | null {
|
|||
return manifest.volta.node;
|
||||
}
|
||||
|
||||
// support devEngines from npm 11
|
||||
if (manifest.devEngines?.runtime) {
|
||||
// find an entry with name set to node and having set a version.
|
||||
// the devEngines.runtime can either be an object or an array of objects
|
||||
const nodeEntry = [manifest.devEngines.runtime]
|
||||
.flat()
|
||||
.find(({name, version}) => name.toLowerCase() === 'node' && version);
|
||||
if (nodeEntry) {
|
||||
return nodeEntry.version;
|
||||
}
|
||||
}
|
||||
|
||||
if (manifest.engines?.node) {
|
||||
return manifest.engines.node;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue