mirror of
https://github.com/microsoft/vscode.git
synced 2025-12-24 04:09:28 +00:00
remove request dependency (#179149)
* remove request dependency * replace gulp-remote-retry-src in build scripts * fix retry delay & polish
This commit is contained in:
committed by
GitHub
parent
35d591d664
commit
899cdd5ace
@@ -14,9 +14,8 @@ const cp = require('child_process');
|
||||
const minimist = require('minimist');
|
||||
const fancyLog = require('fancy-log');
|
||||
const ansiColors = require('ansi-colors');
|
||||
const remote = require('gulp-remote-retry-src');
|
||||
const vfs = require('vinyl-fs');
|
||||
const opn = require('opn');
|
||||
const https = require('https');
|
||||
|
||||
const APP_ROOT = path.join(__dirname, '..');
|
||||
const WEB_DEV_EXTENSIONS_ROOT = path.join(APP_ROOT, '.build', 'builtInWebDevExtensions');
|
||||
@@ -112,6 +111,23 @@ async function directoryExists(path) {
|
||||
}
|
||||
}
|
||||
|
||||
/** @return {Promise<void>} */
|
||||
async function downloadPlaygroundFile(fileName, httpsLocation, destinationRoot) {
|
||||
const destination = path.join(destinationRoot, fileName);
|
||||
await fs.promises.mkdir(path.dirname(destination), { recursive: true });
|
||||
const fileStream = fs.createWriteStream(destination);
|
||||
return (new Promise((resolve, reject) => {
|
||||
const request = https.get(path.posix.join(httpsLocation, fileName), response => {
|
||||
response.pipe(fileStream);
|
||||
fileStream.on('finish', () => {
|
||||
fileStream.close();
|
||||
resolve();
|
||||
});
|
||||
});
|
||||
request.on('error', reject);
|
||||
}));
|
||||
}
|
||||
|
||||
async function ensureWebDevExtensions(verbose) {
|
||||
|
||||
// Playground (https://github.com/microsoft/vscode-web-playground)
|
||||
@@ -136,11 +152,11 @@ async function ensureWebDevExtensions(verbose) {
|
||||
if (verbose) {
|
||||
fancyLog(`${ansiColors.magenta('Web Development extensions')}: Downloading vscode-web-playground to ${webDevPlaygroundRoot}`);
|
||||
}
|
||||
await new Promise((resolve, reject) => {
|
||||
remote(['package.json', 'dist/extension.js', 'dist/extension.js.map'], {
|
||||
base: 'https://raw.githubusercontent.com/microsoft/vscode-web-playground/main/'
|
||||
}).pipe(vfs.dest(webDevPlaygroundRoot)).on('end', resolve).on('error', reject);
|
||||
});
|
||||
const playgroundRepo = `https://raw.githubusercontent.com/microsoft/vscode-web-playground/main/`;
|
||||
await Promise.all(['package.json', 'dist/extension.js', 'dist/extension.js.map'].map(
|
||||
fileName => downloadPlaygroundFile(fileName, playgroundRepo, webDevPlaygroundRoot)
|
||||
));
|
||||
|
||||
} else {
|
||||
if (verbose) {
|
||||
fancyLog(`${ansiColors.magenta('Web Development extensions')}: Using existing vscode-web-playground in ${webDevPlaygroundRoot}`);
|
||||
|
||||
Reference in New Issue
Block a user