mirror of
https://github.com/lucide-icons/lucide.git
synced 2026-11-14 13:58:21 +00:00
Updated categories with new icons + upgraded scripts to use pnpm and mjs scripts
This commit is contained in:
@@ -1,8 +1,9 @@
|
||||
import path from 'path';
|
||||
import icons from '../icons.json';
|
||||
import {readSvgDirectory} from './helpers';
|
||||
import icons from '../icons.json' assert { type: 'json' };
|
||||
import { readSvgDirectory, getCurrentDirPath } from './helpers.mjs';
|
||||
|
||||
const ICONS_DIR = path.resolve(__dirname, '../icons');
|
||||
const currentDir = getCurrentDirPath(import.meta.url)
|
||||
const ICONS_DIR = path.resolve(currentDir, '../icons');
|
||||
|
||||
console.log(`Read all icons`);
|
||||
|
||||
@@ -1,14 +0,0 @@
|
||||
import path from 'path';
|
||||
import icons from '../icons.json';
|
||||
import categories from '../categories.json';
|
||||
import { mergeArrays, writeFile } from './helpers';
|
||||
|
||||
Object.keys(categories).forEach(categoryName => {
|
||||
categories[categoryName].forEach(iconName => {
|
||||
mergeArrays(icons.icons[iconName].categories, [categoryName]);
|
||||
});
|
||||
});
|
||||
|
||||
const iconsContent = JSON.stringify(icons, null, 2);
|
||||
|
||||
writeFile(iconsContent, 'icons.json', path.resolve(__dirname, '..'));
|
||||
@@ -0,0 +1,16 @@
|
||||
import path from 'path';
|
||||
import icons from '../icons.json' assert { type: 'json' };
|
||||
import categories from '../categories.json' assert { type: 'json' };
|
||||
import { mergeArrays, writeFile, getCurrentDirPath } from './helpers.mjs';
|
||||
|
||||
const currentDir = getCurrentDirPath(import.meta.url)
|
||||
|
||||
Object.keys(categories).forEach(categoryName => {
|
||||
categories[categoryName].forEach(iconName => {
|
||||
mergeArrays(icons.icons[iconName].categories, [categoryName]);
|
||||
});
|
||||
});
|
||||
|
||||
const iconsContent = JSON.stringify(icons, null, 2);
|
||||
|
||||
writeFile(iconsContent, 'icons.json', path.resolve(currentDir, '..'));
|
||||
@@ -1,15 +0,0 @@
|
||||
import path from 'path';
|
||||
import icons from '../icons.json';
|
||||
import { writeFile } from './helpers';
|
||||
|
||||
const newCategories = {};
|
||||
Object.keys(icons.icons).forEach(iconName => {
|
||||
icons.icons[iconName].categories.forEach(categoryName => {
|
||||
newCategories[categoryName] = newCategories[categoryName] || [];
|
||||
newCategories[categoryName].push(iconName);
|
||||
});
|
||||
});
|
||||
|
||||
const categoriesContent = JSON.stringify(newCategories, null, 2);
|
||||
|
||||
writeFile(categoriesContent, 'categories.json', path.resolve(__dirname, '..'));
|
||||
@@ -0,0 +1,25 @@
|
||||
import path from 'path';
|
||||
import icons from '../icons.json' assert { type: 'json' };
|
||||
import { writeFile, getCurrentDirPath } from './helpers.mjs';
|
||||
|
||||
const currentDir = getCurrentDirPath(import.meta.url)
|
||||
|
||||
const newCategories = {};
|
||||
Object.keys(icons.icons).forEach(iconName => {
|
||||
icons.icons[iconName].categories.forEach(categoryName => {
|
||||
newCategories[categoryName] = newCategories[categoryName] || [];
|
||||
newCategories[categoryName].push(iconName);
|
||||
});
|
||||
});
|
||||
|
||||
const ordered = Object.keys(newCategories).sort().reduce(
|
||||
(obj, key) => {
|
||||
obj[key] = newCategories[key];
|
||||
return obj;
|
||||
},
|
||||
{}
|
||||
);
|
||||
|
||||
const categoriesContent = JSON.stringify(ordered, null, 2);
|
||||
|
||||
writeFile(categoriesContent, 'categories.json', path.resolve(currentDir, '..'));
|
||||
@@ -1,9 +1,10 @@
|
||||
import path from 'path';
|
||||
import tags from '../tags.json';
|
||||
import icons from '../icons.json';
|
||||
import { readSvgDirectory, writeFile, mergeArrays } from './helpers';
|
||||
import tags from '../tags.json' assert { type: 'json' };
|
||||
import icons from '../icons.json' assert { type: 'json' };
|
||||
import { readSvgDirectory, writeFile, mergeArrays, getCurrentDirPath } from './helpers.mjs';
|
||||
|
||||
const ICONS_DIR = path.resolve(__dirname, '../icons');
|
||||
const currentDir = getCurrentDirPath(import.meta.url)
|
||||
const ICONS_DIR = path.resolve(currentDir, '../icons');
|
||||
|
||||
console.log(`Read all icons`);
|
||||
|
||||
@@ -40,4 +41,4 @@ const newTags = iconList.reduce((acc, { name, icon, tags }) => {
|
||||
|
||||
const tagsContent = JSON.stringify(newTags, null, 2);
|
||||
|
||||
writeFile(tagsContent, 'tags.json', path.resolve(__dirname, '..'));
|
||||
writeFile(tagsContent, 'tags.json', path.resolve(currentDir, '..'));
|
||||
@@ -1,9 +1,10 @@
|
||||
import path from 'path';
|
||||
import tags from '../tags.json';
|
||||
import icons from '../icons.json';
|
||||
import { readSvgDirectory, writeFile, mergeArrays } from './helpers';
|
||||
import tags from '../tags.json' assert { type: 'json' };
|
||||
import icons from '../icons.json' assert { type: 'json' };
|
||||
import { readSvgDirectory, writeFile, mergeArrays, getCurrentDirPath } from './helpers.mjs';
|
||||
|
||||
const ICONS_DIR = path.resolve(__dirname, '../icons');
|
||||
const currentDir = getCurrentDirPath(import.meta.url)
|
||||
const ICONS_DIR = path.resolve(currentDir, '../icons');
|
||||
|
||||
console.log(`Read all icons`);
|
||||
|
||||
@@ -43,4 +44,4 @@ newIcons.icons = iconList.reduce((acc, { name, icon, tags }) => {
|
||||
|
||||
const iconsContent = JSON.stringify(newIcons, null, 2);
|
||||
|
||||
writeFile(iconsContent, 'icons.json', path.resolve(__dirname, '..'));
|
||||
writeFile(iconsContent, 'icons.json', path.resolve(currentDir, '..'));
|
||||
Reference in New Issue
Block a user