Skip to content

Commit 39b7de9

Browse files
committed
refactor
1 parent 70caeb6 commit 39b7de9

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

src/main/osinstaller/CxInstaller.ts

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@ import * as unzipper from 'unzipper';
66
import {logger} from "../wrapper/loggerConfig";
77
import {Client} from "../client/Client";
88

9+
const linuxOS = 'linux';
10+
const macOS = 'darwin';
11+
const winOS = 'win32';
912
type SupportedPlatforms = 'win32' | 'darwin' | 'linux';
1013

1114
interface PlatformData {
@@ -22,9 +25,9 @@ export class CxInstaller {
2225
private readonly client: Client;
2326

2427
private static readonly PLATFORMS: Record<SupportedPlatforms, PlatformData> = {
25-
win32: { platform: 'windows', extension: 'zip' },
26-
darwin: { platform: 'darwin', extension: 'tar.gz' },
27-
linux: { platform: 'linux', extension: 'tar.gz' }
28+
win32: { platform: winOS, extension: 'zip' },
29+
darwin: { platform: macOS, extension: 'tar.gz' },
30+
linux: { platform: linuxOS, extension: 'tar.gz' }
2831
};
2932

3033
constructor(platform: string, client: Client) {
@@ -48,7 +51,7 @@ export class CxInstaller {
4851

4952
private getArchitecture(): string {
5053
// For non-linux platforms we default to x64.
51-
if (this.platform !== 'linux') {
54+
if (this.platform !== linuxOS) {
5255
return 'x64';
5356
}
5457

@@ -84,7 +87,6 @@ export class CxInstaller {
8487
const zipPath = path.join(this.resourceDirPath, this.getCompressFolderName());
8588

8689
await this.client.downloadFile(url, zipPath);
87-
logger.info('Downloaded CLI to:', zipPath);
8890

8991
await this.extractArchive(zipPath, this.resourceDirPath);
9092
await this.saveVersionFile(this.resourceDirPath, cliVersion);
@@ -191,6 +193,6 @@ export class CxInstaller {
191193
}
192194

193195
private getCompressFolderName(): string {
194-
return `ast-cli.${this.platform === 'win32' ? 'zip' : 'tar.gz'}`;
196+
return `ast-cli.${this.platform === winOS ? 'zip' : 'tar.gz'}`;
195197
}
196198
}

0 commit comments

Comments
 (0)