diff --git a/frontend/angular.json b/frontend/angular.json index c33f9d0..2bcec0c 100644 --- a/frontend/angular.json +++ b/frontend/angular.json @@ -41,7 +41,7 @@ "fileReplacements": [ { "replace": "src/environments/environment.ts", - "with": "src/environments/environment.prod.ts" + "with": "src/environments/environment.production.ts" } ], "optimization": true, @@ -55,7 +55,29 @@ }, "development": { "sourceMap": true, - "optimization": false + "optimization": false, + "fileReplacements": [ + { + "replace": "src/environments/environment.ts", + "with": "src/environments/environment.development.ts" + } + ] + }, + "beta": { + "fileReplacements": [ + { + "replace": "src/environments/environment.ts", + "with": "src/environments/environment.beta.ts" + } + ], + "optimization": true, + "outputHashing": "all", + "sourceMap": false, + "extractCss": true, + "namedChunks": false, + "logging": false, + "vendorChunk": false, + "buildOptimizer": true } } }, diff --git a/frontend/build.gradle.kts b/frontend/build.gradle.kts index 648dbf2..8c1631f 100644 --- a/frontend/build.gradle.kts +++ b/frontend/build.gradle.kts @@ -39,13 +39,13 @@ tasks.register("npmBuild") { "${it.absolutePath}/npm.cmd" } ?: "$nodeDir/node_modules/npm/bin/npm.cmd" - commandLine(npmCmd, "run", "build") + commandLine(npmCmd, "run", "build:dev") } else { val npmExecutable = file(nodeDir).listFiles()?.find { it.name.startsWith("npm") && it.isDirectory }?.let { "${it.absolutePath}/bin/npm" } ?: "$nodeDir/node_modules/npm/bin/npm" - commandLine(npmExecutable, "run", "build") + commandLine(npmExecutable, "run", "build:beta") } } } diff --git a/frontend/package.json b/frontend/package.json index eae7c8e..21157d6 100644 --- a/frontend/package.json +++ b/frontend/package.json @@ -6,7 +6,10 @@ "start": "ng serve", "build": "ng build", "watch": "ng build --watch --configuration development", - "test": "ng test" + "test": "ng test", + "build:beta": "ng build --configuration=beta", + "build:prod": "ng build --configuration=production", + "build:dev": "ng build --configuration=development" }, "private": true, "dependencies": { diff --git a/frontend/src/app/bans/history/history.component.ts b/frontend/src/app/bans/history/history.component.ts index c2d6a3d..0c01803 100644 --- a/frontend/src/app/bans/history/history.component.ts +++ b/frontend/src/app/bans/history/history.component.ts @@ -5,6 +5,7 @@ import {NgForOf, NgIf, NgOptimizedImage} from '@angular/common'; import {CookieService} from 'ngx-cookie-service'; import {RemoveTrailingPeriodPipe} from '../../util/RemoveTrailingPeriodPipe'; import {HttpErrorResponse} from '@angular/common/http'; +import {environment} from '../../../environments/environment'; @Component({ selector: 'app-history', @@ -18,7 +19,7 @@ import {HttpErrorResponse} from '@angular/common/http'; styleUrl: './history.component.scss', providers: [ CookieService, - {provide: BASE_PATH, useValue: 'http://localhost:8080/'} + {provide: BASE_PATH, useValue: environment.apiUrl} ], }) export class HistoryComponent implements OnInit, OnChanges { diff --git a/frontend/src/app/team/team.component.ts b/frontend/src/app/team/team.component.ts index 42de9e5..24af99d 100644 --- a/frontend/src/app/team/team.component.ts +++ b/frontend/src/app/team/team.component.ts @@ -5,6 +5,7 @@ import {CommonModule, NgOptimizedImage} from '@angular/common'; import {HeaderComponent} from '../header/header.component'; import {CookieService} from 'ngx-cookie-service'; import {map, Observable, shareReplay} from 'rxjs'; +import {environment} from '../../environments/environment'; @Component({ selector: 'app-team', @@ -16,7 +17,7 @@ import {map, Observable, shareReplay} from 'rxjs'; ], providers: [ CookieService, - {provide: BASE_PATH, useValue: 'http://localhost:8080/'} + {provide: BASE_PATH, useValue: environment.apiUrl} ], templateUrl: './team.component.html', diff --git a/frontend/src/environments/environment.beta.ts b/frontend/src/environments/environment.beta.ts new file mode 100644 index 0000000..b72b7d7 --- /dev/null +++ b/frontend/src/environments/environment.beta.ts @@ -0,0 +1,4 @@ +export const environment = { + production: true, + apiUrl: 'https://beta.alttd.com' +}; diff --git a/frontend/src/environments/environment.development.ts b/frontend/src/environments/environment.development.ts new file mode 100644 index 0000000..20608e6 --- /dev/null +++ b/frontend/src/environments/environment.development.ts @@ -0,0 +1,4 @@ +export const environment = { + production: false, + apiUrl: 'http://localhost:8080' +}; diff --git a/frontend/src/environments/environment.production.ts b/frontend/src/environments/environment.production.ts new file mode 100644 index 0000000..b1f3f30 --- /dev/null +++ b/frontend/src/environments/environment.production.ts @@ -0,0 +1,4 @@ +export const environment = { + production: true, + apiUrl: 'https://alttd.com' +}; diff --git a/frontend/src/environments/environment.ts b/frontend/src/environments/environment.ts new file mode 100644 index 0000000..b1f3f30 --- /dev/null +++ b/frontend/src/environments/environment.ts @@ -0,0 +1,4 @@ +export const environment = { + production: true, + apiUrl: 'https://alttd.com' +}; diff --git a/frontend/src/main.ts b/frontend/src/main.ts index e9474b0..e2955f9 100644 --- a/frontend/src/main.ts +++ b/frontend/src/main.ts @@ -4,13 +4,13 @@ import {provideRouter} from '@angular/router'; import {routes} from './app/app.routes'; import {provideHttpClient} from '@angular/common/http'; import {BASE_PATH} from './api'; - +import {environment} from './environments/environment'; bootstrapApplication(AppComponent, { providers: [ provideRouter(routes), provideHttpClient(), - {provide: BASE_PATH, useValue: 'http://localhost:8080'} + {provide: BASE_PATH, useValue: environment.apiUrl} ] }).catch(err => console.error(err));