Skip to content

Commit c94e5d0

Browse files
artlowelsamuelcambien
authored andcommitted
add startup message with version number
1 parent 59f9534 commit c94e5d0

File tree

5 files changed

+25
-5
lines changed

5 files changed

+25
-5
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "dspace-angular",
3-
"version": "0.0.0",
3+
"version": "7.4.0-next.0",
44
"scripts": {
55
"ng": "ng",
66
"config:watch": "nodemon",

server.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ import { ServerAppModule } from './src/main.server';
4848
import { buildAppConfig } from './src/config/config.server';
4949
import { APP_CONFIG, AppConfig } from './src/config/app-config.interface';
5050
import { extendEnvironmentWithAppConfig } from './src/config/config.util';
51+
import { logStartupMessage } from './startup-message';
5152

5253
/*
5354
* Set path for the browser application's dist folder
@@ -281,6 +282,8 @@ function run() {
281282
}
282283

283284
function start() {
285+
logStartupMessage(environment);
286+
284287
/*
285288
* If SSL is enabled
286289
* - Read credentials from configuration files

src/app/init.service.ts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -143,10 +143,6 @@ export abstract class InitService {
143143
if (environment.debug) {
144144
console.info(environment);
145145
}
146-
147-
const env: string = environment.production ? 'Production' : 'Development';
148-
const color: string = environment.production ? 'red' : 'green';
149-
console.info(`Environment: %c${env}`, `color: ${color}; font-weight: bold;`);
150146
}
151147

152148
/**

src/modules/app/browser-init.service.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ import { StoreAction, StoreActionTypes } from '../../app/store.actions';
2828
import { coreSelector } from '../../app/core/core.selectors';
2929
import { find, map } from 'rxjs/operators';
3030
import { isNotEmpty } from '../../app/shared/empty.util';
31+
import { logStartupMessage } from '../../../startup-message';
3132

3233
/**
3334
* Performs client-side initialization.
@@ -79,6 +80,7 @@ export class BrowserInitService extends InitService {
7980
this.initCorrelationId();
8081

8182
this.checkEnvironment();
83+
logStartupMessage(environment);
8284

8385
this.initI18n();
8486
this.initAngulartics();

startup-message.ts

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
import PACKAGE_JSON from './package.json';
2+
import { BuildConfig } from './src/config/build-config.interface';
3+
4+
/**
5+
* Log a message at the start of the application containing the version number and the environment.
6+
*
7+
* @param environment the environment configuration
8+
*/
9+
export const logStartupMessage = (environment: Partial<BuildConfig>) => {
10+
const env: string = environment.production ? 'Production' : 'Development';
11+
const color: string = environment.production ? 'red' : 'green';
12+
13+
console.info('');
14+
console.info(`%cdspace-angular`, `font-weight: bold;`);
15+
console.info(`Version: %c${PACKAGE_JSON.version}`, `font-weight: bold;`);
16+
console.info(`Environment: %c${env}`, `color: ${color}; font-weight: bold;`);
17+
console.info('');
18+
19+
}

0 commit comments

Comments
 (0)