Refactor code

This commit is contained in:
IvanZosimov 2022-09-28 14:10:10 +02:00
parent 75d47e04fb
commit b74b8e018a
2 changed files with 7 additions and 10 deletions

7
dist/index.js vendored
View File

@ -484,12 +484,11 @@ function run() {
auth.configAuthentication(sourceUrl, configFile); auth.configAuthentication(sourceUrl, configFile);
} }
const comparisonRange = globalJsonFileInput const comparisonRange = globalJsonFileInput
? versions.at(-1) ? versions[versions.length - 1]
: '*'; : '*';
const includePrereleaseOption = { const versionToOutput = semver_1.default.maxSatisfying(installedDotnetVersions, comparisonRange, {
includePrerelease: true includePrerelease: true
}; });
const versionToOutput = semver_1.default.maxSatisfying(installedDotnetVersions, comparisonRange, includePrereleaseOption);
core.setOutput('dotnet-version', versionToOutput); core.setOutput('dotnet-version', versionToOutput);
const matchersPath = path_1.default.join(__dirname, '..', '.github'); const matchersPath = path_1.default.join(__dirname, '..', '.github');
core.info(`##[add-matcher]${path_1.default.join(matchersPath, 'csc.json')}`); core.info(`##[add-matcher]${path_1.default.join(matchersPath, 'csc.json')}`);

View File

@ -75,17 +75,15 @@ export async function run() {
} }
const comparisonRange: string = globalJsonFileInput const comparisonRange: string = globalJsonFileInput
? versions.at(-1)! ? versions[versions.length - 1]!
: '*'; : '*';
const includePrereleaseOption = {
includePrerelease: true
};
const versionToOutput = semver.maxSatisfying( const versionToOutput = semver.maxSatisfying(
installedDotnetVersions, installedDotnetVersions,
comparisonRange, comparisonRange,
includePrereleaseOption {
includePrerelease: true
}
); );
core.setOutput('dotnet-version', versionToOutput); core.setOutput('dotnet-version', versionToOutput);