mirror of
https://github.com/lucide-icons/lucide.git
synced 2025-12-16 07:27:42 +01:00
* Revert sync to async functions * Replace more sync fs functions * Format files * Fix build svelte package
24 lines
768 B
JavaScript
24 lines
768 B
JavaScript
import path from 'path';
|
|
import categories from '../categories.json' with { type: 'json' };
|
|
import {
|
|
mergeArrays,
|
|
writeFile,
|
|
readAllMetadata,
|
|
getCurrentDirPath,
|
|
} from '../tools/build-helpers/helpers.mjs';
|
|
|
|
const currentDir = getCurrentDirPath(import.meta.url);
|
|
const ICONS_DIR = path.resolve(currentDir, '../icons');
|
|
const icons = readAllMetadata(ICONS_DIR);
|
|
|
|
Object.keys(categories).forEach((categoryName) => {
|
|
categories[categoryName].forEach((iconName) => {
|
|
icons[iconName].categories = mergeArrays(icons[iconName].categories, [categoryName]);
|
|
});
|
|
});
|
|
|
|
Object.keys(icons).forEach((iconName) => {
|
|
const iconContent = JSON.stringify(icons[iconName], null, 2);
|
|
writeFile(iconContent, `${iconName}.json`, path.resolve(currentDir, '../icons'));
|
|
});
|