Skip to content

Commit fe1a453

Browse files
authored
chore(setup): migrate to standalone (#174)
1 parent 5eea807 commit fe1a453

File tree

9 files changed

+20
-28
lines changed

9 files changed

+20
-28
lines changed

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ jobs:
1919
- name: Select Node Version
2020
uses: svierk/get-node-version@main
2121
- name: Install Dependencies
22-
run: npm ci
22+
run: npm install --ignore-scripts
2323
- name: Check Prettier
2424
run: npm run prettier
2525
- name: Check ESLint

src/app/app.component.spec.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,7 @@ describe('AppComponent', () => {
1212

1313
beforeEach(async () => {
1414
await TestBed.configureTestingModule({
15-
imports: [RouterTestingModule],
16-
declarations: [AppComponent, ToasterComponent],
15+
imports: [RouterTestingModule, ToasterComponent, AppComponent],
1716
}).compileComponents();
1817
});
1918

src/app/app.component.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
11
import { Component, inject } from '@angular/core';
22
import { EventTypes } from './models/event-types';
33
import { ToastService } from './services/toast.service';
4+
import { ToasterComponent } from './components/toaster/toaster.component';
5+
import { RouterOutlet } from '@angular/router';
46

57
@Component({
68
selector: 'app-root',
79
templateUrl: './app.component.html',
810
styleUrls: ['./app.component.scss'],
9-
standalone: false,
11+
imports: [ToasterComponent, RouterOutlet],
1012
})
1113
export class AppComponent {
1214
readonly toastService = inject(ToastService);

src/app/app.module.ts

Lines changed: 0 additions & 15 deletions
This file was deleted.

src/app/components/toast/toast.component.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ describe('ToastComponent', () => {
1010

1111
beforeEach(async () => {
1212
await TestBed.configureTestingModule({
13-
declarations: [ToastComponent],
13+
imports: [ToastComponent],
1414
}).compileComponents();
1515
});
1616

src/app/components/toast/toast.component.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,13 @@ import { Component, ElementRef, EventEmitter, Input, OnInit, Output, ViewChild }
33
import { Toast } from 'bootstrap';
44
import { fromEvent, take } from 'rxjs';
55
import { EventTypes } from 'src/app/models/event-types';
6+
import { NgClass } from '@angular/common';
67

78
@Component({
89
selector: 'app-toast',
910
templateUrl: './toast.component.html',
1011
styleUrls: ['./toast.component.scss'],
11-
standalone: false,
12+
imports: [NgClass],
1213
})
1314
export class ToastComponent implements OnInit {
1415
@Output() disposeEvent = new EventEmitter();

src/app/components/toaster/toaster.component.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ describe('ToasterComponent', () => {
88

99
beforeEach(async () => {
1010
await TestBed.configureTestingModule({
11-
declarations: [ToasterComponent],
11+
imports: [ToasterComponent],
1212
}).compileComponents();
1313
});
1414

src/app/components/toaster/toaster.component.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
11
import { ChangeDetectionStrategy, ChangeDetectorRef, Component, OnInit, inject } from '@angular/core';
22
import { ToastEvent } from 'src/app/models/toast-event';
33
import { ToastService } from 'src/app/services/toast.service';
4+
import { ToastComponent } from '../toast/toast.component';
45

56
@Component({
67
selector: 'app-toaster',
78
templateUrl: './toaster.component.html',
89
styleUrls: ['./toaster.component.scss'],
910
changeDetection: ChangeDetectionStrategy.OnPush,
10-
standalone: false,
11+
imports: [ToastComponent],
1112
})
1213
export class ToasterComponent implements OnInit {
1314
readonly toastService = inject(ToastService);

src/main.ts

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,17 @@
1-
import { enableProdMode, provideZoneChangeDetection } from '@angular/core';
2-
import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
3-
import { AppModule } from './app/app.module';
1+
import { enableProdMode, importProvidersFrom } from '@angular/core';
2+
3+
import { MatIconModule } from '@angular/material/icon';
4+
import { BrowserModule, bootstrapApplication } from '@angular/platform-browser';
5+
import { AppRoutingModule } from './app/app-routing.module';
6+
import { AppComponent } from './app/app.component';
47
import { environment } from './environments/environment';
58

69
if (environment.production) {
710
enableProdMode();
811
}
912

10-
platformBrowserDynamic()
11-
.bootstrapModule(AppModule, { applicationProviders: [provideZoneChangeDetection()] })
13+
bootstrapApplication(AppComponent, {
14+
providers: [importProvidersFrom(BrowserModule, AppRoutingModule, MatIconModule)],
15+
})
1216
// eslint-disable-next-line no-console
1317
.catch((err) => console.error(err));

0 commit comments

Comments
 (0)