mirror of
https://github.com/microsoft/vscode.git
synced 2025-12-23 19:59:37 +00:00
chore: reduce any usage in build/ (#270109)
This commit is contained in:
@@ -48,8 +48,7 @@ async function fetchUrl(url, options, retries = 10, retryDelay = 1000) {
|
|||||||
try {
|
try {
|
||||||
const response = await fetch(url, {
|
const response = await fetch(url, {
|
||||||
...options.nodeFetchOptions,
|
...options.nodeFetchOptions,
|
||||||
// eslint-disable-next-line local/code-no-any-casts
|
signal: controller.signal
|
||||||
signal: controller.signal /* Typings issue with lib.dom.d.ts */
|
|
||||||
});
|
});
|
||||||
if (verbose) {
|
if (verbose) {
|
||||||
(0, fancy_log_1.default)(`Fetch completed: Status ${response.status}. Took ${ansi_colors_1.default.magenta(`${new Date().getTime() - startTime} ms`)}`);
|
(0, fancy_log_1.default)(`Fetch completed: Status ${response.status}. Took ${ansi_colors_1.default.magenta(`${new Date().getTime() - startTime} ms`)}`);
|
||||||
|
|||||||
@@ -54,8 +54,7 @@ export async function fetchUrl(url: string, options: IFetchOptions, retries = 10
|
|||||||
try {
|
try {
|
||||||
const response = await fetch(url, {
|
const response = await fetch(url, {
|
||||||
...options.nodeFetchOptions,
|
...options.nodeFetchOptions,
|
||||||
// eslint-disable-next-line local/code-no-any-casts
|
signal: controller.signal
|
||||||
signal: controller.signal as any /* Typings issue with lib.dom.d.ts */
|
|
||||||
});
|
});
|
||||||
if (verbose) {
|
if (verbose) {
|
||||||
log(`Fetch completed: Status ${response.status}. Took ${ansiColors.magenta(`${new Date().getTime() - startTime} ms`)}`);
|
log(`Fetch completed: Status ${response.status}. Took ${ansiColors.magenta(`${new Date().getTime() - startTime} ms`)}`);
|
||||||
|
|||||||
@@ -73,8 +73,7 @@ async function fetchUrl(options, retries = 10, retryDelay = 1000) {
|
|||||||
try {
|
try {
|
||||||
const response = await fetch(`https://api.github.com/repos/Microsoft/vscode-linux-build-agent/releases/tags/v${version}`, {
|
const response = await fetch(`https://api.github.com/repos/Microsoft/vscode-linux-build-agent/releases/tags/v${version}`, {
|
||||||
headers: ghApiHeaders,
|
headers: ghApiHeaders,
|
||||||
// eslint-disable-next-line local/code-no-any-casts
|
signal: controller.signal
|
||||||
signal: controller.signal /* Typings issue with lib.dom.d.ts */
|
|
||||||
});
|
});
|
||||||
if (response.ok && (response.status >= 200 && response.status < 300)) {
|
if (response.ok && (response.status >= 200 && response.status < 300)) {
|
||||||
console.log(`Fetch completed: Status ${response.status}.`);
|
console.log(`Fetch completed: Status ${response.status}.`);
|
||||||
|
|||||||
@@ -82,8 +82,7 @@ async function fetchUrl(options: IFetchOptions, retries = 10, retryDelay = 1000)
|
|||||||
try {
|
try {
|
||||||
const response = await fetch(`https://api.github.com/repos/Microsoft/vscode-linux-build-agent/releases/tags/v${version}`, {
|
const response = await fetch(`https://api.github.com/repos/Microsoft/vscode-linux-build-agent/releases/tags/v${version}`, {
|
||||||
headers: ghApiHeaders,
|
headers: ghApiHeaders,
|
||||||
// eslint-disable-next-line local/code-no-any-casts
|
signal: controller.signal
|
||||||
signal: controller.signal as any /* Typings issue with lib.dom.d.ts */
|
|
||||||
});
|
});
|
||||||
if (response.ok && (response.status >= 200 && response.status < 300)) {
|
if (response.ok && (response.status >= 200 && response.status < 300)) {
|
||||||
console.log(`Fetch completed: Status ${response.status}.`);
|
console.log(`Fetch completed: Status ${response.status}.`);
|
||||||
|
|||||||
@@ -13,6 +13,7 @@ const debug_1 = __importDefault(require("debug"));
|
|||||||
const path_1 = __importDefault(require("path"));
|
const path_1 = __importDefault(require("path"));
|
||||||
const get_1 = require("@electron/get");
|
const get_1 = require("@electron/get");
|
||||||
const product_json_1 = __importDefault(require("../../product.json"));
|
const product_json_1 = __importDefault(require("../../product.json"));
|
||||||
|
const product = product_json_1.default;
|
||||||
const d = (0, debug_1.default)('explorer-dll-fetcher');
|
const d = (0, debug_1.default)('explorer-dll-fetcher');
|
||||||
async function downloadExplorerDll(outDir, quality = 'stable', targetArch = 'x64') {
|
async function downloadExplorerDll(outDir, quality = 'stable', targetArch = 'x64') {
|
||||||
const fileNamePrefix = quality === 'insider' ? 'code_insider' : 'code';
|
const fileNamePrefix = quality === 'insider' ? 'code_insider' : 'code';
|
||||||
@@ -53,8 +54,7 @@ async function main(outputDir) {
|
|||||||
if (!outputDir) {
|
if (!outputDir) {
|
||||||
throw new Error('Required build env not set');
|
throw new Error('Required build env not set');
|
||||||
}
|
}
|
||||||
// eslint-disable-next-line local/code-no-any-casts
|
await downloadExplorerDll(outputDir, product.quality, arch);
|
||||||
await downloadExplorerDll(outputDir, product_json_1.default.quality, arch);
|
|
||||||
}
|
}
|
||||||
if (require.main === module) {
|
if (require.main === module) {
|
||||||
main(process.argv[2]).catch(err => {
|
main(process.argv[2]).catch(err => {
|
||||||
|
|||||||
@@ -9,7 +9,14 @@ import fs from 'fs';
|
|||||||
import debug from 'debug';
|
import debug from 'debug';
|
||||||
import path from 'path';
|
import path from 'path';
|
||||||
import { downloadArtifact } from '@electron/get';
|
import { downloadArtifact } from '@electron/get';
|
||||||
import product from '../../product.json';
|
import productJson from '../../product.json';
|
||||||
|
|
||||||
|
interface ProductConfiguration {
|
||||||
|
quality?: string;
|
||||||
|
[key: string]: unknown;
|
||||||
|
}
|
||||||
|
|
||||||
|
const product: ProductConfiguration = productJson;
|
||||||
|
|
||||||
const d = debug('explorer-dll-fetcher');
|
const d = debug('explorer-dll-fetcher');
|
||||||
|
|
||||||
@@ -60,8 +67,7 @@ async function main(outputDir?: string): Promise<void> {
|
|||||||
throw new Error('Required build env not set');
|
throw new Error('Required build env not set');
|
||||||
}
|
}
|
||||||
|
|
||||||
// eslint-disable-next-line local/code-no-any-casts
|
await downloadExplorerDll(outputDir, product.quality, arch);
|
||||||
await downloadExplorerDll(outputDir, (product as any).quality, arch);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (require.main === module) {
|
if (require.main === module) {
|
||||||
|
|||||||
Reference in New Issue
Block a user