From 003c7f94a77a46b998f3d77adde3a2f9b77d2418 Mon Sep 17 00:00:00 2001 From: changfeng Date: Sun, 11 Jun 2023 01:00:25 +0800 Subject: [PATCH] fix: increase fetch package size timeout --- src/index.ts | 4 +++- src/utils.ts | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/index.ts b/src/index.ts index e244a73..0bae1a9 100644 --- a/src/index.ts +++ b/src/index.ts @@ -11,7 +11,9 @@ import { workspaceRoot } from 'workspace-root'; import { memoizeAsync, getPkgSize as _getPkgSize } from './utils'; -export interface Options {} +export interface Options { + fetchPkgInfoTimeout?: number; +} const getWorkspaceRootFolder = memoizeAsync(async () => { let workspaceRootFolder = await workspaceRoot(); diff --git a/src/utils.ts b/src/utils.ts index 78d2423..81b7f20 100644 --- a/src/utils.ts +++ b/src/utils.ts @@ -66,7 +66,7 @@ export async function getPkgSize(name: string, version: string) { resp = await axios.get( `https://bundlephobia.com/api/size?package=${name}@${version}`, { - timeout: 6666, + timeout: 10 * 1000, }, ); } catch {