mirror of
https://github.com/lucide-icons/lucide.git
synced 2026-11-12 13:38:32 +00:00
fix(scripts): fixes writeIconRelatedIcons.mjs (#2190)
* fix(scripts): fixes writeIconRelatedIcons.mjs * fix(scripts): fixes linting --------- Co-authored-by: Karsa <karsa@sztaki.hu>
This commit is contained in:
@@ -41,8 +41,8 @@ const nameParts = (icon) =>
|
||||
const getRelatedIcons = (currentIcon, icons) => {
|
||||
const iconSimilarity = (item) =>
|
||||
nameWeight * arrayMatches(nameParts(item), nameParts(currentIcon)) +
|
||||
categoryWeight * arrayMatches(item.categories, currentIcon.categories) +
|
||||
tagWeight * arrayMatches(item.tags, currentIcon.tags);
|
||||
categoryWeight * arrayMatches(item.categories ?? [], currentIcon.categories ?? []) +
|
||||
tagWeight * arrayMatches(item.tags ?? [], currentIcon.tags ?? []);
|
||||
return icons
|
||||
.filter((i) => i.name !== currentIcon.name)
|
||||
.map((icon) => ({ icon, similarity: iconSimilarity(icon) }))
|
||||
@@ -54,9 +54,7 @@ const getRelatedIcons = (currentIcon, icons) => {
|
||||
|
||||
const iconsMetaDataPromises = svgFiles.map(async (iconName) => {
|
||||
// eslint-disable-next-line import/no-dynamic-require, global-require
|
||||
const metaData = await import(`../icons/${iconName}`, {
|
||||
assert: { type: 'json' },
|
||||
});
|
||||
const metaData = JSON.parse(fs.readFileSync(`../icons/${iconName}`));
|
||||
|
||||
const name = iconName.replace('.json', '');
|
||||
|
||||
|
||||
Reference in New Issue
Block a user