From c94e5d0709fb3d2242635291412962817feefcd5 Mon Sep 17 00:00:00 2001 From: Art Lowel Date: Thu, 8 Sep 2022 13:53:02 +0200 Subject: [PATCH] add startup message with version number --- package.json | 2 +- server.ts | 3 +++ src/app/init.service.ts | 4 ---- src/modules/app/browser-init.service.ts | 2 ++ startup-message.ts | 19 +++++++++++++++++++ 5 files changed, 25 insertions(+), 5 deletions(-) create mode 100644 startup-message.ts diff --git a/package.json b/package.json index 82784adff1..f2af8b73e1 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "dspace-angular", - "version": "0.0.0", + "version": "7.4.0-next.0", "scripts": { "ng": "ng", "config:watch": "nodemon", diff --git a/server.ts b/server.ts index 9fe03fe5b5..c9cdf3d76a 100644 --- a/server.ts +++ b/server.ts @@ -48,6 +48,7 @@ import { ServerAppModule } from './src/main.server'; import { buildAppConfig } from './src/config/config.server'; import { APP_CONFIG, AppConfig } from './src/config/app-config.interface'; import { extendEnvironmentWithAppConfig } from './src/config/config.util'; +import { logStartupMessage } from './startup-message'; /* * Set path for the browser application's dist folder @@ -281,6 +282,8 @@ function run() { } function start() { + logStartupMessage(environment); + /* * If SSL is enabled * - Read credentials from configuration files diff --git a/src/app/init.service.ts b/src/app/init.service.ts index 69ed2ad555..a0cbb06b66 100644 --- a/src/app/init.service.ts +++ b/src/app/init.service.ts @@ -143,10 +143,6 @@ export abstract class InitService { if (environment.debug) { console.info(environment); } - - const env: string = environment.production ? 'Production' : 'Development'; - const color: string = environment.production ? 'red' : 'green'; - console.info(`Environment: %c${env}`, `color: ${color}; font-weight: bold;`); } /** diff --git a/src/modules/app/browser-init.service.ts b/src/modules/app/browser-init.service.ts index 05c591b0c6..1135de5e93 100644 --- a/src/modules/app/browser-init.service.ts +++ b/src/modules/app/browser-init.service.ts @@ -28,6 +28,7 @@ import { StoreAction, StoreActionTypes } from '../../app/store.actions'; import { coreSelector } from '../../app/core/core.selectors'; import { find, map } from 'rxjs/operators'; import { isNotEmpty } from '../../app/shared/empty.util'; +import { logStartupMessage } from '../../../startup-message'; /** * Performs client-side initialization. @@ -79,6 +80,7 @@ export class BrowserInitService extends InitService { this.initCorrelationId(); this.checkEnvironment(); + logStartupMessage(environment); this.initI18n(); this.initAngulartics(); diff --git a/startup-message.ts b/startup-message.ts new file mode 100644 index 0000000000..d87a239ec8 --- /dev/null +++ b/startup-message.ts @@ -0,0 +1,19 @@ +import PACKAGE_JSON from './package.json'; +import { BuildConfig } from './src/config/build-config.interface'; + +/** + * Log a message at the start of the application containing the version number and the environment. + * + * @param environment the environment configuration + */ +export const logStartupMessage = (environment: Partial) => { + const env: string = environment.production ? 'Production' : 'Development'; + const color: string = environment.production ? 'red' : 'green'; + + console.info(''); + console.info(`%cdspace-angular`, `font-weight: bold;`); + console.info(`Version: %c${PACKAGE_JSON.version}`, `font-weight: bold;`); + console.info(`Environment: %c${env}`, `color: ${color}; font-weight: bold;`); + console.info(''); + +}