Skip to content

Commit ef917a2

Browse files
committed
Apply requested changes
1 parent de40daa commit ef917a2

File tree

2 files changed

+4
-14
lines changed

2 files changed

+4
-14
lines changed

dist/setup/index.js

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -73189,6 +73189,7 @@ const tc = __importStar(__nccwpck_require__(7784));
7318973189
const path = __importStar(__nccwpck_require__(1017));
7319073190
const semver = __importStar(__nccwpck_require__(5911));
7319173191
const fs = __nccwpck_require__(7147);
73192+
const semver_1 = __nccwpck_require__(5911);
7319273193
const isVersionCanary = (versionSpec) => versionSpec.includes(`-v8-canary`);
7319373194
function getNode(versionSpec, stable, checkLatest, auth, arch = os.arch()) {
7319473195
return __awaiter(this, void 0, void 0, function* () {
@@ -73417,16 +73418,10 @@ function resolveVersionFromManifest(versionSpec, stable, auth, osArch = translat
7341773418
}
7341873419
});
7341973420
}
73420-
// TODO - should we just export this from @actions/tool-cache? Lifted directly from there
7342173421
function evaluateVersions(versions, versionSpec) {
7342273422
let version = '';
7342373423
core.debug(`evaluating ${versions.length} versions`);
73424-
versions = versions.sort((a, b) => {
73425-
if (semver.gt(a, b)) {
73426-
return 1;
73427-
}
73428-
return -1;
73429-
});
73424+
versions = versions.sort(semver_1.compare);
7343073425
const matcher = isVersionCanary(versionSpec)
7343173426
? evaluateCanaryMatcher(versionSpec)
7343273427
: potential => semver.satisfies(potential, versionSpec);

src/installer.ts

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import * as tc from '@actions/tool-cache';
77
import * as path from 'path';
88
import * as semver from 'semver';
99
import fs = require('fs');
10+
import {compare} from 'semver';
1011

1112
//
1213
// Node versions interface
@@ -355,19 +356,13 @@ async function resolveVersionFromManifest(
355356
}
356357
}
357358

358-
// TODO - should we just export this from @actions/tool-cache? Lifted directly from there
359359
export function evaluateVersions(
360360
versions: string[],
361361
versionSpec: string
362362
): string {
363363
let version = '';
364364
core.debug(`evaluating ${versions.length} versions`);
365-
versions = versions.sort((a, b) => {
366-
if (semver.gt(a, b)) {
367-
return 1;
368-
}
369-
return -1;
370-
});
365+
versions = versions.sort(compare);
371366

372367
const matcher: (potential: string) => boolean = isVersionCanary(versionSpec)
373368
? evaluateCanaryMatcher(versionSpec)

0 commit comments

Comments
 (0)