From 5eb5d7a0bd44b99038a85eb222d10ba9367bd410 Mon Sep 17 00:00:00 2001 From: moonrailgun Date: Sun, 18 Sep 2022 00:13:32 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20health=20=E8=BF=94=E5=9B=9E=E5=BD=93?= =?UTF-8?q?=E5=89=8D=E4=BD=BF=E7=94=A8=E7=9A=84=E7=89=88=E6=9C=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Dockerfile | 2 +- client/web/build/webpack.config.ts | 5 +---- server/mixins/health.mixin.ts | 3 +++ 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Dockerfile b/Dockerfile index 4bbd0a6e..51f483aa 100644 --- a/Dockerfile +++ b/Dockerfile @@ -23,7 +23,7 @@ RUN pnpm install COPY . . RUN pnpm install -# Build and cleanup +# Build and cleanup (client and server) ENV NODE_ENV=production RUN pnpm run build diff --git a/client/web/build/webpack.config.ts b/client/web/build/webpack.config.ts index 8ed2e099..53b0597b 100644 --- a/client/web/build/webpack.config.ts +++ b/client/web/build/webpack.config.ts @@ -23,8 +23,6 @@ require('dotenv').config(); delete process.env.TS_NODE_PROJECT; // https://github.com/dividab/tsconfig-paths-webpack-plugin/issues/32 require('../../build/script/buildPublicTranslation.js'); // 编译前先执行一下构建翻译的脚本 -// eslint-disable-next-line @typescript-eslint/no-var-requires -const packageJson = require('../package.json'); const ROOT_PATH = path.resolve(__dirname, '../'); const DIST_PATH = path.resolve(ROOT_PATH, './dist'); @@ -48,8 +46,7 @@ const plugins: Configuration['plugins'] = [ 'process.env.NODE_ENV': JSON.stringify(NODE_ENV), 'process.env.SERVICE_URL': JSON.stringify(process.env.SERVICE_URL), 'process.env.VERSION': JSON.stringify( - process.env.VERSION || - `${packageJson.version}-${dayjs().format('YYYYMMDDHHmm')}` + process.env.VERSION || `nightly-${dayjs().format('YYYYMMDDHHmm')}` ), }), new HtmlWebpackPlugin({ diff --git a/server/mixins/health.mixin.ts b/server/mixins/health.mixin.ts index 1999d343..7640882a 100644 --- a/server/mixins/health.mixin.ts +++ b/server/mixins/health.mixin.ts @@ -1,3 +1,4 @@ +import moment from 'moment'; import type { PureContext, PureServiceSchema } from 'tailchat-server-sdk'; /** @@ -19,6 +20,8 @@ export const TcHealth = (): Partial => { services: services .filter((s) => s.available === true) .map((s) => s.fullName), + version: + process.env.VERSION || `nightly-${moment().format('YYYYMMDDHHmm')}`, }; }, },