Skip to content

Commit

Permalink
chore: fix proprietary-icons migration (#8234)
Browse files Browse the repository at this point in the history
  • Loading branch information
vladimirpotekhin authored Jul 26, 2024
1 parent 6cc7cc4 commit 86a418c
Showing 1 changed file with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ export function renameProprietaryIcons(pattern = ALL_FILES): void {
sourceFiles.forEach((file) => {
let text = file.getFullText();

const regex = /\btuiIcon(?!Button\b)[A-Z][a-zA-Z0-9]*\b/g;
const regex = /['"`]tuiIcon(?!Button\b)[A-Z][a-zA-Z0-9]*\b/g;

text = text.replaceAll(regex, (match) => convertString(match));

Expand All @@ -19,7 +19,7 @@ export function renameProprietaryIcons(pattern = ALL_FILES): void {

function convertString(input: string): string {
const result = input
.replace(/^tuiIconTds/, '')
.replace(/['"`]tuiIconTds/, '')
.replace(/SmallPragmatic$/, '')
.replace(/MediumPragmatic$/, '')
.replace(/Small$/, '')
Expand All @@ -35,7 +35,7 @@ function convertString(input: string): string {
const pack = extractPackName(input);
const subfolder = extractSubfolder(input);

return `@tui.${pack}${subfolder ? `.${subfolder}` : ''}.${result.startsWith('-') ? result.slice(1) : result}`;
return `${input.slice(0, 1)}@tui.${pack}${subfolder ? `.${subfolder}` : ''}.${result.startsWith('-') ? result.slice(1) : result}`;
}

function extractPackName(input: string): string {
Expand Down

0 comments on commit 86a418c

Please sign in to comment.