Files
vscode/build/win32/explorer-appx-fetcher.ts
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

67 lines
1.9 KiB
TypeScript

/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
'use strict';
import * as debug from 'debug';
import * as extract from 'extract-zip';
import * as fs from 'fs-extra';
import * as path from 'path';
import * as product from '../../product.json';
import { downloadArtifact } from '@electron/get';
const d = debug('explorer-appx-fetcher');
export async function downloadExplorerAppx(outDir: string, quality: string = 'stable', targetArch: string = 'x64'): Promise<void> {
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 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 });
}
async function main(): Promise<void> {
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 as any).quality, arch);
}
if (require.main === module) {
main().catch(err => {
console.error(err);
process.exit(1);
});
}