diff --git a/CHANGELOG.md b/CHANGELOG.md index f8aa980b..3c4ae7d6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,7 @@ ### 2.0.3 | 2021-01-11 - Fix `@vscode/test-electron` auto updating +- Use arm64 version of VS Code on relevant platforms ### 2.0.2 | 2021-01-07 diff --git a/lib/download.ts b/lib/download.ts index 626b5b5a..5664ca2a 100644 --- a/lib/download.ts +++ b/lib/download.ts @@ -14,7 +14,8 @@ import { insidersDownloadDirToExecutablePath, insidersDownloadDirMetadata, getLatestInsidersMetadata, - systemDefaultPlatform + systemDefaultPlatform, + systemDefaultArchitecture } from './util'; import { IncomingMessage } from 'http'; import { Extract as extract } from 'unzipper'; @@ -49,10 +50,17 @@ type StringLiteralUnion = T | (U & {}); export type DownloadVersion = StringLiteralUnion<'insiders' | 'stable'>; export type DownloadPlatform = StringLiteralUnion<'darwin' | 'win32-archive' | 'win32-x64-archive' | 'linux-x64'>; +export const enum DownloadArchitecture { + X64 = 'x64', + X86 = 'ia32', + ARM64 = 'arm64', +} + export interface DownloadOptions { readonly cachePath: string; readonly version: DownloadVersion; readonly platform: DownloadPlatform; + readonly architecture: DownloadArchitecture; } /** @@ -67,7 +75,7 @@ async function downloadVSCodeArchive(options: DownloadOptions) { fs.mkdirSync(options.cachePath); } - const downloadUrl = getVSCodeDownloadUrl(options.version, options.platform); + const downloadUrl = getVSCodeDownloadUrl(options.version, options.platform, options.architecture); const text = `Downloading VS Code ${options.version} from ${downloadUrl}`; process.stdout.write(text); @@ -179,6 +187,7 @@ export const defaultCachePath = path.resolve(extensionRoot, '.vscode-test'); export async function download(options?: Partial): Promise { let version = options?.version; const platform = options?.platform ?? systemDefaultPlatform; + const architecture = options?.architecture ?? systemDefaultArchitecture; const cachePath = options?.cachePath ?? defaultCachePath; if (version) { @@ -229,7 +238,7 @@ export async function download(options?: Partial): Promise