Add support for volta.extends (#921)

* Add support for `volta.extends`

* Code review
This commit is contained in:
Manta Anantachai S 2023-12-29 16:31:21 +07:00 committed by GitHub
parent b39b52d121
commit d86ebcd40b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
10 changed files with 211 additions and 193 deletions

View file

@ -1,6 +1,5 @@
import * as core from '@actions/core';
import fs from 'fs';
import os from 'os';
import * as auth from './authutil';
@ -8,7 +7,7 @@ import * as path from 'path';
import {restoreCache} from './cache-restore';
import {isCacheFeatureAvailable} from './cache-utils';
import {getNodejsDistribution} from './distributions/installer-factory';
import {parseNodeVersionFile, printEnvDetailsAndSetOutput} from './util';
import {getNodeVersionFromFile, printEnvDetailsAndSetOutput} from './util';
import {State} from './constants';
export async function run() {
@ -99,15 +98,7 @@ function resolveVersionInput(): string {
versionFileInput
);
if (!fs.existsSync(versionFilePath)) {
throw new Error(
`The specified node version file at: ${versionFilePath} does not exist`
);
}
const parsedVersion = parseNodeVersionFile(
fs.readFileSync(versionFilePath, 'utf8')
);
const parsedVersion = getNodeVersionFromFile(versionFilePath);
if (parsedVersion) {
version = parsedVersion;