Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
export default async function generateData(): Promise {
log.title('data', 'Generating emoji datasets');
const data = await buildEmojiData();
const filteredData = filterData(data);
const versions = createVersionMap();
// Generate datasets for each locale
await Promise.all(
SUPPORTED_LOCALES.map(async (locale: string) => {
const annotations = await buildAnnotationData(locale);
const emojis = Object.keys(filteredData).map(hexcode =>
createEmoji(filteredData[hexcode], versions, annotations),
);
// Sort by order
emojis.sort((a, b) => (a.order || 0) - (b.order || 0));
return Promise.all([
writeDataset(`${locale}/raw.json`, emojis),
writeDataset(`${locale}/data.json`, emojis, true),
writeDataset(`${locale}/compact.json`, extractCompact(emojis), true),
]);
}),
);