Skip to content

Commit d663bb4

Browse files
committed
feat: migrate
1 parent 70ffd03 commit d663bb4

24 files changed

+275
-1603
lines changed

angular.json

Lines changed: 36 additions & 73 deletions
Original file line numberDiff line numberDiff line change
@@ -15,122 +15,85 @@
1515
"prefix": "app",
1616
"architect": {
1717
"build": {
18-
"builder": "@angular-devkit/build-angular:browser",
18+
"builder": "@angular-devkit/build-angular:application",
1919
"options": {
2020
"outputPath": "dist/my-personal-web-angular",
2121
"index": "src/index.html",
22-
"main": "src/main.ts",
23-
"polyfills": "src/polyfills.ts",
22+
"browser": "src/main.ts",
23+
"polyfills": ["zone.js"],
2424
"tsConfig": "tsconfig.app.json",
2525
"assets": [
2626
"src/favicon.ico",
2727
"src/assets"
2828
],
29-
"styles": [
30-
"src/styles.scss"
31-
],
32-
"scripts": [],
33-
"vendorChunk": true,
34-
"extractLicenses": false,
35-
"buildOptimizer": false,
36-
"sourceMap": true,
37-
"optimization": false,
38-
"namedChunks": true
29+
"styles": ["src/styles.scss"],
30+
"scripts": []
3931
},
4032
"configurations": {
4133
"production": {
42-
"fileReplacements": [
43-
{
44-
"replace": "src/environments/environment.ts",
45-
"with": "src/environments/environment.prod.ts"
46-
}
47-
],
48-
"optimization": true,
49-
"outputHashing": "all",
50-
"sourceMap": false,
51-
"namedChunks": false,
52-
"extractLicenses": true,
53-
"vendorChunk": false,
54-
"buildOptimizer": true,
5534
"budgets": [
5635
{
5736
"type": "initial",
58-
"maximumWarning": "2mb",
59-
"maximumError": "5mb"
37+
"maximumWarning": "1MB",
38+
"maximumError": "2MB"
6039
},
6140
{
6241
"type": "anyComponentStyle",
63-
"maximumWarning": "6kb",
64-
"maximumError": "10kb"
42+
"maximumWarning": "4kB",
43+
"maximumError": "8kB"
6544
}
66-
]
45+
],
46+
"fileReplacements": [
47+
{
48+
"replace": "src/environments/environment.ts",
49+
"with": "src/environments/environment.prod.ts"
50+
}
51+
],
52+
"outputHashing": "all"
53+
},
54+
"development": {
55+
"optimization": false,
56+
"extractLicenses": false,
57+
"sourceMap": true
6758
}
6859
},
69-
"defaultConfiguration": ""
60+
"defaultConfiguration": "production"
7061
},
7162
"serve": {
7263
"builder": "@angular-devkit/build-angular:dev-server",
73-
"options": {
74-
"browserTarget": "my-personal-web-angular:build"
75-
},
7664
"configurations": {
7765
"production": {
78-
"browserTarget": "my-personal-web-angular:build:production"
66+
"buildTarget": "my-personal-web-angular:build:production"
67+
},
68+
"development": {
69+
"buildTarget": "my-personal-web-angular:build:development"
7970
}
80-
}
71+
},
72+
"defaultConfiguration": "development"
8173
},
8274
"extract-i18n": {
8375
"builder": "@angular-devkit/build-angular:extract-i18n",
8476
"options": {
85-
"browserTarget": "my-personal-web-angular:build"
77+
"buildTarget": "my-personal-web-angular:build"
8678
}
8779
},
8880
"test": {
8981
"builder": "@angular-devkit/build-angular:karma",
9082
"options": {
91-
"main": "src/test.ts",
92-
"polyfills": "src/polyfills.ts",
83+
"polyfills": ["zone.js", "zone.js/testing"],
9384
"tsConfig": "tsconfig.spec.json",
94-
"karmaConfig": "karma.conf.js",
9585
"assets": [
9686
"src/favicon.ico",
9787
"src/assets"
9888
],
99-
"styles": [
100-
"src/styles.scss"
101-
],
89+
"styles": ["src/styles.scss"],
10290
"scripts": []
10391
}
104-
},
105-
"lint": {
106-
"builder": "@angular-devkit/build-angular:tslint",
107-
"options": {
108-
"tsConfig": [
109-
"tsconfig.app.json",
110-
"tsconfig.spec.json",
111-
"e2e/tsconfig.json"
112-
],
113-
"exclude": [
114-
"**/node_modules/**"
115-
]
116-
}
117-
},
118-
"e2e": {
119-
"builder": "@angular-devkit/build-angular:protractor",
120-
"options": {
121-
"protractorConfig": "e2e/protractor.conf.js",
122-
"devServerTarget": "my-personal-web-angular:serve"
123-
},
124-
"configurations": {
125-
"production": {
126-
"devServerTarget": "my-personal-web-angular:serve:production"
127-
}
128-
}
12992
}
13093
}
131-
}},
132-
"defaultProject": "my-personal-web-angular",
94+
}
95+
},
13396
"cli": {
134-
"analytics": "66f50077-580e-4643-99fa-232380abbd81"
97+
"analytics": "c21eee3c-61ce-452d-94a4-098474ac1e2a"
13598
}
136-
}
99+
}

karma.conf.js

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

package.json

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,7 @@
66
"start": "ng serve",
77
"build": "ng build",
88
"test": "ng test",
9-
"lint": "ng lint",
10-
"e2e": "ng e2e"
9+
"lint": "ng lint"
1110
},
1211
"private": true,
1312
"dependencies": {
@@ -32,19 +31,15 @@
3231
"@angular/compiler-cli": "^21.2.6",
3332
"@angular/language-service": "^21.2.6",
3433
"@types/jasmine": "^6.0.0",
35-
"@types/jasminewd2": "^2.0.13",
3634
"@types/node": "^25.5.0",
37-
"codelyzer": "^6.0.2",
3835
"jasmine-core": "^6.1.0",
3936
"jasmine-spec-reporter": "^7.0.0",
4037
"karma": "^6.4.4",
4138
"karma-chrome-launcher": "^3.2.0",
42-
"karma-coverage-istanbul-reporter": "^3.0.3",
39+
"karma-coverage": "^2.2.1",
4340
"karma-jasmine": "^5.1.0",
4441
"karma-jasmine-html-reporter": "^2.2.0",
45-
"protractor": "^7.0.0",
4642
"ts-node": "^10.9.2",
47-
"tslint": "^6.1.3",
4843
"typescript": "~6.0.2"
4944
},
5045
"packageManager": "yarn@1.22.22+sha512.a6b2f7906b721bba3d67d4aff083df04dad64c399707841b7acf00f6b133b7ac24255f2652fa22ae3534329dc6180534e98d17432037ff6fd140556e2bb3137e"

src/app/app-routing.module.ts

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

src/app/app.component.html

Lines changed: 15 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<nav class="navbar" role="navigation" aria-label="main navigation">
22
<div class="navbar-brand">
33
<a class="navbar-item" href="https://bulma.io">
4-
<img src="https://bulma.io/images/bulma-logo.png" width="112" height="28">
4+
<img src="https://bulma.io/assets/brand/Bulma%20Logo%20Black.png" width="112" height="28">
55
</a>
66

77
<a role="button" class="navbar-burger burger" aria-label="menu" aria-expanded="false"
@@ -14,35 +14,32 @@
1414

1515
<div id="navbarBasicExample" class="navbar-menu">
1616
<div class="navbar-end">
17-
<a class="navbar-item" routerLink="/" routerLinkActive="active">
18-
Home
19-
</a>
20-
21-
<a class="navbar-item" routerLink="/education" routerLinkActive="active">
22-
Education
23-
</a>
24-
<a class="navbar-item" routerLink="/profile" routerLinkActive="active">
25-
Profile
26-
</a>
27-
<a class="navbar-item" *ngIf="!loginDisplay" (click)="login()">Login</a>
28-
<a class="navbar-item" *ngIf="loginDisplay" (click)="logout()">Logout</a>
17+
<a class="navbar-item" routerLink="/" routerLinkActive="active">Home</a>
18+
<a class="navbar-item" routerLink="/education" routerLinkActive="active">Education</a>
19+
<a class="navbar-item" routerLink="/profile" routerLinkActive="active">Profile</a>
20+
@if (!loginDisplay) {
21+
<a class="navbar-item" (click)="login()">Login</a>
22+
}
23+
@if (loginDisplay) {
24+
<a class="navbar-item" (click)="logout()">Logout</a>
25+
}
2926
</div>
3027
</div>
3128
</nav>
3229
<section class="section">
3330
<div class="container">
34-
<router-outlet *ngIf="!isIframe"></router-outlet>
31+
@if (!isIframe) {
32+
<router-outlet></router-outlet>
33+
}
3534
</div>
3635
</section>
3736
<footer class="footer">
3837
<div class="content has-text-centered">
3938
<p>
4039
<strong>My Personal Web Angular</strong> by <a href="https://berviantoleo.my.id">Bervianto Leo Pratama</a>. The
41-
source
42-
code is
43-
licensed
40+
source code is licensed
4441
<a href="http://opensource.org/licenses/mit-license.php">MIT</a>. The website content
4542
is licensed <a href="http://creativecommons.org/licenses/by-nc-sa/4.0/">CC BY NC SA 4.0</a>.
4643
</p>
4744
</div>
48-
</footer>
45+
</footer>

src/app/app.component.spec.ts

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,35 @@
1-
import { TestBed, waitForAsync } from '@angular/core/testing';
2-
import { RouterTestingModule } from '@angular/router/testing';
1+
import { TestBed } from '@angular/core/testing';
2+
import { provideRouter } from '@angular/router';
3+
import { MsalModule } from '@azure/msal-angular';
4+
import { PublicClientApplication, BrowserCacheLocation, InteractionType } from '@azure/msal-browser';
35
import { AppComponent } from './app.component';
46

57
describe('AppComponent', () => {
6-
beforeEach(waitForAsync(() => {
7-
TestBed.configureTestingModule({
8+
beforeEach(async () => {
9+
await TestBed.configureTestingModule({
810
imports: [
9-
RouterTestingModule
10-
],
11-
declarations: [
12-
AppComponent
11+
AppComponent,
12+
MsalModule.forRoot(
13+
new PublicClientApplication({
14+
auth: { clientId: 'test-client-id' },
15+
cache: { cacheLocation: BrowserCacheLocation.LocalStorage }
16+
}),
17+
{ interactionType: InteractionType.Redirect, authRequest: { scopes: ['user.read'] } },
18+
{ interactionType: InteractionType.Redirect, protectedResourceMap: new Map() }
19+
)
1320
],
21+
providers: [provideRouter([])]
1422
}).compileComponents();
15-
}));
23+
});
1624

1725
it('should create the app', () => {
1826
const fixture = TestBed.createComponent(AppComponent);
19-
const app = fixture.debugElement.componentInstance;
27+
const app = fixture.componentInstance;
2028
expect(app).toBeTruthy();
2129
});
2230

23-
it(`should have as title 'my-personal-web-angular'`, () => {
24-
const fixture = TestBed.createComponent(AppComponent);
25-
const app = fixture.debugElement.componentInstance;
26-
expect(app.title).toEqual('my-personal-web-angular');
27-
});
28-
29-
it('should render title', () => {
31+
it(`should have title 'my-personal-web-angular'`, () => {
3032
const fixture = TestBed.createComponent(AppComponent);
31-
fixture.detectChanges();
32-
const compiled = fixture.debugElement.nativeElement;
33-
expect(compiled.querySelector('.content span').textContent).toContain('my-personal-web-angular app is running!');
33+
expect(fixture.componentInstance.title).toEqual('my-personal-web-angular');
3434
});
3535
});

0 commit comments

Comments
 (0)