Files
lucide/scripts/generate/generateIcons.mjs
Karsa e2b46eac8e feat(icons): add deprecationReason and alias deprecation feature (#1960)
* 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>
2024-05-22 13:08:34 +02:00

38 lines
810 B
JavaScript

import path from 'path';
import { getCurrentDirPath, writeFileIfNotExists } from '../helpers.mjs';
const currentDir = getCurrentDirPath(import.meta.url);
const ICONS_DIR = path.resolve(currentDir, '../../icons');
const iconNames = process.argv.slice(2);
const iconSvgTemplate = `<svg
xmlns="http://www.w3.org/2000/svg"
width="24"
height="24"
viewBox="0 0 24 24"
fill="none"
stroke="currentColor"
stroke-width="2"
stroke-linecap="round"
stroke-linejoin="round"
>
</svg>
`;
const iconJsonTemplate = `{
"$schema": "../icon.schema.json",
"contributors": [
],
"tags": [
],
"categories": [
]
}
`;
iconNames.forEach((iconName) => {
writeFileIfNotExists(iconSvgTemplate, `${iconName}.svg`, ICONS_DIR);
writeFileIfNotExists(iconJsonTemplate, `${iconName}.json`, ICONS_DIR);
});