mirror of
https://code.forgejo.org/actions/setup-node.git
synced 2025-05-19 12:54:45 +00:00
refactor: move volta logic
This commit is contained in:
parent
9aa86428fe
commit
dbfbe9b6da
4 changed files with 40 additions and 24 deletions
|
@ -495,7 +495,13 @@ function translateArchToDistUrl(arch: string): string {
|
|||
}
|
||||
|
||||
export function parseNodeVersionFile(contents: string): string {
|
||||
let nodeVersion = contents.trim();
|
||||
let nodeVersion;
|
||||
|
||||
if (contents.includes('volta')) {
|
||||
nodeVersion = JSON.parse(contents).volta.node;
|
||||
} else {
|
||||
nodeVersion = contents.trim();
|
||||
}
|
||||
|
||||
if (/^v\d/.test(nodeVersion)) {
|
||||
nodeVersion = nodeVersion.substring(1);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue