const storeIconsInLocal = (icon, website) => {
const domain = urlToDomain(website);
const cacheRoot = `${CWD}/icons`;
const websiteCachePath = `${cacheRoot}/${domain}.json`;
const alreadyCached = fs.existsSync(websiteCachePath);
const iconsFromCached = alreadyCached
? require(websiteCachePath).icons
: [];
const iconData = {
website: domain,
defaultIcon: icon,
icons: getUniqueTruthyArray([
...iconsFromCached,
...icon,
]),
};
fs.writeFileSync(websiteCachePath, JSON.stringify(iconData));