Files
vscode/build/win32/explorer-appx-fetcher.js
Robo ebea50afee feat: bundle sparse package to integrate with windows context menu (#151186)
* chore: bundle and sign explorer appx

* chore: bump vscode-explorer-command@3.0.1

* chore: explorer install/uninstall stage for appx

* chore: fix format for cmd exec

* chore: cmd file path needs triple quotes

* chore: update vscode-explorer-command@3.0.2

* chore: add reg key for new context menu title

* chore: update vscode-explorer-command@3.0.3

* fix: guard behind insider quality

* chore: fix merge conflict

* fix: type mismatch

* chore: restrict context menu related actions for win11

* refactor appx loading/unloading, revert inno updater

* update powershell

* chore: undo inno_updater changes

* fix: appx install script

* fix: perform install after update step

* fix: mv appx install to files section

* chore: additional fixes

- Remove old context menu entries when updating to newer version
- Remove context menu entry when reinstalling without menu action selected.

* chore: update vscode-explorer-command@3.0.4

- Fixes garbled title for system installation

Co-authored-by: Joao Moreno <joao.moreno@microsoft.com>
2022-10-21 20:17:30 +02:00

57 lines
2.1 KiB
JavaScript

/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
'use strict';
Object.defineProperty(exports, "__esModule", { value: true });
exports.downloadExplorerAppx = void 0;
const debug = require("debug");
const extract = require("extract-zip");
const fs = require("fs-extra");
const path = require("path");
const product = require("../../product.json");
const get_1 = require("@electron/get");
const d = debug('explorer-appx-fetcher');
async function downloadExplorerAppx(outDir, quality = 'stable', targetArch = 'x64') {
const fileNamePrefix = quality === 'insider' ? 'code_insiders' : 'code';
const fileName = `${fileNamePrefix}_explorer_${targetArch}.zip`;
if (await fs.pathExists(path.resolve(outDir, 'resources.pri'))) {
return;
}
if (!await fs.pathExists(outDir)) {
await fs.mkdirp(outDir);
}
d(`downloading ${fileName}`);
const artifact = await (0, get_1.downloadArtifact)({
isGeneric: true,
version: '3.0.4',
artifactName: fileName,
unsafelyDisableChecksums: true,
mirrorOptions: {
mirror: 'https://github.com/microsoft/vscode-explorer-command/releases/download/',
customDir: '3.0.4',
customFilename: fileName
}
});
d(`unpacking from ${fileName}`);
await extract(artifact, { dir: outDir });
}
exports.downloadExplorerAppx = downloadExplorerAppx;
async function main() {
const outputDir = process.env['VSCODE_EXPLORER_APPX_DIR'];
let arch = process.env['VSCODE_ARCH'];
if (!outputDir) {
throw new Error('Required build env not set');
}
if (arch === 'ia32') {
arch = 'x86';
}
await downloadExplorerAppx(outputDir, product.quality, arch);
}
if (require.main === module) {
main().catch(err => {
console.error(err);
process.exit(1);
});
}