@vscode/test-electron
Advanced tools
Comparing version 2.0.2 to 2.0.3
# Changelog | ||
### 2.0.2 | 2021-12-29 | ||
### 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 | ||
- Add `resolveCliArgsFromVSCodeExecutablePath` | ||
@@ -6,0 +11,0 @@ |
@@ -8,2 +8,7 @@ /** | ||
export declare type DownloadPlatform = StringLiteralUnion<'darwin' | 'win32-archive' | 'win32-x64-archive' | 'linux-x64'>; | ||
export declare const enum DownloadArchitecture { | ||
X64 = "x64", | ||
X86 = "ia32", | ||
ARM64 = "arm64" | ||
} | ||
export interface DownloadOptions { | ||
@@ -13,2 +18,3 @@ readonly cachePath: string; | ||
readonly platform: DownloadPlatform; | ||
readonly architecture: DownloadArchitecture; | ||
} | ||
@@ -15,0 +21,0 @@ export declare const defaultCachePath: string; |
@@ -42,3 +42,3 @@ "use strict"; | ||
} | ||
const downloadUrl = util_1.getVSCodeDownloadUrl(options.version, options.platform); | ||
const downloadUrl = util_1.getVSCodeDownloadUrl(options.version, options.platform, options.architecture); | ||
const text = `Downloading VS Code ${options.version} from ${downloadUrl}`; | ||
@@ -138,6 +138,7 @@ process.stdout.write(text); | ||
async function download(options) { | ||
var _a, _b; | ||
var _a, _b, _c; | ||
let version = options === null || options === void 0 ? void 0 : options.version; | ||
const platform = (_a = options === null || options === void 0 ? void 0 : options.platform) !== null && _a !== void 0 ? _a : util_1.systemDefaultPlatform; | ||
const cachePath = (_b = options === null || options === void 0 ? void 0 : options.cachePath) !== null && _b !== void 0 ? _b : exports.defaultCachePath; | ||
const architecture = (_b = options === null || options === void 0 ? void 0 : options.architecture) !== null && _b !== void 0 ? _b : util_1.systemDefaultArchitecture; | ||
const cachePath = (_c = options === null || options === void 0 ? void 0 : options.cachePath) !== null && _c !== void 0 ? _c : exports.defaultCachePath; | ||
if (version) { | ||
@@ -190,3 +191,3 @@ if (version === 'stable') { | ||
try { | ||
const { stream, format } = await downloadVSCodeArchive({ version, platform, cachePath }); | ||
const { stream, format } = await downloadVSCodeArchive({ version, architecture, platform, cachePath }); | ||
await unzipVSCode(downloadedPath, stream, format); | ||
@@ -193,0 +194,0 @@ console.log(`Downloaded VS Code ${version} into ${downloadedPath}`); |
@@ -23,2 +23,4 @@ "use strict"; | ||
'--no-sandbox', | ||
// https://github.com/microsoft/vscode-test/issues/120 | ||
'--disable-updates', | ||
'--skip-welcome', | ||
@@ -25,0 +27,0 @@ '--skip-release-notes', |
/// <reference types="node" /> | ||
import * as https from 'https'; | ||
import { DownloadPlatform } from './download'; | ||
import { DownloadArchitecture, DownloadPlatform } from './download'; | ||
import { TestOptions } from './runTest'; | ||
export declare let systemDefaultPlatform: string; | ||
export declare function getVSCodeDownloadUrl(version: string, platform?: DownloadPlatform): string; | ||
export declare let systemDefaultPlatform: DownloadPlatform; | ||
export declare const systemDefaultArchitecture: DownloadArchitecture; | ||
export declare function getVSCodeDownloadUrl(version: string, platform?: DownloadPlatform, architecture?: DownloadArchitecture): string; | ||
export declare function urlToOptions(url: string): https.RequestOptions; | ||
@@ -8,0 +9,0 @@ export declare function downloadDirToExecutablePath(dir: string): string; |
@@ -7,3 +7,3 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.resolveCliArgsFromVSCodeExecutablePath = exports.resolveCliPathFromVSCodeExecutablePath = exports.getLatestInsidersMetadata = exports.insidersDownloadDirMetadata = exports.insidersDownloadDirToExecutablePath = exports.downloadDirToExecutablePath = exports.urlToOptions = exports.getVSCodeDownloadUrl = exports.systemDefaultPlatform = void 0; | ||
exports.resolveCliArgsFromVSCodeExecutablePath = exports.resolveCliPathFromVSCodeExecutablePath = exports.getLatestInsidersMetadata = exports.insidersDownloadDirMetadata = exports.insidersDownloadDirToExecutablePath = exports.downloadDirToExecutablePath = exports.urlToOptions = exports.getVSCodeDownloadUrl = exports.systemDefaultArchitecture = exports.systemDefaultPlatform = void 0; | ||
const path = require("path"); | ||
@@ -26,8 +26,24 @@ const url_1 = require("url"); | ||
} | ||
function getVSCodeDownloadUrl(version, platform) { | ||
const downloadPlatform = platform || exports.systemDefaultPlatform; | ||
exports.systemDefaultArchitecture = process.arch === 'arm64' | ||
? "arm64" /* ARM64 */ | ||
: process.arch === 'ia32' | ||
? "ia32" /* X86 */ | ||
: "x64" /* X64 */; | ||
function getVSCodeDownloadUrl(version, platform = exports.systemDefaultPlatform, architecture = exports.systemDefaultArchitecture) { | ||
let downloadSegment; | ||
switch (platform) { | ||
case 'darwin': | ||
downloadSegment = architecture === "arm64" /* ARM64 */ ? 'darwin-arm64' : 'darwin'; | ||
break; | ||
case 'win32-archive': | ||
downloadSegment = architecture === "arm64" /* ARM64 */ ? 'win32-arm64-archive' : 'win32-archive'; | ||
break; | ||
default: | ||
downloadSegment = platform; | ||
break; | ||
} | ||
if (version === 'insiders') { | ||
return `https://update.code.visualstudio.com/latest/${downloadPlatform}/insider`; | ||
return `https://update.code.visualstudio.com/latest/${downloadSegment}/insider`; | ||
} | ||
return `https://update.code.visualstudio.com/${version}/${downloadPlatform}/stable`; | ||
return `https://update.code.visualstudio.com/${version}/${downloadSegment}/stable`; | ||
} | ||
@@ -34,0 +50,0 @@ exports.getVSCodeDownloadUrl = getVSCodeDownloadUrl; |
{ | ||
"name": "@vscode/test-electron", | ||
"version": "2.0.2", | ||
"version": "2.0.3", | ||
"scripts": { | ||
@@ -5,0 +5,0 @@ "compile": "tsc -p ./", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
46565
756