From 7d3c339327f7e8f3b4da985f8cc40263bedb13e9 Mon Sep 17 00:00:00 2001 From: sumeyyeKurtulus Date: Wed, 18 Dec 2024 16:13:47 +0300 Subject: [PATCH] update: angular to v19 for module template --- templates/module/angular/package.json | 42 +++++++++---------- .../projects/dev-app/src/app/app.component.ts | 5 ++- .../dev-app/src/app/home/home.component.ts | 1 + .../dev-app/src/app/route.provider.ts | 34 +++++++-------- .../config/src/providers/route.provider.ts | 34 +++++++-------- .../projects/my-project-name/package.json | 4 +- .../components/my-project-name.component.ts | 5 ++- 7 files changed, 60 insertions(+), 65 deletions(-) diff --git a/templates/module/angular/package.json b/templates/module/angular/package.json index 2cd8a9a494..cea2394003 100644 --- a/templates/module/angular/package.json +++ b/templates/module/angular/package.json @@ -22,30 +22,30 @@ "@abp/ng.tenant-management": "~9.0.2", "@abp/ng.theme.basic": "~9.0.2", "@abp/ng.theme.shared": "~9.0.2", - "@angular/animations": "~18.1.0", - "@angular/common": "~18.1.0", - "@angular/compiler": "~18.1.0", - "@angular/core": "~18.1.0", - "@angular/forms": "~18.1.0", - "@angular/localize": "~18.1.0", - "@angular/platform-browser": "~18.1.0", - "@angular/platform-browser-dynamic": "~18.1.0", - "@angular/router": "~18.1.0", + "@angular/animations": "~19.0.0", + "@angular/common": "~19.0.0", + "@angular/compiler": "~19.0.0", + "@angular/core": "~19.0.0", + "@angular/forms": "~19.0.0", + "@angular/localize": "~19.0.0", + "@angular/platform-browser": "~19.0.0", + "@angular/platform-browser-dynamic": "~19.0.0", + "@angular/router": "~19.0.0", "rxjs": "~7.8.0", "tslib": "^2.0.0", - "zone.js": "~0.14.0" + "zone.js": "~0.15.0" }, "devDependencies": { "@abp/ng.schematics": "~9.0.2", - "@angular-devkit/build-angular": "~18.1.0", - "@angular-eslint/builder": "~18.1.0", - "@angular-eslint/eslint-plugin": "~18.1.0", - "@angular-eslint/eslint-plugin-template": "~18.1.0", - "@angular-eslint/schematics": "~18.1.0", - "@angular-eslint/template-parser": "~18.1.0", - "@angular/cli": "~18.1.0", - "@angular/compiler-cli": "~18.1.0", - "@angular/language-service": "~18.1.0", + "@angular-devkit/build-angular": "~19.0.0", + "@angular-eslint/builder": "~19.0.0", + "@angular-eslint/eslint-plugin": "~19.0.0", + "@angular-eslint/eslint-plugin-template": "~19.0.0", + "@angular-eslint/schematics": "~19.0.0", + "@angular-eslint/template-parser": "~19.0.0", + "@angular/cli": "~19.0.0", + "@angular/compiler-cli": "~19.0.0", + "@angular/language-service": "~19.0.0", "@types/jasmine": "~3.6.0", "@types/node": "^12.11.1", "@typescript-eslint/eslint-plugin": "7.16.0", @@ -57,8 +57,8 @@ "karma-coverage": "~2.1.0", "karma-jasmine": "~4.0.0", "karma-jasmine-html-reporter": "^1.7.0", - "ng-packagr": "~17.3.0", + "ng-packagr": "~19.0.0", "symlink": "^2.0.0", - "typescript": "~5.5.0" + "typescript": "~5.6.0" } } diff --git a/templates/module/angular/projects/dev-app/src/app/app.component.ts b/templates/module/angular/projects/dev-app/src/app/app.component.ts index a26e745334..3a2a61014e 100644 --- a/templates/module/angular/projects/dev-app/src/app/app.component.ts +++ b/templates/module/angular/projects/dev-app/src/app/app.component.ts @@ -1,10 +1,11 @@ import { Component } from '@angular/core'; @Component({ + standalone: false, selector: 'app-root', template: ` - - + + `, }) export class AppComponent {} diff --git a/templates/module/angular/projects/dev-app/src/app/home/home.component.ts b/templates/module/angular/projects/dev-app/src/app/home/home.component.ts index ab1f354e89..a0f37a99ca 100644 --- a/templates/module/angular/projects/dev-app/src/app/home/home.component.ts +++ b/templates/module/angular/projects/dev-app/src/app/home/home.component.ts @@ -1,6 +1,7 @@ import { Component } from '@angular/core'; @Component({ + standalone: false, selector: 'app-home', templateUrl: './home.component.html', }) diff --git a/templates/module/angular/projects/dev-app/src/app/route.provider.ts b/templates/module/angular/projects/dev-app/src/app/route.provider.ts index 1c7138236f..32418eb5ec 100644 --- a/templates/module/angular/projects/dev-app/src/app/route.provider.ts +++ b/templates/module/angular/projects/dev-app/src/app/route.provider.ts @@ -1,25 +1,21 @@ import { RoutesService, eLayoutType } from '@abp/ng.core'; -import { APP_INITIALIZER } from '@angular/core'; +import { inject, provideAppInitializer } from '@angular/core'; export const APP_ROUTE_PROVIDER = [ - { - provide: APP_INITIALIZER, - useFactory: configureRoutes, - deps: [RoutesService], - multi: true, - }, + provideAppInitializer(() => { + configureRoutes(); + }), ]; -function configureRoutes(routesService: RoutesService) { - return () => { - routesService.add([ - { - path: '/', - name: 'Home', - iconClass: 'fas fa-home', - order: 1, - layout: eLayoutType.application, - }, - ]); - }; +function configureRoutes() { + const routesService = inject(RoutesService); + routesService.add([ + { + path: '/', + name: 'Home', + iconClass: 'fas fa-home', + order: 1, + layout: eLayoutType.application, + }, + ]); } diff --git a/templates/module/angular/projects/my-project-name/config/src/providers/route.provider.ts b/templates/module/angular/projects/my-project-name/config/src/providers/route.provider.ts index 57157ef060..2a4ffe0079 100644 --- a/templates/module/angular/projects/my-project-name/config/src/providers/route.provider.ts +++ b/templates/module/angular/projects/my-project-name/config/src/providers/route.provider.ts @@ -1,26 +1,22 @@ import { eLayoutType, RoutesService } from '@abp/ng.core'; -import { APP_INITIALIZER } from '@angular/core'; +import { inject, provideAppInitializer } from '@angular/core'; import { eMyProjectNameRouteNames } from '../enums/route-names'; export const MY_PROJECT_NAME_ROUTE_PROVIDERS = [ - { - provide: APP_INITIALIZER, - useFactory: configureRoutes, - deps: [RoutesService], - multi: true, - }, + provideAppInitializer(() => { + configureRoutes(); + }), ]; -export function configureRoutes(routesService: RoutesService) { - return () => { - routesService.add([ - { - path: '/my-project-name', - name: eMyProjectNameRouteNames.MyProjectName, - iconClass: 'fas fa-book', - layout: eLayoutType.application, - order: 3, - }, - ]); - }; +export function configureRoutes() { + const routesService = inject(RoutesService); + routesService.add([ + { + path: '/my-project-name', + name: eMyProjectNameRouteNames.MyProjectName, + iconClass: 'fas fa-book', + layout: eLayoutType.application, + order: 3, + }, + ]); } diff --git a/templates/module/angular/projects/my-project-name/package.json b/templates/module/angular/projects/my-project-name/package.json index 9c06200753..d455b72604 100644 --- a/templates/module/angular/projects/my-project-name/package.json +++ b/templates/module/angular/projects/my-project-name/package.json @@ -2,8 +2,8 @@ "name": "@my-company-name/my-project-name", "version": "0.0.1", "peerDependencies": { - "@angular/common": "~18.1.0", - "@angular/core": "~18.1.0", + "@angular/common": "~19.0.0", + "@angular/core": "~19.0.0", "@abp/ng.core": "~9.0.2", "@abp/ng.theme.shared": "~9.0.2" }, diff --git a/templates/module/angular/projects/my-project-name/src/lib/components/my-project-name.component.ts b/templates/module/angular/projects/my-project-name/src/lib/components/my-project-name.component.ts index 85ca370179..21628304ac 100644 --- a/templates/module/angular/projects/my-project-name/src/lib/components/my-project-name.component.ts +++ b/templates/module/angular/projects/my-project-name/src/lib/components/my-project-name.component.ts @@ -1,13 +1,14 @@ -import { Component, OnInit } from '@angular/core'; +import { Component, inject, OnInit } from '@angular/core'; import { MyProjectNameService } from '../services/my-project-name.service'; @Component({ + standalone: false, selector: 'lib-my-project-name', template: `

my-project-name works!

`, styles: [], }) export class MyProjectNameComponent implements OnInit { - constructor(private service: MyProjectNameService) {} + private service = inject(MyProjectNameService); ngOnInit(): void { this.service.sample().subscribe(console.log);