From 22967d8d123fa2378226b236aacc7dbba5d4c34e Mon Sep 17 00:00:00 2001 From: stefanoslig Date: Wed, 20 Nov 2024 22:24:35 +0100 Subject: [PATCH] refactor: components are standalone by default in ng v19 --- apps/conduit/src/app/app.component.ts | 1 - .../src/app/layout/footer/footer.component.ts | 1 - .../src/app/layout/navbar/navbar.component.ts | 1 - .../src/article-edit.component.ts | 1 - .../src/add-comment/add-comment.component.ts | 1 - .../article-comment.component.ts | 1 - .../article-meta/article-meta.component.ts | 1 - .../feature-article/src/article.component.ts | 1 - .../article-list-item.component.ts | 1 - .../src/article-list.component.ts | 1 - .../feature-auth/src/login/login.component.ts | 1 - .../src/register/register.component.ts | 1 - .../src/lib/input-errors/error-mapper-pipe.ts | 1 - .../input-errors/input-errors.component.ts | 1 - .../is-error-visible.directive.ts | 3 +- .../lib/list-errors/list-errors.component.ts | 1 - libs/home/feature-home/src/home.component.ts | 1 - .../src/tags-list/tags-list.component.ts | 3 +- .../feature-profile/src/profile.component.ts | 1 - .../src/settings.component.ts | 1 - .../src/lib/pager/pager.component.ts | 1 - tsconfig.base.json | 96 ++++++++++++++----- 22 files changed, 74 insertions(+), 47 deletions(-) diff --git a/apps/conduit/src/app/app.component.ts b/apps/conduit/src/app/app.component.ts index 32a4ef04..0d11f7f7 100644 --- a/apps/conduit/src/app/app.component.ts +++ b/apps/conduit/src/app/app.component.ts @@ -7,7 +7,6 @@ import { NavbarComponent } from './layout/navbar/navbar.component'; @Component({ selector: 'cdt-root', - standalone: true, templateUrl: './app.component.html', imports: [FooterComponent, NavbarComponent, RouterModule], changeDetection: ChangeDetectionStrategy.OnPush, diff --git a/apps/conduit/src/app/layout/footer/footer.component.ts b/apps/conduit/src/app/layout/footer/footer.component.ts index 89c929d4..3353f8f8 100644 --- a/apps/conduit/src/app/layout/footer/footer.component.ts +++ b/apps/conduit/src/app/layout/footer/footer.component.ts @@ -2,7 +2,6 @@ import { Component, ChangeDetectionStrategy } from '@angular/core'; @Component({ selector: 'cdt-footer', - standalone: true, templateUrl: './footer.component.html', changeDetection: ChangeDetectionStrategy.OnPush, }) diff --git a/apps/conduit/src/app/layout/navbar/navbar.component.ts b/apps/conduit/src/app/layout/navbar/navbar.component.ts index 8c3b532f..72cc9626 100644 --- a/apps/conduit/src/app/layout/navbar/navbar.component.ts +++ b/apps/conduit/src/app/layout/navbar/navbar.component.ts @@ -4,7 +4,6 @@ import { User } from '@realworld/core/api-types'; @Component({ selector: 'cdt-navbar', - standalone: true, templateUrl: './navbar.component.html', imports: [RouterModule], changeDetection: ChangeDetectionStrategy.OnPush, diff --git a/libs/articles/feature-article-edit/src/article-edit.component.ts b/libs/articles/feature-article-edit/src/article-edit.component.ts index a17f95eb..065e1d07 100644 --- a/libs/articles/feature-article-edit/src/article-edit.component.ts +++ b/libs/articles/feature-article-edit/src/article-edit.component.ts @@ -6,7 +6,6 @@ import { ArticleStore } from '@realworld/articles/data-access'; @Component({ selector: 'cdt-article-edit', - standalone: true, templateUrl: './article-edit.component.html', styleUrls: ['./article-edit.component.css'], imports: [ListErrorsComponent, ReactiveFormsModule, InputErrorsComponent], diff --git a/libs/articles/feature-article/src/add-comment/add-comment.component.ts b/libs/articles/feature-article/src/add-comment/add-comment.component.ts index a21eb504..492e8f07 100644 --- a/libs/articles/feature-article/src/add-comment/add-comment.component.ts +++ b/libs/articles/feature-article/src/add-comment/add-comment.component.ts @@ -5,7 +5,6 @@ import { FormBuilder, ReactiveFormsModule } from '@angular/forms'; @Component({ selector: 'cdt-add-comment', - standalone: true, templateUrl: './add-comment.component.html', imports: [ListErrorsComponent, ReactiveFormsModule, InputErrorsComponent], changeDetection: ChangeDetectionStrategy.OnPush, diff --git a/libs/articles/feature-article/src/article-comment/article-comment.component.ts b/libs/articles/feature-article/src/article-comment/article-comment.component.ts index 0d352d79..ba8b6e03 100644 --- a/libs/articles/feature-article/src/article-comment/article-comment.component.ts +++ b/libs/articles/feature-article/src/article-comment/article-comment.component.ts @@ -6,7 +6,6 @@ import { DatePipe } from '@angular/common'; @Component({ selector: 'cdt-article-comment', - standalone: true, templateUrl: './article-comment.component.html', imports: [DatePipe, RouterModule], changeDetection: ChangeDetectionStrategy.OnPush, diff --git a/libs/articles/feature-article/src/article-meta/article-meta.component.ts b/libs/articles/feature-article/src/article-meta/article-meta.component.ts index 9209b9ad..17284185 100644 --- a/libs/articles/feature-article/src/article-meta/article-meta.component.ts +++ b/libs/articles/feature-article/src/article-meta/article-meta.component.ts @@ -4,7 +4,6 @@ import { RouterModule } from '@angular/router'; import { Article } from '@realworld/core/api-types'; @Component({ selector: 'cdt-article-meta', - standalone: true, templateUrl: './article-meta.component.html', imports: [RouterModule, NgClass, DatePipe], changeDetection: ChangeDetectionStrategy.OnPush, diff --git a/libs/articles/feature-article/src/article.component.ts b/libs/articles/feature-article/src/article.component.ts index ce8f4527..dcd0b2c6 100644 --- a/libs/articles/feature-article/src/article.component.ts +++ b/libs/articles/feature-article/src/article.component.ts @@ -9,7 +9,6 @@ import { AuthStore } from '@realworld/auth/data-access'; @Component({ selector: 'cdt-article', - standalone: true, templateUrl: './article.component.html', styleUrls: ['./article.component.css'], imports: [ArticleMetaComponent, ArticleCommentComponent, MarkdownPipe, AddCommentComponent, RouterLink], diff --git a/libs/articles/feature-articles-list/src/article-list-item/article-list-item.component.ts b/libs/articles/feature-articles-list/src/article-list-item/article-list-item.component.ts index cba52e32..82475073 100644 --- a/libs/articles/feature-articles-list/src/article-list-item/article-list-item.component.ts +++ b/libs/articles/feature-articles-list/src/article-list-item/article-list-item.component.ts @@ -4,7 +4,6 @@ import { NgClass, DatePipe } from '@angular/common'; import { Article } from '@realworld/core/api-types'; @Component({ selector: 'cdt-article-list-item', - standalone: true, templateUrl: './article-list-item.component.html', imports: [RouterModule, NgClass, DatePipe], changeDetection: ChangeDetectionStrategy.OnPush, diff --git a/libs/articles/feature-articles-list/src/article-list.component.ts b/libs/articles/feature-articles-list/src/article-list.component.ts index 3db947b2..d30207c3 100644 --- a/libs/articles/feature-articles-list/src/article-list.component.ts +++ b/libs/articles/feature-articles-list/src/article-list.component.ts @@ -6,7 +6,6 @@ import { ArticlesListStore } from '@realworld/articles/data-access'; @Component({ selector: 'cdt-article-list', - standalone: true, templateUrl: './article-list.component.html', imports: [ArticleListItemComponent, PagerComponent], changeDetection: ChangeDetectionStrategy.OnPush, diff --git a/libs/auth/feature-auth/src/login/login.component.ts b/libs/auth/feature-auth/src/login/login.component.ts index 1b1243cb..8b6d139a 100644 --- a/libs/auth/feature-auth/src/login/login.component.ts +++ b/libs/auth/feature-auth/src/login/login.component.ts @@ -6,7 +6,6 @@ import { AuthStore } from '@realworld/auth/data-access'; @Component({ selector: 'cdt-login', - standalone: true, templateUrl: './login.component.html', imports: [ListErrorsComponent, RouterLink, ReactiveFormsModule, InputErrorsComponent], changeDetection: ChangeDetectionStrategy.OnPush, diff --git a/libs/auth/feature-auth/src/register/register.component.ts b/libs/auth/feature-auth/src/register/register.component.ts index b6787548..48d2f4c3 100644 --- a/libs/auth/feature-auth/src/register/register.component.ts +++ b/libs/auth/feature-auth/src/register/register.component.ts @@ -6,7 +6,6 @@ import { FormBuilder, ReactiveFormsModule, Validators } from '@angular/forms'; @Component({ selector: 'cdt-register', - standalone: true, templateUrl: './register.component.html', styleUrls: ['./register.component.css'], imports: [ListErrorsComponent, RouterModule, ReactiveFormsModule, InputErrorsComponent], diff --git a/libs/core/forms/src/lib/input-errors/error-mapper-pipe.ts b/libs/core/forms/src/lib/input-errors/error-mapper-pipe.ts index 49be5b74..95bd4e9e 100644 --- a/libs/core/forms/src/lib/input-errors/error-mapper-pipe.ts +++ b/libs/core/forms/src/lib/input-errors/error-mapper-pipe.ts @@ -3,7 +3,6 @@ import { VALIDATION_ERROR_MESSAGES } from './error-messages'; @Pipe({ name: 'errorMapper', - standalone: true, }) export class ErrorMapperPipe implements PipeTransform { private errorMessages = inject(VALIDATION_ERROR_MESSAGES); diff --git a/libs/core/forms/src/lib/input-errors/input-errors.component.ts b/libs/core/forms/src/lib/input-errors/input-errors.component.ts index 0d442666..7928fcc1 100644 --- a/libs/core/forms/src/lib/input-errors/input-errors.component.ts +++ b/libs/core/forms/src/lib/input-errors/input-errors.component.ts @@ -6,7 +6,6 @@ import { IsErrorVisibleDirective } from './is-error-visible.directive'; @Component({ selector: 'cdt-input-errors', - standalone: true, templateUrl: './input-errors.component.html', changeDetection: ChangeDetectionStrategy.OnPush, imports: [KeyValuePipe, ErrorMapperPipe, IsErrorVisibleDirective], diff --git a/libs/core/forms/src/lib/input-errors/is-error-visible.directive.ts b/libs/core/forms/src/lib/input-errors/is-error-visible.directive.ts index 99f978e7..44aa8ad5 100644 --- a/libs/core/forms/src/lib/input-errors/is-error-visible.directive.ts +++ b/libs/core/forms/src/lib/input-errors/is-error-visible.directive.ts @@ -3,8 +3,7 @@ import { takeUntilDestroyed } from '@angular/core/rxjs-interop'; import { AbstractControl } from '@angular/forms'; @Directive({ - standalone: true, - selector: '[isErrorVisible]', + selector: '[isErrorVisible]' }) export class IsErrorVisibleDirective implements AfterViewInit { private readonly templateRef = inject(TemplateRef); diff --git a/libs/core/forms/src/lib/list-errors/list-errors.component.ts b/libs/core/forms/src/lib/list-errors/list-errors.component.ts index d2f4c49c..c92a6c53 100644 --- a/libs/core/forms/src/lib/list-errors/list-errors.component.ts +++ b/libs/core/forms/src/lib/list-errors/list-errors.component.ts @@ -3,7 +3,6 @@ import { FormErrorsStore } from '../forms-errors.store'; @Component({ selector: 'cdt-list-errors', - standalone: true, templateUrl: './list-errors.component.html', changeDetection: ChangeDetectionStrategy.OnPush, }) diff --git a/libs/home/feature-home/src/home.component.ts b/libs/home/feature-home/src/home.component.ts index 41db8722..cc355bd0 100644 --- a/libs/home/feature-home/src/home.component.ts +++ b/libs/home/feature-home/src/home.component.ts @@ -9,7 +9,6 @@ import { AuthStore } from '@realworld/auth/data-access'; @Component({ selector: 'cdt-home', - standalone: true, templateUrl: './home.component.html', styleUrls: ['./home.component.css'], imports: [NgClass, TagsListComponent, ArticleListComponent], diff --git a/libs/home/feature-home/src/tags-list/tags-list.component.ts b/libs/home/feature-home/src/tags-list/tags-list.component.ts index 83046171..5858aa53 100644 --- a/libs/home/feature-home/src/tags-list/tags-list.component.ts +++ b/libs/home/feature-home/src/tags-list/tags-list.component.ts @@ -1,8 +1,7 @@ -import { Component, Input, Output, EventEmitter, ChangeDetectionStrategy, output, input } from '@angular/core'; +import { Component, ChangeDetectionStrategy, output, input } from '@angular/core'; @Component({ selector: 'cdt-tags-list', - standalone: true, templateUrl: './tags-list.component.html', changeDetection: ChangeDetectionStrategy.OnPush, }) diff --git a/libs/profile/feature-profile/src/profile.component.ts b/libs/profile/feature-profile/src/profile.component.ts index 4f984a51..dcdb9b6e 100644 --- a/libs/profile/feature-profile/src/profile.component.ts +++ b/libs/profile/feature-profile/src/profile.component.ts @@ -5,7 +5,6 @@ import { AuthStore } from '@realworld/auth/data-access'; import { ProfileStore } from '@realworld/profile/data-access'; @Component({ - standalone: true, selector: 'cdt-profile', templateUrl: './profile.component.html', styleUrls: ['./profile.component.css'], diff --git a/libs/settings/feature-settings/src/settings.component.ts b/libs/settings/feature-settings/src/settings.component.ts index 50063383..472deb3e 100644 --- a/libs/settings/feature-settings/src/settings.component.ts +++ b/libs/settings/feature-settings/src/settings.component.ts @@ -4,7 +4,6 @@ import { AuthStore } from '@realworld/auth/data-access'; import { FormBuilder, ReactiveFormsModule, Validators } from '@angular/forms'; @Component({ - standalone: true, selector: 'cdt-settings', templateUrl: './settings.component.html', styleUrls: ['./settings.component.css'], diff --git a/libs/ui/components/src/lib/pager/pager.component.ts b/libs/ui/components/src/lib/pager/pager.component.ts index 76e150d1..6021dffa 100644 --- a/libs/ui/components/src/lib/pager/pager.component.ts +++ b/libs/ui/components/src/lib/pager/pager.component.ts @@ -2,7 +2,6 @@ import { NgClass } from '@angular/common'; import { Component, ChangeDetectionStrategy, input, output } from '@angular/core'; @Component({ - standalone: true, selector: 'cdt-pager', templateUrl: './pager.component.html', styleUrls: ['./pager.component.css'], diff --git a/tsconfig.base.json b/tsconfig.base.json index 834b4c07..ae6bba47 100644 --- a/tsconfig.base.json +++ b/tsconfig.base.json @@ -10,34 +10,82 @@ "importHelpers": true, "target": "es2015", "module": "esnext", - "typeRoots": ["node_modules/@types"], - "lib": ["es2017", "dom"], + "typeRoots": [ + "node_modules/@types" + ], + "lib": [ + "es2017", + "dom" + ], "skipLibCheck": true, "skipDefaultLibCheck": true, "baseUrl": ".", "paths": { - "@default/*": ["apps/conduit/src/app/*"], - "@env/*": ["apps/conduit/src/environments/*"], - "@realworld/*": ["libs/*"], - "@realworld/articles/article": ["libs/articles/feature-article/src/index.ts"], - "@realworld/articles/article-edit": ["libs/articles/feature-article-edit/src/index.ts"], - "@realworld/articles/articles-list": ["libs/articles/feature-articles-list/src/index.ts"], - "@realworld/articles/data-access": ["libs/articles/data-access/src/index.ts"], - "@realworld/auth/data-access": ["libs/auth/data-access/src/index.ts"], - "@realworld/auth/feature-auth": ["libs/auth/feature-auth/src/index.ts"], - "@realworld/core/api-types": ["libs/core/api-types/src/index.ts"], - "@realworld/core/data-access": ["libs/core/data-access/src/index.ts"], - "@realworld/core/error-handler": ["libs/core/error-handler/src/index.ts"], - "@realworld/core/forms": ["libs/core/forms/src/index.ts"], - "@realworld/core/http-client": ["libs/core/http-client/src/index.ts"], - "@realworld/home/feature-home": ["libs/home/feature-home/src/index.ts"], - "@realworld/profile/data-access": ["libs/profile/data-access/src/index.ts"], - "@realworld/profile/feature-profile": ["libs/profile/feature-profile/src/index.ts"], - "@realworld/settings/data-access": ["libs/settings/data-access/src/index.ts"], - "@realworld/settings/feature-settings": ["libs/settings/feature-settings/src/index.ts"], - "@realworld/ui/components": ["libs/ui/components/src/index.ts"] + "@default/*": [ + "apps/conduit/src/app/*" + ], + "@env/*": [ + "apps/conduit/src/environments/*" + ], + "@realworld/*": [ + "libs/*" + ], + "@realworld/articles/article": [ + "libs/articles/feature-article/src/index.ts" + ], + "@realworld/articles/article-edit": [ + "libs/articles/feature-article-edit/src/index.ts" + ], + "@realworld/articles/articles-list": [ + "libs/articles/feature-articles-list/src/index.ts" + ], + "@realworld/articles/data-access": [ + "libs/articles/data-access/src/index.ts" + ], + "@realworld/auth/data-access": [ + "libs/auth/data-access/src/index.ts" + ], + "@realworld/auth/feature-auth": [ + "libs/auth/feature-auth/src/index.ts" + ], + "@realworld/core/api-types": [ + "libs/core/api-types/src/index.ts" + ], + "@realworld/core/data-access": [ + "libs/core/data-access/src/index.ts" + ], + "@realworld/core/error-handler": [ + "libs/core/error-handler/src/index.ts" + ], + "@realworld/core/forms": [ + "libs/core/forms/src/index.ts" + ], + "@realworld/core/http-client": [ + "libs/core/http-client/src/index.ts" + ], + "@realworld/home/feature-home": [ + "libs/home/feature-home/src/index.ts" + ], + "@realworld/profile/data-access": [ + "libs/profile/data-access/src/index.ts" + ], + "@realworld/profile/feature-profile": [ + "libs/profile/feature-profile/src/index.ts" + ], + "@realworld/settings/data-access": [ + "libs/settings/data-access/src/index.ts" + ], + "@realworld/settings/feature-settings": [ + "libs/settings/feature-settings/src/index.ts" + ], + "@realworld/ui/components": [ + "libs/ui/components/src/index.ts" + ] }, "strict": true }, - "exclude": ["node_modules", "tmp"] -} + "exclude": [ + "node_modules", + "tmp" + ] +} \ No newline at end of file