Files
lucide/tools/build-icons/utils/deprecationReasonTemplate.ts
2025-07-30 16:52:50 +02:00

34 lines
1.4 KiB
TypeScript

import type { AliasDeprecationReason, IconDeprecationReason } from '../types.ts';
export default function deprecationReasonTemplate(
deprecationReason: AliasDeprecationReason | IconDeprecationReason,
{
componentName,
iconName,
toBeRemovedInVersion,
}: {
componentName: string;
iconName: string;
toBeRemovedInVersion?: string;
},
) {
const removalNotice = toBeRemovedInVersion
? ` This ${
deprecationReason.startsWith('icon') ? 'icon' : 'alias'
} will be removed in ${toBeRemovedInVersion}`
: '';
switch (deprecationReason) {
case 'alias.typo':
return `Renamed because of typo, use {@link ${componentName}} instead.${removalNotice}`;
case 'alias.duplicate':
return `The icon was combined with another icon that shares the same use case, use {@link ${componentName}} instead.${removalNotice}`;
case 'alias.name':
return `The name of this icon was changed because it didn't meet our guidelines anymore, use {@link ${componentName}} instead.${removalNotice}`;
case 'icon.brand':
return `Brand icons have been deprecated and are due to be removed, please refer to https://github.com/lucide-icons/lucide/issues/670. We recommend using https://simpleicons.org/?q=${iconName} instead.${removalNotice}`;
default:
throw new Error(`Unknown deprecation reason: ${deprecationReason}`);
}
}