Skip to content

Commit

Permalink
Apply requested changes
Browse files Browse the repository at this point in the history
  • Loading branch information
dsame committed Nov 14, 2022
1 parent de40daa commit ef917a2
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 14 deletions.
9 changes: 2 additions & 7 deletions dist/setup/index.js
Expand Up @@ -73189,6 +73189,7 @@ const tc = __importStar(__nccwpck_require__(7784));
const path = __importStar(__nccwpck_require__(1017));
const semver = __importStar(__nccwpck_require__(5911));
const fs = __nccwpck_require__(7147);
const semver_1 = __nccwpck_require__(5911);
const isVersionCanary = (versionSpec) => versionSpec.includes(`-v8-canary`);
function getNode(versionSpec, stable, checkLatest, auth, arch = os.arch()) {
return __awaiter(this, void 0, void 0, function* () {
Expand Down Expand Up @@ -73417,16 +73418,10 @@ function resolveVersionFromManifest(versionSpec, stable, auth, osArch = translat
}
});
}
// TODO - should we just export this from @actions/tool-cache? Lifted directly from there
function evaluateVersions(versions, versionSpec) {
let version = '';
core.debug(`evaluating ${versions.length} versions`);
versions = versions.sort((a, b) => {
if (semver.gt(a, b)) {
return 1;
}
return -1;
});
versions = versions.sort(semver_1.compare);
const matcher = isVersionCanary(versionSpec)
? evaluateCanaryMatcher(versionSpec)
: potential => semver.satisfies(potential, versionSpec);
Expand Down
9 changes: 2 additions & 7 deletions src/installer.ts
Expand Up @@ -7,6 +7,7 @@ import * as tc from '@actions/tool-cache';
import * as path from 'path';
import * as semver from 'semver';
import fs = require('fs');
import {compare} from 'semver';

//
// Node versions interface
Expand Down Expand Up @@ -355,19 +356,13 @@ async function resolveVersionFromManifest(
}
}

// TODO - should we just export this from @actions/tool-cache? Lifted directly from there
export function evaluateVersions(
versions: string[],
versionSpec: string
): string {
let version = '';
core.debug(`evaluating ${versions.length} versions`);
versions = versions.sort((a, b) => {
if (semver.gt(a, b)) {
return 1;
}
return -1;
});
versions = versions.sort(compare);

const matcher: (potential: string) => boolean = isVersionCanary(versionSpec)
? evaluateCanaryMatcher(versionSpec)
Expand Down

0 comments on commit ef917a2

Please sign in to comment.