Skip to content

Commit

Permalink
chore(deps): update dependency ng-morph to v4 (#5766)
Browse files Browse the repository at this point in the history
Co-authored-by: splincode <[email protected]>
  • Loading branch information
taiga-family-bot and splincode authored Oct 27, 2023
1 parent 4d327c6 commit 32553de
Show file tree
Hide file tree
Showing 10 changed files with 156 additions and 49 deletions.
168 changes: 138 additions & 30 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion projects/cdk/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
"rxjs": ">=6.0.0"
},
"optionalDependencies": {
"ng-morph": "2.2.5",
"ng-morph": "4.0.0",
"parse5": "6.0.1"
},
"ng-update": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -285,8 +285,8 @@ import { RouterModule } from '@angular/router';
selector: 'standalone-test-root',
templateUrl: './app.template.html',
styleUrls: ['./app.component.less'],
providers: [{provide: TUI_SANITIZER, useClass: NgDompurifySanitizer}]
})
providers: [{provide: TUI_SANITIZER, useClass: NgDompurifySanitizer}]
})
export class AppComponent {
title = 'standalone-test';
}`,
Expand Down
6 changes: 3 additions & 3 deletions projects/cdk/schematics/ng-add/tests/schematic-ng-add.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -281,9 +281,9 @@ import {NgModule} from '@angular/core';
import {AppComponent} from './app.component';
@NgModule({declarations: [AppComponent],
imports: [BrowserAnimationsModule, TuiRootModule, TuiDialogModule, TuiAlertModule],
providers: [{provide: TUI_SANITIZER, useClass: NgDompurifySanitizer}]
})
imports: [BrowserAnimationsModule, TuiRootModule, TuiDialogModule, TuiAlertModule],
providers: [{provide: TUI_SANITIZER, useClass: NgDompurifySanitizer}]
})
export class AppModule {}
`,
);
Expand Down
2 changes: 1 addition & 1 deletion projects/cdk/schematics/ng-update/steps/rename-types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ function renameType(

if (Node.isImportSpecifier(parent)) {
processImport(parent, from, to);
} else if (Node.isTypeReferenceNode(parent)) {
} else if (Node.isTypeReference(parent)) {
const targetType =
preserveGenerics && to ? addGeneric(to, parent.getTypeArguments()) : to;

Expand Down
4 changes: 2 additions & 2 deletions projects/cdk/schematics/ng-update/steps/replace-enums.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ function replaceEnumWithString(
continue;
}

if (Node.isTypeReferenceNode(parent) && !keepAsType) {
if (Node.isTypeReference(parent) && !keepAsType) {
const declaration = parent.getParent() as VariableDeclaration;

declaration.removeType?.();
Expand All @@ -66,5 +66,5 @@ function containTypeRef(node: ImportSpecifier): boolean {
return node
.getNameNode()
.findReferencesAsNodes()
.some(ref => Node.isTypeReferenceNode(ref.getParent()));
.some(ref => Node.isTypeReference(ref.getParent()));
}
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ function replaceService(
return;
}

if (Node.isTypeReferenceNode(parent) && replaceMethods?.length) {
if (Node.isTypeReference(parent) && replaceMethods?.length) {
replaceProperties(parent, replaceMethods);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ function addWarningToMethod(className: string, method: string, message: string):
references.forEach(ref => {
const parent = ref.getParent();

if (Node.isTypeReferenceNode(parent)) {
if (Node.isTypeReference(parent)) {
checkMethod(parent, method, message);
}
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,11 @@ export class TestComponent {}
const COMPONENT_WITH_TEMPLATE_URL_AFTER = `import { TUI_EDITOR_EXTENSIONS, defaultEditorExtensions } from "@taiga-ui/addon-editor";
@Component({templateUrl: './test.template.html',
providers: [{
provide: TUI_EDITOR_EXTENSIONS,
useValue: defaultEditorExtensions
}]
})
providers: [{
provide: TUI_EDITOR_EXTENSIONS,
useValue: defaultEditorExtensions
}]
})
export class TestComponent {}
`;

Expand Down
5 changes: 2 additions & 3 deletions projects/cdk/schematics/utils/add-import-to-component.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
import {ClassDeclaration} from 'ng-morph';
import {pushToArrayProperty} from 'ng-morph/ng/helpers/push-to-array-property';
import {ClassDeclaration, pushToDecoratorArrayProperty} from 'ng-morph';

// TODO: delete after adding to ng-morph
export function addImportToComponent(
classDeclaration: ClassDeclaration,
moduleName: string,
{unique = true}: {unique?: boolean} = {},
): void {
pushToArrayProperty(classDeclaration, `Component`, `imports`, moduleName, {
pushToDecoratorArrayProperty(classDeclaration, `Component`, `imports`, moduleName, {
unique,
forceToArray: true,
});
Expand Down

0 comments on commit 32553de

Please sign in to comment.