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({
selector: 'msfa-root',
@@ -6,4 +8,8 @@ import { ChangeDetectionStrategy, Component } from '@angular/core';
styleUrls: ['./app.component.scss'],
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>
<dl class="footer__version" *ngIf="versionInfoVisible">
<dt>Aktuell version</dt>
<dd><markdown src="assets/VERSION.md"></markdown></dd>
<dd>{{version}}</dd>
</dl>
</div>
<nav class="footer__nav">

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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