mirror of
https://github.com/lucide-icons/lucide.git
synced 2025-12-16 15:07:41 +01:00
* feat(icons): add deprecationReason and alias deprecation feature * chore(tools): run prettier. again. * fix(scripts): overall alias as object support * fix(icon.schema.json): add dependentRequired on deprecated properties * fix(icon.schema.json): remove unicode for now * fix(icon.schema.json): use const true for deprecated * fix(build): convert deprecation reason to enum * fix(build): fix linting of icon.schema.json * fix(build): renamed gracePeriod => toBeRemovedInVersion * fix(build): fix aliases map in related icons generation * fix(build): deprecate aliases using numbers * feat(icon-schema): separate deprecation reason enumerations, extract removal notice * fix(icon-schema): fix linting * Update tools/build-icons/utils/deprecationReasonTemplate.mjs * fix(icons): add deprecation reason to some more icons * fix(docs): fix linting issue --------- Co-authored-by: Karsa <karsa@sztaki.hu> Co-authored-by: Jakob Guddas <github@jguddas.de>
36 lines
1.0 KiB
JavaScript
36 lines
1.0 KiB
JavaScript
import fs from 'fs';
|
|
import path from 'path';
|
|
|
|
const currentDir = process.cwd();
|
|
const dataDirectory = path.resolve(currentDir, '.vitepress/data');
|
|
const directory = path.join(process.cwd(), '../categories');
|
|
|
|
function getAllCategoryFiles() {
|
|
const fileNames = fs.readdirSync(directory).filter((file) => path.extname(file) === '.json');
|
|
|
|
return fileNames.map((fileName) => {
|
|
const name = path.basename(fileName, '.json');
|
|
const fileContent = fs.readFileSync(path.join(directory, fileName), 'utf8');
|
|
|
|
const parsedFileContent = JSON.parse(fileContent);
|
|
|
|
return {
|
|
name,
|
|
title: parsedFileContent.title,
|
|
};
|
|
});
|
|
}
|
|
|
|
const categoriesFile = path.resolve(dataDirectory, `categoriesData.json`);
|
|
|
|
const categoriesData = getAllCategoryFiles();
|
|
|
|
fs.promises
|
|
.writeFile(categoriesFile, JSON.stringify(categoriesData, null, 2), 'utf-8')
|
|
.then(() => {
|
|
console.log('Successfully written categoriesData.json file');
|
|
})
|
|
.catch((error) => {
|
|
throw new Error(`Something went wrong generating the categoriesData.json file,\n ${error}`);
|
|
});
|