@@ -34,7 +34,7 @@ const pipelineAsync = promisify(pipeline);
3434const vscodeStableReleasesAPI = `https://update.code.visualstudio.com/api/releases/stable` ;
3535const vscodeInsiderReleasesAPI = `https://update.code.visualstudio.com/api/releases/insider` ;
3636
37- const downloadDirNameFormat = / ^ v s c o d e - (?< platform > [ a - z ] + ) - (?< version > [ 0 - 9 . ] + ) $ / ;
37+ const downloadDirNameFormat = / ^ v s c o d e - (?< platform > [ a - z 0 - 9 - ] + ) - (?< version > [ 0 - 9 . ] + ) $ / ;
3838const makeDownloadDirName = ( platform : string , version : Version ) => `vscode-${ platform } -${ version . id } ` ;
3939
4040const DOWNLOAD_ATTEMPTS = 3 ;
@@ -60,10 +60,10 @@ interface IFetchInferredOptions extends IFetchStableOptions {
6060( process as any ) . noAsar = true ;
6161
6262export const fetchStableVersions = onceWithoutRejections ( ( released : boolean , timeout : number ) =>
63- request . getJSON < string [ ] > ( `${ vscodeStableReleasesAPI } ?released=${ released } ` , timeout )
63+ request . getJSON < string [ ] > ( `${ vscodeStableReleasesAPI } ?released=${ released } ` , timeout ) ,
6464) ;
6565export const fetchInsiderVersions = onceWithoutRejections ( ( released : boolean , timeout : number ) =>
66- request . getJSON < string [ ] > ( `${ vscodeInsiderReleasesAPI } ?released=${ released } ` , timeout )
66+ request . getJSON < string [ ] > ( `${ vscodeInsiderReleasesAPI } ?released=${ released } ` , timeout ) ,
6767) ;
6868
6969/**
@@ -134,7 +134,7 @@ async function fallbackToLocalEntries(cachePath: string, platform: string, fromE
134134 . filter ( isDefined )
135135 . filter ( ( e ) => e . groups ! . platform === platform )
136136 . map ( ( e ) => e . groups ! . version )
137- . sort ( ( a , b ) => Number ( b ) - Number ( a ) ) ;
137+ . sort ( ( a , b ) => semver . compare ( b , a ) ) ;
138138
139139 if ( fallbackTo ) {
140140 console . warn ( `Error retrieving VS Code versions, using already-installed version ${ fallbackTo } ` , fromError ) ;
@@ -344,7 +344,7 @@ async function unzipVSCode(
344344 reporter : ProgressReporter ,
345345 extractDir : string ,
346346 platform : DownloadPlatform ,
347- { format, stream, length, sha256 } : IDownload
347+ { format, stream, length, sha256 } : IDownload ,
348348) {
349349 const stagingFile = path . join ( tmpdir ( ) , `vscode-test-${ Date . now ( ) } .zip` ) ;
350350 const checksum = validateStream ( stream , length , sha256 ) ;
@@ -414,7 +414,7 @@ function spawnDecompressorChild(command: string, args: ReadonlyArray<string>, in
414414
415415 child . on ( 'error' , reject ) ;
416416 child . on ( 'exit' , ( code ) =>
417- code === 0 ? resolve ( ) : reject ( new Error ( `Failed to unzip archive, exited with ${ code } ` ) )
417+ code === 0 ? resolve ( ) : reject ( new Error ( `Failed to unzip archive, exited with ${ code } ` ) ) ,
418418 ) ;
419419 } ) ;
420420}
@@ -563,17 +563,17 @@ export async function downloadAndUnzipVSCode(
563563 version ?: DownloadVersion ,
564564 platform ?: DownloadPlatform ,
565565 reporter ?: ProgressReporter ,
566- extractSync ?: boolean
566+ extractSync ?: boolean ,
567567) : Promise < string > ;
568568export async function downloadAndUnzipVSCode (
569569 versionOrOptions ?: DownloadVersion | Partial < DownloadOptions > ,
570570 platform ?: DownloadPlatform ,
571571 reporter ?: ProgressReporter ,
572- extractSync ?: boolean
572+ extractSync ?: boolean ,
573573) : Promise < string > {
574574 return await download (
575575 typeof versionOrOptions === 'object'
576576 ? ( versionOrOptions as Partial < DownloadOptions > )
577- : { version : versionOrOptions , platform, reporter, extractSync }
577+ : { version : versionOrOptions , platform, reporter, extractSync } ,
578578 ) ;
579579}
0 commit comments