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:
Karsa
2026-08-06 14:28:58 +02:00
committed by GitHub
parent f3a26ccff1
commit 0f7ac1f988
6 changed files with 5 additions and 20 deletions

View File

@@ -39,8 +39,7 @@
{
"name": "podcast",
"deprecated": true,
"deprecationReason": "alias.name",
"toBeRemovedInVersion": "v1.0"
"deprecationReason": "alias.name"
}
]
}

View File

@@ -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));

View File

@@ -110,7 +110,6 @@ export default async function generateAliasesFiles({
? deprecationReasonTemplate(alias.deprecationReason, {
componentName: toPascalCase(iconName),
iconName,
toBeRemovedInVersion: alias.toBeRemovedInVersion,
})
: '';

View File

@@ -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,
})
: '';

View File

@@ -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[];

View File

@@ -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}`);
}