add startup message with version number

This commit is contained in:
Art Lowel
2022-09-08 13:53:02 +02:00
committed by Samuel Cambien
parent 59f9534418
commit c94e5d0709
5 changed files with 25 additions and 5 deletions

View File

@@ -1,6 +1,6 @@
{
"name": "dspace-angular",
"version": "0.0.0",
"version": "7.4.0-next.0",
"scripts": {
"ng": "ng",
"config:watch": "nodemon",

View File

@@ -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

View File

@@ -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;`);
}
/**

View File

@@ -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();

19
startup-message.ts Normal file
View File

@@ -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<BuildConfig>) => {
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('');
}