diff --git a/desktop/scripts/build-icons.tsx b/desktop/scripts/build-icons.tsx index d6675cd5c..da92074a3 100644 --- a/desktop/scripts/build-icons.tsx +++ b/desktop/scripts/build-icons.tsx @@ -48,45 +48,32 @@ export async function downloadIcons(buildFolder: string) { [], ); - return Promise.all( - iconURLs.map((icon) => { + await Promise.all( + iconURLs.map(async (icon) => { const url = getPublicIconUrl(icon); - return fetch(url, { - retryOptions: { - retryMaxDuration: 120 * 1000, - // Be default, only 5xx are retried but we're getting the odd 404 - // which goes away on a retry for some reason. - retryOnHttpResponse: (res) => res.status >= 400, - retryOnHttpError: () => true, - }, - }) - .then((res) => { - if (res.status !== 200) { - throw new Error( - // eslint-disable-next-line prettier/prettier - `Could not download the icon ${icon} from ${url}: got status ${res.status}`, - ); - } - return res; - }) - .then( - (res) => - new Promise((resolve, reject) => { - const fileStream = fs.createWriteStream( - path.join(buildFolder, buildLocalIconPath(icon)), - ); - res.body.pipe(fileStream); - res.body.on('error', reject); - fileStream.on('finish', resolve); - }), + const res = await fetch(url); + if (res.status !== 200) { + console.warn( + // eslint-disable-next-line prettier/prettier + `Could not download the icon ${icon} from ${url}: got status ${res.status}`, ); + return; + } + return new Promise((resolve, reject) => { + const fileStream = fs.createWriteStream( + path.join(buildFolder, buildLocalIconPath(icon)), + ); + res.body.pipe(fileStream); + res.body.on('error', reject); + fileStream.on('finish', resolve); + }); }), ); } // should match flipper-ui-core/src/utils/icons.tsx export function getPublicIconUrl({name, variant, size, density}: Icon) { - return `https://facebook.com/assets/?name=${name}&variant=${variant}&size=${size}&set=facebook_icons&density=${density}x`; + return `https://facebook.com/images/assets_DO_NOT_HARDCODE/facebook_icons/${name}_${variant}_${size}_primary-icon.png`; } // should match app/src/utils/icons.tsx