mirror of
https://github.com/lucide-icons/lucide.git
synced 2026-08-29 11:28:24 +02:00
fix(scripts): removed toBeRemovedInVersion from all scripts and tools (#4674)
* fix(scripts): remove toBeRemovedInVersion from all scripts and tools * fix(scripts): fixed linting
This commit is contained in:
@@ -39,8 +39,7 @@
|
||||
{
|
||||
"name": "podcast",
|
||||
"deprecated": true,
|
||||
"deprecationReason": "alias.name",
|
||||
"toBeRemovedInVersion": "v1.0"
|
||||
"deprecationReason": "alias.name"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
@@ -52,7 +52,6 @@ export async function renameIcon(ICONS_DIR: string, oldName: string, newName: st
|
||||
name: oldName,
|
||||
deprecated: true,
|
||||
deprecationReason: 'alias.name',
|
||||
toBeRemovedInVersion: 'v1.0',
|
||||
},
|
||||
];
|
||||
fs.writeFileSync(newJsonPath, JSON.stringify(jsonData, null, 2));
|
||||
|
||||
@@ -110,7 +110,6 @@ export default async function generateAliasesFiles({
|
||||
? deprecationReasonTemplate(alias.deprecationReason, {
|
||||
componentName: toPascalCase(iconName),
|
||||
iconName,
|
||||
toBeRemovedInVersion: alias.toBeRemovedInVersion,
|
||||
})
|
||||
: '';
|
||||
|
||||
|
||||
@@ -48,16 +48,11 @@ function generateIconFiles({
|
||||
]);
|
||||
|
||||
const getSvg = () => readSvg(`${iconName}.svg`, iconsDir);
|
||||
const {
|
||||
deprecated = false,
|
||||
toBeRemovedInVersion = undefined,
|
||||
aliases = [],
|
||||
} = iconMetaData[iconName];
|
||||
const { deprecated = false, aliases = [] } = iconMetaData[iconName];
|
||||
const deprecationReason = deprecated
|
||||
? deprecationReasonTemplate(iconMetaData[iconName].deprecationReason ?? '', {
|
||||
componentName,
|
||||
iconName,
|
||||
toBeRemovedInVersion,
|
||||
})
|
||||
: '';
|
||||
|
||||
|
||||
@@ -32,13 +32,11 @@ export type AliasDeprecation = {
|
||||
name: string;
|
||||
deprecated: true;
|
||||
deprecationReason: AliasDeprecationReason;
|
||||
toBeRemovedInVersion?: string;
|
||||
};
|
||||
|
||||
export type IconDeprecationReason = 'icon.renamed' | '';
|
||||
|
||||
export type IconMetadataBase = {
|
||||
toBeRemovedInVersion?: string;
|
||||
categories: string[];
|
||||
aliases?: AliasDeprecation[];
|
||||
tags: string[];
|
||||
|
||||
@@ -4,25 +4,20 @@ export default function deprecationReasonTemplate(
|
||||
deprecationReason: AliasDeprecationReason | IconDeprecationReason,
|
||||
{
|
||||
componentName,
|
||||
toBeRemovedInVersion,
|
||||
}: {
|
||||
componentName: string;
|
||||
iconName: string;
|
||||
toBeRemovedInVersion?: string;
|
||||
},
|
||||
) {
|
||||
const resourceName = deprecationReason.startsWith('icon') ? 'icon' : 'alias';
|
||||
const removalNotice = toBeRemovedInVersion
|
||||
? ` This ${resourceName} will be removed in ${toBeRemovedInVersion}`
|
||||
: '';
|
||||
|
||||
switch (deprecationReason) {
|
||||
case 'alias.typo':
|
||||
return `Renamed because of typo, use {@link ${componentName}} instead.${removalNotice}`;
|
||||
return `Renamed because of typo, use {@link ${componentName}} instead.`;
|
||||
case 'alias.duplicate':
|
||||
return `The icon was combined with another icon that shares the same use case, use {@link ${componentName}} instead.${removalNotice}`;
|
||||
return `The icon was combined with another icon that shares the same use case, use {@link ${componentName}} instead.`;
|
||||
case 'alias.name':
|
||||
return `The name of this icon was changed because it didn't meet our guidelines anymore, use {@link ${componentName}} instead.${removalNotice}`;
|
||||
return `The name of this icon was changed because it didn't meet our guidelines anymore, use {@link ${componentName}} instead.`;
|
||||
default:
|
||||
throw new Error(`Unknown deprecation reason: ${deprecationReason}`);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user