Files
lucide/tools/build-icons/utils/deprecationReasonTemplate.ts
KarsaandEric Fennis 8fe835c105 feat(packages): added new @lucide/icons package (#3881)
* feat(packages): added lucide icons package skeleton

* feat(packages): added initial commit of @lucide/icons

* fix: fixed linting issues introduced in c4e5730bc4 (#3858)

* fix(packages/icons): update package, remove UMD export

* fix(packages/icons): update github actions

* docs(packages/icons): add documentation for various helpers and types

* fix(.github/ISSUE_TEMPLATE): fix linting issue (@ is a reserved character)

* fix(packages/icons): fix linting issues in configs

* feat(packages/icons): rename from packages/lucide-icons => packages/icons

* fix(pnpm): update lockfile

* fix(packages/icons): update readme and documentation

* fix(packages/icons): update absoluteStrokeWidth implementation

* test(packages/icons): update absoluteStrokeWidth unit test

* feat(packages/icons): add backwards compatible alias support in buildLucideIconNode

* feat(packages/icons): fix linting issues in build tools

* fix(packages/icons): rename LucideIcon => LucideIconData

---------

Co-authored-by: Eric Fennis <eric.fennis@gmail.com>
2026-03-13 10:18:53 +01:00

30 lines
1.1 KiB
TypeScript

import type { AliasDeprecationReason, IconDeprecationReason } from '../types.ts';
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}`;
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}`;
default:
throw new Error(`Unknown deprecation reason: ${deprecationReason}`);
}
}