Skip to content

Commit

Permalink
feat(cdk): schematics add proprietary-icons migration (#4811)
Browse files Browse the repository at this point in the history
  • Loading branch information
vladimirpotekhin authored Jul 3, 2023
1 parent 923975a commit 0b7d2de
Show file tree
Hide file tree
Showing 11 changed files with 2,546 additions and 6 deletions.
7 changes: 6 additions & 1 deletion projects/cdk/schematics/migration.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,15 @@
"factory": "./ng-update/v3-5/index#updateToV3_5"
},
"updateToV3_30": {
"description": "Proprietary icons migration",
"description": "Proprietary marker icons migration",
"version": "3.30.0",
"factory": "./ng-update/v3-30/index#updateToV3_30"
},
"updateToV3_35": {
"description": "Proprietary all icons migration",
"version": "3.35.0",
"factory": "./ng-update/v3-35/index#updateToV3_35"
},
"updateToV4": {
"description": "Updates Taiga UI packages to v4",
"version": "4.0.0",
Expand Down
2 changes: 1 addition & 1 deletion projects/cdk/schematics/ng-update/v3-30/constants/icons.ts
Original file line number Diff line number Diff line change
Expand Up @@ -987,4 +987,4 @@ export const ICONS: Array<{from: string; to: string}> = [
from: `tuiIconWorldMarker`,
to: `tuiIconTdsGlobeMedium`,
},
];
].sort((prev, next) => next.from.length - prev.from.length);
4 changes: 2 additions & 2 deletions projects/cdk/schematics/ng-update/v3-30/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@ import {
SMALL_TAB_SYMBOL,
titleLog,
} from '../../utils/colored-log';
import {replaceImports} from '../steps/icons/replace-imports';
import {replaceText} from '../steps/icons/replace-text';
import {getFileSystem} from '../utils/get-file-system';
import {ICONS_TS} from './constants/constants';
import {ICONS} from './constants/icons';
import {replaceImports} from './steps/replace-imports';
import {replaceText} from './steps/replace-text';

// eslint-disable-next-line @typescript-eslint/naming-convention
export function updateToV3_30(options: TuiSchema): Rule {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ export class TestComponent {
icon2 = tuiIconCrowdMarker;
}`;

const COMPONENT_AFTER = `import { tuiIconTdsUsersMedium, tuiIconTdsEyeOffMedium } from "@taiga-ui/proprietary-tds-icons";
const COMPONENT_AFTER = `import { tuiIconTdsEyeOffMedium, tuiIconTdsUsersMedium } from "@taiga-ui/proprietary-tds-icons";
@Component({templateUrl: './test.template.html'})
export class TestComponent {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import {ReplacementConst} from '../../interfaces/replacement-const';
import {ICONS} from './icons';

export const ICONS_TS: ReplacementConst[] = ICONS.map(({from, to}) => ({
from: {name: from, moduleSpecifier: `@taiga-ui/proprietary-icons`},
to: {name: to, moduleSpecifier: `@taiga-ui/proprietary-tds-icons`},
}));
Loading

0 comments on commit 0b7d2de

Please sign in to comment.