MCPcopy Index your code
hub / github.com/VSpaceCode/VSpaceCode / downloadWhichKey

Function downloadWhichKey

src/test/runTest-web.ts:73–104  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

71
72// Get the latest release of vscode-which-key
73async function downloadWhichKey() {
74 console.log("Querying the latest release of whichkey...");
75 const data = (await httpsGetJson(
76 "https://api.github.com/repos/VSpaceCode/vscode-which-key/releases/latest"
77 )) as any;
78
79 const asset = data["assets"].find((a: any) => a.name.match(/^.+\.vsix$/g));
80 const name = asset["name"] as string; // e.g. whichkey-0.9.3.vsix
81 const basename = path.basename(name, ".vsix"); // e.g. whichkey-0.9.3
82 const url = asset["browser_download_url"] as string;
83
84 const vscodeTestDepDir = path.resolve(
85 process.cwd(),
86 ".vscode-test-dependency"
87 );
88 const directory = path.join(vscodeTestDepDir, basename); //`${cwd}/.vscode-test-web/${basename}`;
89 if (!existsSync(directory)) {
90 // Ensures the base vscode test dir exists
91 await promisify(mkdir)(vscodeTestDepDir, { recursive: true });
92 console.log(`Downloading ${name}`);
93 const zip = await httpsGetZip(url);
94 console.log(`Extracting ${name} to ${directory}`);
95 // Use the sync extract because async version is broken
96 // https://github.com/cthackers/adm-zip/issues/389
97 zip.extractAllTo(directory);
98 // await promisify(zip.extractAllToAsync as any)(directory, false, false);
99 } else {
100 console.log(`Found ${directory}. Skipping whichkey download.`);
101 }
102
103 return path.join(directory, "extension"); // e.g. ${cwd}/.vscode-test-web/whichkey-0.9.3/extension
104}
105
106function getExtensionPaths() {
107 return Promise.all([downloadWhichKey()]);

Callers 1

getExtensionPathsFunction · 0.85

Calls 2

httpsGetJsonFunction · 0.85
httpsGetZipFunction · 0.85

Tested by

no test coverage detected