mirror of
https://github.com/lucide-icons/lucide.git
synced 2026-12-03 16:59:42 +00:00
chore(scripts): Refactor scripts to typescript (#3316)
* Adjust typescript types * adjust types * fix types in all helper files * Fix types * Migrate js files to ts files * Refactor to TS files * Rename extentions * Adjust imports * Fix builds * Update lockfile * Fix last typescript migration * Fix entry path @lucide/outline-svg * Fix types * add checkout step * format files * Format files
This commit is contained in:
@@ -0,0 +1,30 @@
|
||||
import path from 'path';
|
||||
import {
|
||||
getCurrentDirPath,
|
||||
readAllMetadata,
|
||||
readSvgDirectory,
|
||||
writeFile,
|
||||
} from '../tools/build-helpers/helpers.ts';
|
||||
|
||||
const currentDir = getCurrentDirPath(import.meta.url);
|
||||
const ICONS_DIR = path.resolve(currentDir, '../icons');
|
||||
const icons = await readAllMetadata(ICONS_DIR);
|
||||
|
||||
const svgFiles = await 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, '..'));
|
||||
}
|
||||
});
|
||||
Reference in New Issue
Block a user