mirror of
https://github.com/lucide-icons/lucide.git
synced 2025-12-16 17:57:43 +01:00
24 lines
770 B
JavaScript
24 lines
770 B
JavaScript
import path from 'path';
|
|
import categories from '../categories.json' assert { 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'));
|
|
});
|