Skip to content

Commit

Permalink
chore(schematics): valid migration for legacy (#10133)
Browse files Browse the repository at this point in the history
  • Loading branch information
splincode authored Jan 13, 2025
1 parent 860843a commit f9bf14f
Show file tree
Hide file tree
Showing 2 changed files with 86 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -388,6 +388,14 @@ export const IDENTIFIERS_TO_REPLACE: ReplacementIdentifierMulti[] = [
from: {name: 'TuiPrimitiveTextfieldComponent', moduleSpecifier: '@taiga-ui/core'},
to: {name: 'TuiPrimitiveTextfieldComponent', moduleSpecifier: '@taiga-ui/legacy'},
},
{
from: {name: 'TUI_TEXTFIELD_SIZE', moduleSpecifier: '@taiga-ui/core'},
to: {name: 'TUI_TEXTFIELD_SIZE', moduleSpecifier: '@taiga-ui/legacy'},
},
{
from: {name: 'TuiTextfieldSizeDirective', moduleSpecifier: '@taiga-ui/core'},
to: {name: 'TuiTextfieldSizeDirective', moduleSpecifier: '@taiga-ui/legacy'},
},
{
from: {name: 'TuiOptionComponent', moduleSpecifier: '@taiga-ui/core'},
to: {name: 'TuiOption', moduleSpecifier: '@taiga-ui/core'},
Expand Down Expand Up @@ -492,6 +500,10 @@ export const IDENTIFIERS_TO_REPLACE: ReplacementIdentifierMulti[] = [
from: {name: 'TuiTextAreaDirective', moduleSpecifier: '@taiga-ui/kit'},
to: {name: 'TuiTextareaDirective', moduleSpecifier: '@taiga-ui/legacy'},
},
{
from: {name: 'TuiStatus', moduleSpecifier: '@taiga-ui/kit'},
to: {name: 'TuiStatus', moduleSpecifier: '@taiga-ui/legacy'},
},
{
from: {name: 'TuiTextAreaComponent', moduleSpecifier: '@taiga-ui/kit'},
to: {name: 'TuiTextareaComponent', moduleSpecifier: '@taiga-ui/legacy'},
Expand Down Expand Up @@ -809,10 +821,23 @@ export const IDENTIFIERS_TO_REPLACE: ReplacementIdentifierMulti[] = [
},
{
from: {name: 'TUI_ARROW', moduleSpecifier: '@taiga-ui/kit'},
to: {
name: 'TUI_ARROW',
moduleSpecifier: '@taiga-ui/legacy',
},
to: {name: 'TUI_ARROW', moduleSpecifier: '@taiga-ui/legacy'},
},
{
from: {name: 'TUI_ARROW_MODE', moduleSpecifier: '@taiga-ui/kit'},
to: {name: 'TUI_ARROW_MODE', moduleSpecifier: '@taiga-ui/legacy'},
},
{
from: {name: 'TuiArrowMode', moduleSpecifier: '@taiga-ui/kit'},
to: {name: 'TuiArrowMode', moduleSpecifier: '@taiga-ui/legacy'},
},
{
from: {name: 'TuiComboBoxComponent', moduleSpecifier: '@taiga-ui/kit'},
to: {name: 'TuiComboBoxComponent', moduleSpecifier: '@taiga-ui/legacy'},
},
{
from: {name: 'TuiSelectComponent', moduleSpecifier: '@taiga-ui/kit'},
to: {name: 'TuiSelectComponent', moduleSpecifier: '@taiga-ui/legacy'},
},
{
from: {name: 'TuiArrowComponent', moduleSpecifier: '@taiga-ui/kit'},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,25 +16,77 @@ const collectionPath = join(__dirname, '../../../migration.json');
const COMPONENT_BEFORE = `
import {Component} from '@angular/core';
import { TuiInputModule } from "@taiga-ui/kit";
import {
TUI_TEXTFIELD_SIZE,
TuiPrimitiveTextfieldComponent,
TuiSizeL,
TuiSizeS,
TuiTextfieldSizeDirective,
} from '@taiga-ui/core';
import {TuiStatus, TUI_ARROW_MODE, TUI_ARROW, TuiArrowMode, TuiComboBoxComponent, TuiSelectComponent} from '@taiga-ui/kit';
@Component({
standalone: true,
templateUrl: './test.template.html',
imports: [TuiInputModule]
imports: [TuiInputModule],
providers: [
{
provide: TUI_ARROW_MODE,
useValue: {interactive: TUI_ARROW, disabled: ''},
},
],
})
export class Test {}
export class Test {
status: TuiStatus = 'default';
constructor(
@Inject(TUI_TEXTFIELD_SIZE)
readonly textfieldSize: TuiTextfieldSizeDirective,
@Inject(TUI_ARROW_MODE) readonly arrowMode: TuiArrowMode,
@Inject(TuiComboBoxComponent) readonly comboBox: TuiComboBoxComponent,
@Inject(TuiSelectComponent) readonly select: TuiSelectComponent,
) {}
get size(): TuiSizeL | TuiSizeS {
return this.textfieldSize.size;
}
}
`.trim();

const COMPONENT_AFTER = `
import { TuiInputModule } from "@taiga-ui/legacy";
import { TuiPrimitiveTextfieldComponent, TUI_TEXTFIELD_SIZE, TuiTextfieldSizeDirective, TuiStatus, TUI_ARROW, TUI_ARROW_MODE, TuiArrowMode, TuiComboBoxComponent, TuiSelectComponent, TuiInputModule } from "@taiga-ui/legacy";
import {Component} from '@angular/core';
import {
TuiSizeL,
TuiSizeS
} from '@taiga-ui/core';
@Component({
standalone: true,
templateUrl: './test.template.html',
imports: [TuiInputModule]
imports: [TuiInputModule],
providers: [
{
provide: TUI_ARROW_MODE,
useValue: {interactive: TUI_ARROW, disabled: ''},
},
],
})
export class Test {}
export class Test {
status: TuiStatus = 'default';
constructor(
@Inject(TUI_TEXTFIELD_SIZE)
readonly textfieldSize: TuiTextfieldSizeDirective,
@Inject(TUI_ARROW_MODE) readonly arrowMode: TuiArrowMode,
@Inject(TuiComboBoxComponent) readonly comboBox: TuiComboBoxComponent,
@Inject(TuiSelectComponent) readonly select: TuiSelectComponent,
) {}
get size(): TuiSizeL | TuiSizeS {
return this.textfieldSize.size;
}
}
`.trim();

const TEMPLATE_BEFORE = `
Expand Down

0 comments on commit f9bf14f

Please sign in to comment.