From f3fa74f3cf0c7151bfdd85b28380c4441e5643f2 Mon Sep 17 00:00:00 2001 From: Sungyu Kang Date: Sat, 14 Sep 2024 19:17:52 +0900 Subject: [PATCH] fix: allSettled --- src/utils/console.ts | 3 +++ src/utils/generateIcon.ts | 11 ++++++++--- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/src/utils/console.ts b/src/utils/console.ts index b4528ee..50e25f5 100644 --- a/src/utils/console.ts +++ b/src/utils/console.ts @@ -10,4 +10,7 @@ export const log = { link: (message: string, link: string) => { console.log(`\x1b]8;;${link}\x1b\\${message}\x1b]8;;\x1b\\`); }, + error: (message: string) => { + console.log(pc.red(message)); + }, }; diff --git a/src/utils/generateIcon.ts b/src/utils/generateIcon.ts index 5d4fccf..ef329f3 100644 --- a/src/utils/generateIcon.ts +++ b/src/utils/generateIcon.ts @@ -117,10 +117,15 @@ const saveIcons = async ( export const syncIcons = async (config: Config) => { const groupedIcons = groupIconsByPrefix(config.icons); - await Promise.all( + + await Promise.allSettled( groupedIcons.map(async ([prefix, icons]) => { - const data = await generateIconCode(prefix, icons, config.typescript); - await saveIcons(config.outputPath, data.filename, data.code); + try { + const data = await generateIconCode(prefix, icons, config.typescript); + await saveIcons(config.outputPath, data.filename, data.code); + } catch (error) { + log.error(`Not found ${prefix}`); + } }) ); };