Merge pull request #92 in TEA/mina-sidor-fa-web from feature/version-number to develop

Squashed commit of the following:

commit 2b0f98a4151d3afddd6e717cf3495dd4f78fb79e
Author: Erik Tiekstra <erik.tiekstra@arbetsformedlingen.se>
Date:   Tue Sep 14 15:56:22 2021 +0200

    Removed unused files

commit 0c308eea737b181bb56628c964d6a15f8f142712
Author: Erik Tiekstra <erik.tiekstra@arbetsformedlingen.se>
Date:   Tue Sep 14 15:52:34 2021 +0200

    Implemented version number so it is saved in environments file upon build
This commit is contained in:
Erik Tiekstra
2021-09-14 15:57:12 +02:00
parent 52cd7ad6f4
commit ca8160f571
11 changed files with 30 additions and 25 deletions

View File

@@ -1,4 +1,6 @@
import { ChangeDetectionStrategy, Component } from '@angular/core'; import { DOCUMENT } from '@angular/common';
import { ChangeDetectionStrategy, Component, Inject } from '@angular/core';
import { environment } from '@msfa-environment';
@Component({ @Component({
selector: 'msfa-root', selector: 'msfa-root',
@@ -6,4 +8,8 @@ import { ChangeDetectionStrategy, Component } from '@angular/core';
styleUrls: ['./app.component.scss'], styleUrls: ['./app.component.scss'],
changeDetection: ChangeDetectionStrategy.OnPush, changeDetection: ChangeDetectionStrategy.OnPush,
}) })
export class AppComponent {} export class AppComponent {
constructor(@Inject(DOCUMENT) private document: Document) {
this.document.body.dataset.version = environment.version;
}
}

View File

@@ -3,7 +3,7 @@
<digi-logo af-color="secondary"></digi-logo> <digi-logo af-color="secondary"></digi-logo>
<dl class="footer__version" *ngIf="versionInfoVisible"> <dl class="footer__version" *ngIf="versionInfoVisible">
<dt>Aktuell version</dt> <dt>Aktuell version</dt>
<dd><markdown src="assets/VERSION.md"></markdown></dd> <dd>{{version}}</dd>
</dl> </dl>
</div> </div>
<nav class="footer__nav"> <nav class="footer__nav">

View File

@@ -10,9 +10,10 @@ import { environment } from '@msfa-environment';
}) })
export class FooterComponent { export class FooterComponent {
activeFeatures: Feature[] = environment.activeFeatures; activeFeatures: Feature[] = environment.activeFeatures;
version: string = environment.version;
get versionInfoVisible(): boolean { get versionInfoVisible(): boolean {
return this.activeFeatures.includes(Feature.VERSION_INFO); return this.version && this.activeFeatures.includes(Feature.VERSION_INFO);
} }
get releasesVisible(): boolean { get releasesVisible(): boolean {
return this.activeFeatures.includes(Feature.RELEASES); return this.activeFeatures.includes(Feature.RELEASES);

View File

@@ -1,13 +1,12 @@
import { CommonModule } from '@angular/common'; import { CommonModule } from '@angular/common';
import { CUSTOM_ELEMENTS_SCHEMA, NgModule } from '@angular/core'; import { CUSTOM_ELEMENTS_SCHEMA, NgModule } from '@angular/core';
import { RouterModule } from '@angular/router'; import { RouterModule } from '@angular/router';
import { MarkdownModule } from 'ngx-markdown';
import { FooterComponent } from './footer.component'; import { FooterComponent } from './footer.component';
@NgModule({ @NgModule({
schemas: [CUSTOM_ELEMENTS_SCHEMA], schemas: [CUSTOM_ELEMENTS_SCHEMA],
declarations: [FooterComponent], declarations: [FooterComponent],
imports: [CommonModule, MarkdownModule.forChild(), RouterModule], imports: [CommonModule, RouterModule],
exports: [FooterComponent], exports: [FooterComponent],
}) })
export class FooterModule {} export class FooterModule {}

View File

@@ -2,6 +2,7 @@ import { Feature } from '@msfa-enums/feature.enum';
export interface Environment { export interface Environment {
environment: 'api' | 'local' | 'acc' | 'prod'; environment: 'api' | 'local' | 'acc' | 'prod';
version?: string;
clientId: string; clientId: string;
loginUrl: string; loginUrl: string;
logoutUrl: string; logoutUrl: string;

View File

@@ -4,6 +4,7 @@ import { CIAM_TEST } from './ciam';
export const environment: Environment = { export const environment: Environment = {
environment: 'acc', environment: 'acc',
version: 'acc',
production: true, production: true,
api: { api: {
url: '/api', url: '/api',

View File

@@ -4,6 +4,7 @@ import { CIAM_TEST } from './ciam';
export const environment: Environment = { export const environment: Environment = {
environment: 'api', environment: 'api',
version: 'api',
production: false, production: false,
api: { api: {
url: '/api', url: '/api',

View File

@@ -4,6 +4,7 @@ import { CIAM_PROD } from './ciam';
export const environment: Environment = { export const environment: Environment = {
environment: 'prod', environment: 'prod',
version: 'prod',
production: true, production: true,
api: { api: {
url: '/api', url: '/api',

View File

@@ -5,6 +5,7 @@ import { CIAM_MOCK } from './ciam';
export const environment: Environment = { export const environment: Environment = {
environment: 'local', environment: 'local',
version: 'local',
production: false, production: false,
api: { api: {
url: '/api', url: '/api',

View File

@@ -14,11 +14,7 @@ ORANGE='\033[0;33m'
CYAN='\033[0;36m' CYAN='\033[0;36m'
YELLOW='\033[1;33m' YELLOW='\033[1;33m'
BRANCH=$(git rev-parse --abbrev-ref HEAD) BRANCH=$(git rev-parse --abbrev-ref HEAD)
version=${version:-$BRANCH}
config=${config:-prod}
while [ $# -gt 0 ]; do while [ $# -gt 0 ]; do
@@ -31,20 +27,19 @@ while [ $# -gt 0 ]; do
shift shift
done done
config=${config:-prod}
version=${version:-$config}
# ---------------------------------- # ----------------------------------
# UPDATING VERSION # UPDATING VERSION
# ---------------------------------- # ----------------------------------
echo -e "${CYAN}Setting VERSION to ${version} inside assets directory${NOCOLOR}" echo -e "${CYAN}Setting version to ${version} inside environments.${config}.ts${NOCOLOR}"
rm -f apps/mina-sidor-fa/src/assets/VERSION.md sed "s/version:.*',/version: '${version}',/" apps/mina-sidor-fa/src/environments/environment.$config.ts > temp.txt && mv temp.txt apps/mina-sidor-fa/src/environments/environment.$config.ts
touch apps/mina-sidor-fa/src/assets/VERSION.md echo -e "${GREEN}Version set to ${version}${NOCOLOR}"
echo $version > apps/mina-sidor-fa/src/assets/VERSION.md
echo -e "${GREEN}VERSION set to ${version}${NOCOLOR}"
# ---------------------------------- # ----------------------------------
# BUILD APPLICATION # BUILD APPLICATION
# ---------------------------------- # ----------------------------------
if [ $config = "prod" ]; then if [ $config = "prod" ]; then
echo -e "${CYAN}Running npm run build -- --prod${NOCOLOR}" echo -e "${CYAN}Running npm run build -- --prod${NOCOLOR}"
npm run build -- --prod npm run build -- --prod

View File

@@ -14,10 +14,7 @@ ORANGE='\033[0;33m'
CYAN='\033[0;36m' CYAN='\033[0;36m'
YELLOW='\033[1;33m' YELLOW='\033[1;33m'
BRANCH=$(git rev-parse --abbrev-ref HEAD) BRANCH=$(git rev-parse --abbrev-ref HEAD)
version=${version:-$BRANCH}
config=${config:-prod}
while [ $# -gt 0 ]; do while [ $# -gt 0 ]; do
@@ -30,14 +27,16 @@ while [ $# -gt 0 ]; do
shift shift
done done
config=${config:-prod}
version=${version:-$config}
# ---------------------------------- # ----------------------------------
# UPDATING VERSION # UPDATING VERSION
# ---------------------------------- # ----------------------------------
echo -e "${CYAN}Setting VERSION to ${version} inside assets directory${NOCOLOR}" echo -e "${CYAN}Setting version to ${version} inside environments.${config}.ts${NOCOLOR}"
rm -f apps/mina-sidor-fa/src/assets/VERSION.md sed "s/version:.*',/version: '${version}',/" apps/mina-sidor-fa/src/environments/environment.$config.ts > temp.txt && mv temp.txt apps/mina-sidor-fa/src/environments/environment.$config.ts
touch apps/mina-sidor-fa/src/assets/VERSION.md echo -e "${GREEN}Version set to ${version}${NOCOLOR}"
echo $version > apps/mina-sidor-fa/src/assets/VERSION.md
echo -e "${GREEN}VERSION set to ${version}${NOCOLOR}"
# ---------------------------------- # ----------------------------------
# BUILD APPLICATION # BUILD APPLICATION