diff --git a/apps/client-asset-sg/docker/Dockerfile b/apps/client-asset-sg/docker/Dockerfile index f0d761f4..615c37cc 100644 --- a/apps/client-asset-sg/docker/Dockerfile +++ b/apps/client-asset-sg/docker/Dockerfile @@ -1,7 +1,6 @@ -ARG APP_VERSION - FROM node:20-alpine as app-builder +ARG APP_VERSION ENV APP_VERSION=${APP_VERSION} ENV CYPRESS_INSTALL_BINARY=0 @@ -11,12 +10,13 @@ WORKDIR /app COPY . . RUN npm install -RUN npm pkg set version=${APP_VERSION} +RUN sed -i ''s/0.0.0-local/${APP_VERSION}/g'' apps/client-asset-sg/src/assets/version.json RUN npx nx build client-asset-sg --configuration=production # final image build FROM nginx:mainline-alpine +ARG APP_VERSION ENV APP_VERSION=${APP_VERSION} WORKDIR /usr/share/nginx/html diff --git a/apps/client-asset-sg/src/app/components/app-bar/app-bar.component.scss b/apps/client-asset-sg/src/app/components/app-bar/app-bar.component.scss index a9c6212b..6ec9cda6 100644 --- a/apps/client-asset-sg/src/app/components/app-bar/app-bar.component.scss +++ b/apps/client-asset-sg/src/app/components/app-bar/app-bar.component.scss @@ -40,9 +40,6 @@ } .language-links { - flex: 1 1 auto; - display: flex; - justify-content: flex-end; margin-right: 24px; a { margin-left: 0.5rem; diff --git a/apps/client-asset-sg/src/app/components/app-bar/app-bar.component.ts b/apps/client-asset-sg/src/app/components/app-bar/app-bar.component.ts index 90c9d779..7c351c9d 100644 --- a/apps/client-asset-sg/src/app/components/app-bar/app-bar.component.ts +++ b/apps/client-asset-sg/src/app/components/app-bar/app-bar.component.ts @@ -1,4 +1,5 @@ import { ENTER } from '@angular/cdk/keycodes'; +import { HttpClient } from '@angular/common/http'; import { ChangeDetectionStrategy, Component, ElementRef, Input, OnInit, Output, ViewChild } from '@angular/core'; import { NavigationEnd, Router } from '@angular/router'; import { isTruthy } from '@asset-sg/core'; @@ -6,9 +7,9 @@ import { Lang } from '@asset-sg/shared'; import { UntilDestroy, untilDestroyed } from '@ngneat/until-destroy'; import { flow, pipe } from 'fp-ts/function'; import * as O from 'fp-ts/Option'; -import packageInfo from 'package.json'; import queryString from 'query-string'; import { EMPTY, Observable, Subject, debounceTime, filter, map, startWith, switchMap } from 'rxjs'; +import { Version } from './version'; @UntilDestroy() @Component({ @@ -26,7 +27,7 @@ export class AppBarComponent implements OnInit { public searchTextKeyDown$ = new Subject(); - public version = packageInfo.version; + public version = ''; public _currentLang$ = this._router.events.pipe( filter((e): e is NavigationEnd => e instanceof NavigationEnd), @@ -75,7 +76,8 @@ export class AppBarComponent implements OnInit { private _ngOnInit$ = new Subject(); - constructor(private _router: Router) { + constructor(private _router: Router, private readonly httpClient: HttpClient) { + this.httpClient.get('/assets/version.json').subscribe((v) => (this.version = v.version)); this.searchTextChanged = this.searchTextKeyDown$.pipe( filter((ev) => ev.keyCode === ENTER), map((ev) => { diff --git a/apps/client-asset-sg/src/app/components/app-bar/version.ts b/apps/client-asset-sg/src/app/components/app-bar/version.ts new file mode 100644 index 00000000..6fc04d39 --- /dev/null +++ b/apps/client-asset-sg/src/app/components/app-bar/version.ts @@ -0,0 +1,6 @@ +export interface Version { + tag: string; + build: string; + commit: string; + version: string; +} diff --git a/apps/client-asset-sg/src/assets/version.json b/apps/client-asset-sg/src/assets/version.json index 5ff3a5ca..dc061bbe 100644 --- a/apps/client-asset-sg/src/assets/version.json +++ b/apps/client-asset-sg/src/assets/version.json @@ -1,5 +1,6 @@ { "tag": "generated_by_build", "build": "generated_by_build", - "commit": "generated_by_build" + "commit": "generated_by_build", + "version": "0.0.0-local" } diff --git a/apps/client-asset-sg/tsconfig.json b/apps/client-asset-sg/tsconfig.json index 8dfb5ca5..e01cf19b 100644 --- a/apps/client-asset-sg/tsconfig.json +++ b/apps/client-asset-sg/tsconfig.json @@ -7,10 +7,7 @@ "noImplicitOverride": true, "noPropertyAccessFromIndexSignature": true, "noImplicitReturns": true, - "noFallthroughCasesInSwitch": true, - "resolveJsonModule": true, - "esModuleInterop": true, - "allowSyntheticDefaultImports": true + "noFallthroughCasesInSwitch": true }, "files": [], "include": [], diff --git a/libs/client-shared/src/lib/components/animate-number/animate-number.component.ts b/libs/client-shared/src/lib/components/animate-number/animate-number.component.ts index 5ab39a5c..5a918af3 100644 --- a/libs/client-shared/src/lib/components/animate-number/animate-number.component.ts +++ b/libs/client-shared/src/lib/components/animate-number/animate-number.component.ts @@ -1,7 +1,7 @@ import { NumberInput } from '@angular/cdk/coercion'; import { ChangeDetectionStrategy, Component, Input } from '@angular/core'; import { PushModule } from '@rx-angular/template/push'; -import bezier from 'bezier-easing'; +import * as bezier from 'bezier-easing'; import { BehaviorSubject, animationFrameScheduler, diff --git a/libs/client-shared/tsconfig.json b/libs/client-shared/tsconfig.json index 9981d7fc..92049739 100644 --- a/libs/client-shared/tsconfig.json +++ b/libs/client-shared/tsconfig.json @@ -7,10 +7,7 @@ "noImplicitOverride": true, "noPropertyAccessFromIndexSignature": true, "noImplicitReturns": true, - "noFallthroughCasesInSwitch": true, - "resolveJsonModule": true, - "esModuleInterop": true, - "allowSyntheticDefaultImports": true + "noFallthroughCasesInSwitch": true }, "files": [], "include": [],