From c3d313847a6fa8097e90485f391f8f132a8f6e1f Mon Sep 17 00:00:00 2001 From: cooder Date: Sun, 3 Mar 2024 11:39:19 +0800 Subject: [PATCH] feat(server): add show current version --- apps/server/src/main.ts | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/apps/server/src/main.ts b/apps/server/src/main.ts index f2b0703..2095980 100644 --- a/apps/server/src/main.ts +++ b/apps/server/src/main.ts @@ -5,7 +5,15 @@ import { ConfigService } from '@nestjs/config'; import { json, urlencoded } from 'express'; import { NestExpressApplication } from '@nestjs/platform-express'; import { ConfigurationType } from './configuration'; -import { join } from 'path'; +import { join, resolve } from 'path'; +import { readFileSync } from 'fs'; + +const packageJson = JSON.parse( + readFileSync(resolve(__dirname, '..', './package.json'), 'utf-8'), +); + +const appVersion = packageJson.version; +console.log('appVersion: v' + appVersion); async function bootstrap() { const app = await NestFactory.create(AppModule);