From 7bbeb80d2449ed6780428f731facb4cb4154c65f Mon Sep 17 00:00:00 2001 From: qhy040404 <45379733+qhy040404@users.noreply.github.com> Date: Fri, 9 Sep 2022 19:35:58 +0800 Subject: [PATCH] Fix typo (#380) --- __tests__/cleanup-java.test.ts | 2 +- .../distributors/corretto-installer.test.ts | 4 +-- __tests__/distributors/zulu-installer.test.ts | 2 +- dist/cleanup/index.js | 2 +- dist/setup/index.js | 26 ++++++++-------- src/cache.ts | 2 +- src/distributions/base-installer.ts | 4 +-- src/distributions/corretto/installer.ts | 30 +++++++++---------- src/distributions/corretto/models.ts | 2 +- 9 files changed, 37 insertions(+), 37 deletions(-) diff --git a/__tests__/cleanup-java.test.ts b/__tests__/cleanup-java.test.ts index 19551553..0a15cc0c 100644 --- a/__tests__/cleanup-java.test.ts +++ b/__tests__/cleanup-java.test.ts @@ -26,7 +26,7 @@ describe('cleanup', () => { resetState(); }); - it('does not fail nor warn even when the save provess throws a ReserveCacheError', async () => { + it('does not fail nor warn even when the save process throws a ReserveCacheError', async () => { spyCacheSave.mockImplementation((paths: string[], key: string) => Promise.reject( new cache.ReserveCacheError( diff --git a/__tests__/distributors/corretto-installer.test.ts b/__tests__/distributors/corretto-installer.test.ts index 45d51aca..3e3322fe 100644 --- a/__tests__/distributors/corretto-installer.test.ts +++ b/__tests__/distributors/corretto-installer.test.ts @@ -144,8 +144,8 @@ describe('getAvailableVersions', () => { }); }); - const mockPlatform = (distributon: CorrettoDistribution, platform: string) => { - distributon['getPlatformOption'] = () => platform; + const mockPlatform = (distribution: CorrettoDistribution, platform: string) => { + distribution['getPlatformOption'] = () => platform; const mockedExtension = platform === 'windows' ? 'zip' : 'tar.gz'; spyGetDownloadArchiveExtension.mockReturnValue(mockedExtension); }; diff --git a/__tests__/distributors/zulu-installer.test.ts b/__tests__/distributors/zulu-installer.test.ts index 49d71d4a..8f73192d 100644 --- a/__tests__/distributors/zulu-installer.test.ts +++ b/__tests__/distributors/zulu-installer.test.ts @@ -110,7 +110,7 @@ describe('findPackageForDownload', () => { ['15', '15.0.2+7'], ['9.0.0', '9.0.0+0'], ['9.0', '9.0.1+0'], - ['8.0.262', '8.0.262+19'], // validate correct choise between [8.0.262.17, 8.0.262.19, 8.0.262.18] + ['8.0.262', '8.0.262+19'], // validate correct choice between [8.0.262.17, 8.0.262.19, 8.0.262.18] ['8.0.262+17', '8.0.262+17'], ['15.0.1+8', '15.0.1+8'], ['15.0.1+9', '15.0.1+9'] diff --git a/dist/cleanup/index.js b/dist/cleanup/index.js index 94de5e6e..e4fcbd59 100644 --- a/dist/cleanup/index.js +++ b/dist/cleanup/index.js @@ -68253,7 +68253,7 @@ function save(id) { return __awaiter(this, void 0, void 0, function* () { const packageManager = findPackageManager(id); const matchedKey = core.getState(CACHE_MATCHED_KEY); - // Inputs are re-evaluted before the post action, so we want the original key used for restore + // Inputs are re-evaluated before the post action, so we want the original key used for restore const primaryKey = core.getState(STATE_CACHE_PRIMARY_KEY); if (!primaryKey) { core.warning('Error retrieving key from state.'); diff --git a/dist/setup/index.js b/dist/setup/index.js index 68cc9396..b40fb347 100644 --- a/dist/setup/index.js +++ b/dist/setup/index.js @@ -103458,7 +103458,7 @@ function save(id) { return __awaiter(this, void 0, void 0, function* () { const packageManager = findPackageManager(id); const matchedKey = core.getState(CACHE_MATCHED_KEY); - // Inputs are re-evaluted before the post action, so we want the original key used for restore + // Inputs are re-evaluated before the post action, so we want the original key used for restore const primaryKey = core.getState(STATE_CACHE_PRIMARY_KEY); if (!primaryKey) { core.warning('Error retrieving key from state.'); @@ -103865,13 +103865,13 @@ class JavaBase { }; } setJavaDefault(version, toolPath) { - const majorVerssion = version.split('.')[0]; + const majorVersion = version.split('.')[0]; core.exportVariable('JAVA_HOME', toolPath); core.addPath(path_1.default.join(toolPath, 'bin')); core.setOutput('distribution', this.distribution); core.setOutput('path', toolPath); core.setOutput('version', version); - core.exportVariable(`JAVA_HOME_${majorVerssion}_${this.architecture.toUpperCase()}`, toolPath); + core.exportVariable(`JAVA_HOME_${majorVersion}_${this.architecture.toUpperCase()}`, toolPath); } } exports.JavaBase = JavaBase; @@ -103975,7 +103975,7 @@ class CorrettoDistribution extends base_installer_1.JavaBase { const arch = this.architecture; const imageType = this.packageType; if (core.isDebug()) { - console.time('coretto-retrieve-available-versions'); + console.time('corretto-retrieve-available-versions'); } const availableVersionsUrl = 'https://corretto.github.io/corretto-downloads/latest_links/indexmap_with_checksum.json'; const fetchCurrentVersions = yield this.http.getJson(availableVersionsUrl); @@ -103983,25 +103983,25 @@ class CorrettoDistribution extends base_installer_1.JavaBase { if (!fetchedCurrentVersions) { throw Error(`Could not fetch latest corretto versions from ${availableVersionsUrl}`); } - const eligbleVersions = (_b = (_a = fetchedCurrentVersions === null || fetchedCurrentVersions === void 0 ? void 0 : fetchedCurrentVersions[platform]) === null || _a === void 0 ? void 0 : _a[arch]) === null || _b === void 0 ? void 0 : _b[imageType]; - const availableVersions = this.getAvailableVersionsForPlatform(eligbleVersions); + const eligibleVersions = (_b = (_a = fetchedCurrentVersions === null || fetchedCurrentVersions === void 0 ? void 0 : fetchedCurrentVersions[platform]) === null || _a === void 0 ? void 0 : _a[arch]) === null || _b === void 0 ? void 0 : _b[imageType]; + const availableVersions = this.getAvailableVersionsForPlatform(eligibleVersions); if (core.isDebug()) { this.printAvailableVersions(availableVersions); } return availableVersions; }); } - getAvailableVersionsForPlatform(eligbleVersions) { + getAvailableVersionsForPlatform(eligibleVersions) { const availableVersions = []; - for (const version in eligbleVersions) { - const availableVersion = eligbleVersions[version]; + for (const version in eligibleVersions) { + const availableVersion = eligibleVersions[version]; for (const fileType in availableVersion) { const skipNonExtractableBinaries = fileType != util_1.getDownloadArchiveExtension(); if (skipNonExtractableBinaries) { continue; } const availableVersionDetails = availableVersion[fileType]; - const correttoVersion = this.getCorettoVersion(availableVersionDetails.resource); + const correttoVersion = this.getCorrettoVersion(availableVersionDetails.resource); availableVersions.push({ checksum: availableVersionDetails.checksum, checksum_sha256: availableVersionDetails.checksum_sha256, @@ -104017,13 +104017,13 @@ class CorrettoDistribution extends base_installer_1.JavaBase { } printAvailableVersions(availableVersions) { core.startGroup('Print information about available versions'); - console.timeEnd('coretto-retrieve-available-versions'); + console.timeEnd('corretto-retrieve-available-versions'); console.log(`Available versions: [${availableVersions.length}]`); console.log(availableVersions.map(item => `${item.version}: ${item.correttoVersion}`).join(', ')); core.endGroup(); } getPlatformOption() { - // Coretto has its own platform names so we need to map them + // Corretto has its own platform names so we need to map them switch (process.platform) { case 'darwin': return 'macos'; @@ -104033,7 +104033,7 @@ class CorrettoDistribution extends base_installer_1.JavaBase { return process.platform; } } - getCorettoVersion(resource) { + getCorrettoVersion(resource) { const regex = /(\d+.+)\//; const match = regex.exec(resource); if (match === null) { diff --git a/src/cache.ts b/src/cache.ts index 324a8f6f..1533ed05 100644 --- a/src/cache.ts +++ b/src/cache.ts @@ -116,7 +116,7 @@ export async function save(id: string) { const packageManager = findPackageManager(id); const matchedKey = core.getState(CACHE_MATCHED_KEY); - // Inputs are re-evaluted before the post action, so we want the original key used for restore + // Inputs are re-evaluated before the post action, so we want the original key used for restore const primaryKey = core.getState(STATE_CACHE_PRIMARY_KEY); if (!primaryKey) { diff --git a/src/distributions/base-installer.ts b/src/distributions/base-installer.ts index 3e8d62dd..e25ed344 100644 --- a/src/distributions/base-installer.ts +++ b/src/distributions/base-installer.ts @@ -142,12 +142,12 @@ export abstract class JavaBase { } protected setJavaDefault(version: string, toolPath: string) { - const majorVerssion = version.split('.')[0]; + const majorVersion = version.split('.')[0]; core.exportVariable('JAVA_HOME', toolPath); core.addPath(path.join(toolPath, 'bin')); core.setOutput('distribution', this.distribution); core.setOutput('path', toolPath); core.setOutput('version', version); - core.exportVariable(`JAVA_HOME_${majorVerssion}_${this.architecture.toUpperCase()}`, toolPath); + core.exportVariable(`JAVA_HOME_${majorVersion}_${this.architecture.toUpperCase()}`, toolPath); } } diff --git a/src/distributions/corretto/installer.ts b/src/distributions/corretto/installer.ts index 5e3dc623..cc0cad0a 100644 --- a/src/distributions/corretto/installer.ts +++ b/src/distributions/corretto/installer.ts @@ -5,7 +5,7 @@ import path from 'path'; import { extractJdkFile, getDownloadArchiveExtension } from '../../util'; import { JavaBase } from '../base-installer'; import { JavaDownloadRelease, JavaInstallerOptions, JavaInstallerResults } from '../base-models'; -import { ICorrettoAllAvailableVersions, ICorettoAvailableVersions } from './models'; +import { ICorrettoAllAvailableVersions, ICorrettoAvailableVersions } from './models'; export class CorrettoDistribution extends JavaBase { constructor(installerOptions: JavaInstallerOptions) { @@ -66,13 +66,13 @@ export class CorrettoDistribution extends JavaBase { return resolvedVersion; } - private async getAvailableVersions(): Promise { + private async getAvailableVersions(): Promise { const platform = this.getPlatformOption(); const arch = this.architecture; const imageType = this.packageType; if (core.isDebug()) { - console.time('coretto-retrieve-available-versions'); + console.time('corretto-retrieve-available-versions'); } const availableVersionsUrl = @@ -85,8 +85,8 @@ export class CorrettoDistribution extends JavaBase { throw Error(`Could not fetch latest corretto versions from ${availableVersionsUrl}`); } - const eligbleVersions = fetchedCurrentVersions?.[platform]?.[arch]?.[imageType]; - const availableVersions = this.getAvailableVersionsForPlatform(eligbleVersions); + const eligibleVersions = fetchedCurrentVersions?.[platform]?.[arch]?.[imageType]; + const availableVersions = this.getAvailableVersionsForPlatform(eligibleVersions); if (core.isDebug()) { this.printAvailableVersions(availableVersions); @@ -96,19 +96,19 @@ export class CorrettoDistribution extends JavaBase { } private getAvailableVersionsForPlatform( - eligbleVersions: ICorrettoAllAvailableVersions['os']['arch']['imageType'] | undefined - ): ICorettoAvailableVersions[] { - const availableVersions: ICorettoAvailableVersions[] = []; + eligibleVersions: ICorrettoAllAvailableVersions['os']['arch']['imageType'] | undefined + ): ICorrettoAvailableVersions[] { + const availableVersions: ICorrettoAvailableVersions[] = []; - for (const version in eligbleVersions) { - const availableVersion = eligbleVersions[version]; + for (const version in eligibleVersions) { + const availableVersion = eligibleVersions[version]; for (const fileType in availableVersion) { const skipNonExtractableBinaries = fileType != getDownloadArchiveExtension(); if (skipNonExtractableBinaries) { continue; } const availableVersionDetails = availableVersion[fileType]; - const correttoVersion = this.getCorettoVersion(availableVersionDetails.resource); + const correttoVersion = this.getCorrettoVersion(availableVersionDetails.resource); availableVersions.push({ checksum: availableVersionDetails.checksum, @@ -124,9 +124,9 @@ export class CorrettoDistribution extends JavaBase { return availableVersions; } - private printAvailableVersions(availableVersions: ICorettoAvailableVersions[]) { + private printAvailableVersions(availableVersions: ICorrettoAvailableVersions[]) { core.startGroup('Print information about available versions'); - console.timeEnd('coretto-retrieve-available-versions'); + console.timeEnd('corretto-retrieve-available-versions'); console.log(`Available versions: [${availableVersions.length}]`); console.log( availableVersions.map(item => `${item.version}: ${item.correttoVersion}`).join(', ') @@ -135,7 +135,7 @@ export class CorrettoDistribution extends JavaBase { } private getPlatformOption(): string { - // Coretto has its own platform names so we need to map them + // Corretto has its own platform names so we need to map them switch (process.platform) { case 'darwin': return 'macos'; @@ -146,7 +146,7 @@ export class CorrettoDistribution extends JavaBase { } } - private getCorettoVersion(resource: string): string { + private getCorrettoVersion(resource: string): string { const regex = /(\d+.+)\//; const match = regex.exec(resource); if (match === null) { diff --git a/src/distributions/corretto/models.ts b/src/distributions/corretto/models.ts index 1ad44cea..3d24842c 100644 --- a/src/distributions/corretto/models.ts +++ b/src/distributions/corretto/models.ts @@ -14,7 +14,7 @@ export interface ICorrettoAllAvailableVersions { }; } -export interface ICorettoAvailableVersions { +export interface ICorrettoAvailableVersions { version: string; fileType: string; checksum: string;