fix comments

This commit is contained in:
Dmitry Shibanov 2022-10-23 14:05:58 +02:00
parent 38d01b1022
commit 2900876013
3 changed files with 29 additions and 41 deletions

47
dist/setup/index.js vendored
View file

@ -73172,6 +73172,9 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
step((generator = generator.apply(thisArg, _arguments || [])).next()); step((generator = generator.apply(thisArg, _arguments || [])).next());
}); });
}; };
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
var __importStar = (this && this.__importStar) || function (mod) { var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod; if (mod && mod.__esModule) return mod;
var result = {}; var result = {};
@ -73180,7 +73183,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
return result; return result;
}; };
Object.defineProperty(exports, "__esModule", ({ value: true })); Object.defineProperty(exports, "__esModule", ({ value: true }));
const os = __nccwpck_require__(2037); const os_1 = __importDefault(__nccwpck_require__(2037));
const assert = __importStar(__nccwpck_require__(9491)); const assert = __importStar(__nccwpck_require__(9491));
const core = __importStar(__nccwpck_require__(2186)); const core = __importStar(__nccwpck_require__(2186));
const hc = __importStar(__nccwpck_require__(9925)); const hc = __importStar(__nccwpck_require__(9925));
@ -73188,14 +73191,14 @@ const io = __importStar(__nccwpck_require__(7436));
const tc = __importStar(__nccwpck_require__(7784)); const tc = __importStar(__nccwpck_require__(7784));
const path = __importStar(__nccwpck_require__(1017)); const path = __importStar(__nccwpck_require__(1017));
const semver = __importStar(__nccwpck_require__(5911)); const semver = __importStar(__nccwpck_require__(5911));
const fs = __nccwpck_require__(7147); const fs_1 = __importDefault(__nccwpck_require__(7147));
function getNode(versionSpec, stable, checkLatest, auth, arch = os.arch()) { function getNode(versionSpec, stable, checkLatest, auth, arch = os_1.default.arch()) {
return __awaiter(this, void 0, void 0, function* () { return __awaiter(this, void 0, void 0, function* () {
// Store manifest data to avoid multiple calls // Store manifest data to avoid multiple calls
let manifest; let manifest;
let nodeVersions; let nodeVersions;
let isNightly = versionSpec.includes('nightly'); let isNightly = versionSpec.includes('nightly');
let osPlat = os.platform(); let osPlat = os_1.default.platform();
let osArch = translateArchToDistUrl(arch); let osArch = translateArchToDistUrl(arch);
if (isLtsAlias(versionSpec)) { if (isLtsAlias(versionSpec)) {
core.info('Attempt to resolve LTS alias from manifest...'); core.info('Attempt to resolve LTS alias from manifest...');
@ -73295,7 +73298,7 @@ function getNode(versionSpec, stable, checkLatest, auth, arch = os.arch()) {
extPath = yield tc.extract7z(downloadPath, undefined, _7zPath); extPath = yield tc.extract7z(downloadPath, undefined, _7zPath);
// 7z extracts to folder matching file name // 7z extracts to folder matching file name
let nestedPath = path.join(extPath, path.basename(info.fileName, '.7z')); let nestedPath = path.join(extPath, path.basename(info.fileName, '.7z'));
if (fs.existsSync(nestedPath)) { if (fs_1.default.existsSync(nestedPath)) {
extPath = nestedPath; extPath = nestedPath;
} }
} }
@ -73364,7 +73367,7 @@ function resolveLtsAliasFromManifest(versionSpec, stable, manifest) {
core.debug(`Found LTS release '${release.version}' for Node version '${versionSpec}'`); core.debug(`Found LTS release '${release.version}' for Node version '${versionSpec}'`);
return release.version.split('.')[0]; return release.version.split('.')[0];
} }
function getInfoFromManifest(versionSpec, stable, auth, osArch = translateArchToDistUrl(os.arch()), manifest) { function getInfoFromManifest(versionSpec, stable, auth, osArch = translateArchToDistUrl(os_1.default.arch()), manifest) {
return __awaiter(this, void 0, void 0, function* () { return __awaiter(this, void 0, void 0, function* () {
let info = null; let info = null;
if (!manifest) { if (!manifest) {
@ -73382,9 +73385,9 @@ function getInfoFromManifest(versionSpec, stable, auth, osArch = translateArchTo
return info; return info;
}); });
} }
function getInfoFromDist(versionSpec, arch = os.arch(), nodeVersions) { function getInfoFromDist(versionSpec, arch = os_1.default.arch(), nodeVersions) {
return __awaiter(this, void 0, void 0, function* () { return __awaiter(this, void 0, void 0, function* () {
let osPlat = os.platform(); let osPlat = os_1.default.platform();
let osArch = translateArchToDistUrl(arch); let osArch = translateArchToDistUrl(arch);
let version = yield queryDistForMatch(versionSpec, arch, nodeVersions); let version = yield queryDistForMatch(versionSpec, arch, nodeVersions);
if (!version) { if (!version) {
@ -73408,7 +73411,7 @@ function getInfoFromDist(versionSpec, arch = os.arch(), nodeVersions) {
}; };
}); });
} }
function resolveVersionFromManifest(versionSpec, stable, auth, osArch = translateArchToDistUrl(os.arch()), manifest) { function resolveVersionFromManifest(versionSpec, stable, auth, osArch = translateArchToDistUrl(os_1.default.arch()), manifest) {
return __awaiter(this, void 0, void 0, function* () { return __awaiter(this, void 0, void 0, function* () {
try { try {
const info = yield getInfoFromManifest(versionSpec, stable, auth, osArch, manifest); const info = yield getInfoFromManifest(versionSpec, stable, auth, osArch, manifest);
@ -73435,17 +73438,11 @@ function evaluateNightlyVersions(versions, versionSpec) {
} }
} }
if (range) { if (range) {
versions = versions.sort((a, b) => { versions.sort((a, b) => +semver.lt(a, b) * 1 - 0.5);
if (semver.gt(a, b)) { for (const currentVersion of versions) {
return 1; const satisfied = semver.satisfies(currentVersion.replace('-nightly', '-nightly.'), range, { includePrerelease: true });
}
return -1;
});
for (let i = versions.length - 1; i >= 0; i--) {
const potential = versions[i];
const satisfied = semver.satisfies(potential.replace('-nightly', '-nightly.'), range, { includePrerelease: true });
if (satisfied) { if (satisfied) {
version = potential; version = currentVersion;
break; break;
} }
} }
@ -73495,14 +73492,12 @@ function getNodejsDistUrl(version) {
else if (!prerelease) { else if (!prerelease) {
return 'https://nodejs.org/dist'; return 'https://nodejs.org/dist';
} }
else { return 'https://nodejs.org/download/rc';
return 'https://nodejs.org/download/rc';
}
} }
exports.getNodejsDistUrl = getNodejsDistUrl; exports.getNodejsDistUrl = getNodejsDistUrl;
function queryDistForMatch(versionSpec, arch = os.arch(), nodeVersions) { function queryDistForMatch(versionSpec, arch = os_1.default.arch(), nodeVersions) {
return __awaiter(this, void 0, void 0, function* () { return __awaiter(this, void 0, void 0, function* () {
let osPlat = os.platform(); let osPlat = os_1.default.platform();
let osArch = translateArchToDistUrl(arch); let osArch = translateArchToDistUrl(arch);
// node offers a json list of versions // node offers a json list of versions
let dataFileName; let dataFileName;
@ -73564,10 +73559,10 @@ exports.getVersionsFromDist = getVersionsFromDist;
// This method attempts to download and cache the resources from these alternative locations. // This method attempts to download and cache the resources from these alternative locations.
// Note also that the files are normally zipped but in this case they are just an exe // Note also that the files are normally zipped but in this case they are just an exe
// and lib file in a folder, not zipped. // and lib file in a folder, not zipped.
function acquireNodeFromFallbackLocation(version, arch = os.arch()) { function acquireNodeFromFallbackLocation(version, arch = os_1.default.arch()) {
return __awaiter(this, void 0, void 0, function* () { return __awaiter(this, void 0, void 0, function* () {
const initialUrl = getNodejsDistUrl(version); const initialUrl = getNodejsDistUrl(version);
let osPlat = os.platform(); let osPlat = os_1.default.platform();
let osArch = translateArchToDistUrl(arch); let osArch = translateArchToDistUrl(arch);
// Create temporary folder to download in to // Create temporary folder to download in to
const tempDownloadFolder = 'temp_' + Math.floor(Math.random() * 2000000000); const tempDownloadFolder = 'temp_' + Math.floor(Math.random() * 2000000000);

View file

@ -4,7 +4,7 @@ import * as glob from '@actions/glob';
import path from 'path'; import path from 'path';
import fs from 'fs'; import fs from 'fs';
import {State, Outputs} from './constants'; import {State} from './constants';
import { import {
getCacheDirectoryPath, getCacheDirectoryPath,
getPackageManagerInfo, getPackageManagerInfo,

View file

@ -1,4 +1,4 @@
import os = require('os'); import os from 'os';
import * as assert from 'assert'; import * as assert from 'assert';
import * as core from '@actions/core'; import * as core from '@actions/core';
import * as hc from '@actions/http-client'; import * as hc from '@actions/http-client';
@ -6,7 +6,7 @@ import * as io from '@actions/io';
import * as tc from '@actions/tool-cache'; import * as tc from '@actions/tool-cache';
import * as path from 'path'; import * as path from 'path';
import * as semver from 'semver'; import * as semver from 'semver';
import fs = require('fs'); import fs from 'fs';
// //
// Node versions interface // Node versions interface
@ -383,21 +383,15 @@ function evaluateNightlyVersions(
} }
if (range) { if (range) {
versions = versions.sort((a, b) => { versions.sort((a, b) => +semver.lt(a, b) * 1 - 0.5);
if (semver.gt(a, b)) { for (const currentVersion of versions) {
return 1;
}
return -1;
});
for (let i = versions.length - 1; i >= 0; i--) {
const potential: string = versions[i];
const satisfied: boolean = semver.satisfies( const satisfied: boolean = semver.satisfies(
potential.replace('-nightly', '-nightly.'), currentVersion.replace('-nightly', '-nightly.'),
range, range,
{includePrerelease: true} {includePrerelease: true}
); );
if (satisfied) { if (satisfied) {
version = potential; version = currentVersion;
break; break;
} }
} }
@ -451,9 +445,8 @@ export function getNodejsDistUrl(version: string) {
return 'https://nodejs.org/download/nightly'; return 'https://nodejs.org/download/nightly';
} else if (!prerelease) { } else if (!prerelease) {
return 'https://nodejs.org/dist'; return 'https://nodejs.org/dist';
} else {
return 'https://nodejs.org/download/rc';
} }
return 'https://nodejs.org/download/rc';
} }
async function queryDistForMatch( async function queryDistForMatch(