From 50cfae4c6f13b89b5020e7e16b2c812baf5b58cd Mon Sep 17 00:00:00 2001 From: Ayu Date: Fri, 12 Jan 2024 13:04:43 +0000 Subject: [PATCH] fix: algolia await only works with type module --- package.json | 3 ++- scripts/algolia.ts | 6 +++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/package.json b/package.json index 70321d519cc..c0e6adc4d2b 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,8 @@ { "name": "font-files", "version": "5.0.0", - "description": "1000+ open-source fonts bundled into neat packages.", + "description": "1500+ open-source fonts bundled into neat packages.", + "type": "module", "packageManager": "pnpm@8.3.1", "private": true, "scripts": { diff --git a/scripts/algolia.ts b/scripts/algolia.ts index cf457fdd647..872f5296ed7 100644 --- a/scripts/algolia.ts +++ b/scripts/algolia.ts @@ -46,9 +46,9 @@ const updateAlgoliaIndex = async (force?: boolean) => { if (!metadata) console.warn(`No metadata found for ${id} when updating Algolia index`); - const stats = ( + const stats = (await ( await fetch(`https://api.fontsource.org/v1/stats/${id}`) - ).json() as any; + ).json()) as any; const downloadCountMonthly = stats?.total?.npmDownloadMonthly; const obj = { @@ -85,4 +85,4 @@ const updateAlgoliaIndex = async (force?: boolean) => { } }; -updateAlgoliaIndex(); +await updateAlgoliaIndex();