mirror of
https://github.com/lucide-icons/lucide.git
synced 2025-12-16 07:37:42 +01:00
* Revert sync to async functions * Replace more sync fs functions * Format files * Fix build svelte package
17 lines
522 B
JavaScript
17 lines
522 B
JavaScript
import path from 'path';
|
|
import { readSvgDirectory } from '@lucide/helpers';
|
|
|
|
async function getAliases(iconDirectory) {
|
|
const iconJsons = await readSvgDirectory(iconDirectory, '.json');
|
|
const aliasesEntries = await Promise.all(
|
|
iconJsons.map(async (jsonFile) => {
|
|
const file = await import(path.join(iconDirectory, jsonFile), { with: { type: 'json' } });
|
|
return [path.basename(jsonFile, '.json'), file.default];
|
|
}),
|
|
);
|
|
|
|
return Object.fromEntries(aliasesEntries);
|
|
}
|
|
|
|
export default getAliases;
|