@@ -6,6 +6,9 @@ import * as unzipper from 'unzipper';
6
6
import { logger } from "../wrapper/loggerConfig" ;
7
7
import { Client } from "../client/Client" ;
8
8
9
+ const linuxOS = 'linux' ;
10
+ const macOS = 'darwin' ;
11
+ const winOS = 'win32' ;
9
12
type SupportedPlatforms = 'win32' | 'darwin' | 'linux' ;
10
13
11
14
interface PlatformData {
@@ -22,9 +25,9 @@ export class CxInstaller {
22
25
private readonly client : Client ;
23
26
24
27
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' }
28
31
} ;
29
32
30
33
constructor ( platform : string , client : Client ) {
@@ -48,7 +51,7 @@ export class CxInstaller {
48
51
49
52
private getArchitecture ( ) : string {
50
53
// For non-linux platforms we default to x64.
51
- if ( this . platform !== 'linux' ) {
54
+ if ( this . platform !== linuxOS ) {
52
55
return 'x64' ;
53
56
}
54
57
@@ -84,7 +87,6 @@ export class CxInstaller {
84
87
const zipPath = path . join ( this . resourceDirPath , this . getCompressFolderName ( ) ) ;
85
88
86
89
await this . client . downloadFile ( url , zipPath ) ;
87
- logger . info ( 'Downloaded CLI to:' , zipPath ) ;
88
90
89
91
await this . extractArchive ( zipPath , this . resourceDirPath ) ;
90
92
await this . saveVersionFile ( this . resourceDirPath , cliVersion ) ;
@@ -191,6 +193,6 @@ export class CxInstaller {
191
193
}
192
194
193
195
private getCompressFolderName ( ) : string {
194
- return `ast-cli.${ this . platform === 'win32' ? 'zip' : 'tar.gz' } ` ;
196
+ return `ast-cli.${ this . platform === winOS ? 'zip' : 'tar.gz' } ` ;
195
197
}
196
198
}
0 commit comments