mirror of
https://github.com/lucide-icons/lucide.git
synced 2025-12-16 22:27:43 +01:00
* Deprecates tags.json and icons.json * Removed tags.json dependency from Figma plugin * Add JSON descriptor information to readme * Restore packages/index.tsx * Update packages/lucide-figma/src/api/fetchIcons.ts Add multiple fetches to `Promise.all` * Added caching to API endpoints * Updates pnpm-lock.yaml * Add tags to static * Trigger site build * Added prebuild script to generate api caches at build time * Migrated NextCache function from arrow to regular to simplify markup * test if contents are read from cache * Add cache clear to prebuild * removes debug object --------- Co-authored-by: Karsa <karsa@karsa.org> Co-authored-by: Eric Fennis <eric.fennis@gmail.com>
22 lines
692 B
JavaScript
22 lines
692 B
JavaScript
import path from 'path';
|
|
import {getCurrentDirPath, readAllMetadata, readSvgDirectory, writeFile} from './helpers.mjs';
|
|
|
|
const currentDir = getCurrentDirPath(import.meta.url);
|
|
const ICONS_DIR = path.resolve(currentDir, '../icons');
|
|
const icons = readAllMetadata(ICONS_DIR);
|
|
|
|
const svgFiles = readSvgDirectory(ICONS_DIR);
|
|
|
|
const iconNames = svgFiles.map((icon) => icon.split('.')[0]);
|
|
|
|
iconNames.forEach(iconName => {
|
|
if (typeof icons[iconName] === 'undefined') {
|
|
const iconContent = JSON.stringify({
|
|
"$schema": "../icon.schema.json",
|
|
"tags": [],
|
|
"categories": []
|
|
}, null, 2);
|
|
writeFile(iconContent, `${iconName}.json`, path.resolve(currentDir, '..'));
|
|
}
|
|
});
|