diff --git a/Dockerfile b/Dockerfile index 7fc4ea57..97309dcb 100644 --- a/Dockerfile +++ b/Dockerfile @@ -4,7 +4,7 @@ WORKDIR /usr/src/fastenhealth/frontend COPY frontend/package.json ./ RUN yarn install --frozen-lockfile COPY frontend/ ./ -RUN yarn run build -- --output-path=../dist +RUN yarn run build -- --configuration sandbox --output-path=../dist FROM golang:1.18 as backend-build WORKDIR /go/src/github.com/fastenhealth/fastenhealth-onprem diff --git a/frontend/angular.json b/frontend/angular.json index eb4f111d..92c28a0f 100644 --- a/frontend/angular.json +++ b/frontend/angular.json @@ -47,7 +47,33 @@ "optimization": true, "outputHashing": "all", "sourceMap": false, - "extractCss": true, + "namedChunks": false, + "extractLicenses": true, + "vendorChunk": false, + "buildOptimizer": true, + "budgets": [ + { + "type": "initial", + "maximumWarning": "2mb", + "maximumError": "5mb" + }, + { + "type": "anyComponentStyle", + "maximumWarning": "6kb", + "maximumError": "10kb" + } + ] + }, + "sandbox": { + "fileReplacements": [ + { + "replace": "src/environments/environment.ts", + "with": "src/environments/environment.sandbox.ts" + } + ], + "optimization": true, + "outputHashing": "all", + "sourceMap": false, "namedChunks": false, "extractLicenses": true, "vendorChunk": false, @@ -65,6 +91,7 @@ } ] } + } }, "serve": { diff --git a/frontend/src/app/app.component.ts b/frontend/src/app/app.component.ts index b2c5d0e7..af5d173c 100644 --- a/frontend/src/app/app.component.ts +++ b/frontend/src/app/app.component.ts @@ -1,5 +1,5 @@ import { Component, OnInit } from '@angular/core'; -import {Router} from '@angular/router'; +import {NavigationEnd, Router} from '@angular/router'; @Component({ selector: 'app-root', @@ -10,7 +10,7 @@ export class AppComponent implements OnInit { title = 'fastenhealth'; public layoutOption: string; - showHeader:boolean = true; + showHeader:boolean = false; showFooter:boolean = true; constructor(private router: Router) {} @@ -28,8 +28,8 @@ export class AppComponent implements OnInit { this.router.events.subscribe(event => this.modifyHeader(event)); } - modifyHeader(location) { - if(location.url?.startsWith('/auth')) + modifyHeader(event) { + if(event instanceof NavigationEnd && event.url?.startsWith('/auth')) { this.showHeader = false; } else { diff --git a/frontend/src/environments/environment.sandbox.ts b/frontend/src/environments/environment.sandbox.ts new file mode 100644 index 00000000..33140eab --- /dev/null +++ b/frontend/src/environments/environment.sandbox.ts @@ -0,0 +1,17 @@ +// This file can be replaced during build by using the `fileReplacements` array. +// `ng build --prod` replaces `environment.ts` with `environment.prod.ts`. +// The list of file replacements can be found in `angular.json`. + +export const environment = { + production: true, + lighthouse_api_endpoint_base: 'https://lighthouse.fastenhealth.com/sandbox' +}; + +/* + * For easier debugging in development mode, you can import the following file + * to ignore zone related error stack frames such as `zone.run`, `zoneDelegate.invokeTask`. + * + * This import should be commented out in production mode because it will have a negative impact + * on performance if an error is thrown. + */ +// import 'zone.js/dist/zone-error'; // Included with Angular CLI.