/
githubmirror
/
nativefier
Обзор
Документация
Войти
/
githubmirror
/
nativefier
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
master
src/options/fields/icon.ts
38 строк
927 B
Adam Weeden
Upgrade Electron from 13 to 16 (PR #1288)
02 янв 2022, 14:17
Не верифицирован
02 янв 2022, 14:17
d483597
Код
Авторство
О чём код?
import * as log from 'loglevel'; import { inferIcon } from '../../infer/inferIcon'; type IconParams = { packager: { icon?: string; targetUrl: string; platform?: string; }; }; export async function icon(options: IconParams): Promise<string | undefined> { if (options.packager.icon) { log.debug('Got icon from options. Using it, no inferring needed'); return undefined; } if (!options.packager.platform) { log.error('No platform specified. Icon can not be inferrerd.'); return undefined; } try { return await inferIcon( options.packager.targetUrl, options.packager.platform, ); } catch (err: unknown) { // eslint-disable-next-line const errorUrl: string = (err as any)?.config?.url; log.warn( 'Cannot automatically retrieve the app icon:', errorUrl ? `${(err as Error).message} on ${errorUrl}` : err, ); return undefined; } }