2023-02-16 08:26:29 +01:00
|
|
|
import path from 'path';
|
2024-07-07 21:32:32 +02:00
|
|
|
import {
|
|
|
|
|
getCurrentDirPath,
|
|
|
|
|
readAllMetadata,
|
|
|
|
|
readSvgDirectory,
|
|
|
|
|
writeFile,
|
2025-06-18 15:47:24 +02:00
|
|
|
} from '../tools/build-helpers/helpers.ts';
|
2023-02-16 08:26:29 +01:00
|
|
|
|
|
|
|
|
const currentDir = getCurrentDirPath(import.meta.url);
|
|
|
|
|
const ICONS_DIR = path.resolve(currentDir, '../icons');
|
2025-06-18 15:47:24 +02:00
|
|
|
const icons = await readAllMetadata(ICONS_DIR);
|
2023-02-16 08:26:29 +01:00
|
|
|
|
2025-06-18 15:47:24 +02:00
|
|
|
const svgFiles = await readSvgDirectory(ICONS_DIR);
|
2023-02-16 08:26:29 +01:00
|
|
|
|
|
|
|
|
const iconNames = svgFiles.map((icon) => icon.split('.')[0]);
|
|
|
|
|
|
2024-02-01 22:38:21 +09:00
|
|
|
iconNames.forEach((iconName) => {
|
2023-02-16 08:26:29 +01:00
|
|
|
if (typeof icons[iconName] === 'undefined') {
|
2024-02-01 22:38:21 +09:00
|
|
|
const iconContent = JSON.stringify(
|
|
|
|
|
{
|
|
|
|
|
$schema: '../icon.schema.json',
|
|
|
|
|
tags: [],
|
|
|
|
|
categories: [],
|
|
|
|
|
},
|
|
|
|
|
null,
|
|
|
|
|
2,
|
|
|
|
|
);
|
2023-02-16 08:26:29 +01:00
|
|
|
writeFile(iconContent, `${iconName}.json`, path.resolve(currentDir, '..'));
|
|
|
|
|
}
|
|
|
|
|
});
|