From d5ca2cc52e2b99dea3dbafa97d449a7a3688c783 Mon Sep 17 00:00:00 2001 From: waiting <1661926154@qq.com> Date: Mon, 22 Jan 2024 18:49:48 +0800 Subject: [PATCH 1/7] chore: update config --- .githooks/commit-msg | 6 ++++-- .githooks/pre-commit.sample | 8 +++++--- .githooks/pre-push.sample | 7 ++++--- .github/workflows/benchmark.yml.example | 6 +++--- .github/workflows/nodejs-win.yml | 6 +++--- .github/workflows/nodejs.yml | 6 +++--- .github/workflows/npm-manual-publish.yml | 6 +++--- .github/workflows/npm-publish-wo-test.yml | 6 +++--- .vscode/settings.json | 2 +- package.json | 5 +++-- 10 files changed, 32 insertions(+), 26 deletions(-) diff --git a/.githooks/commit-msg b/.githooks/commit-msg index 4251521e..31246f91 100755 --- a/.githooks/commit-msg +++ b/.githooks/commit-msg @@ -6,8 +6,10 @@ # Date: 2023.07.21 # -if [[ -f $HOME/.nvm/nvm.sh ]]; then - . $HOME/.nvm/nvm.sh +if [[ -z $NVM_DIR ]]; then + if [[ -f $HOME/.nvm/nvm.sh ]]; then + . $HOME/.nvm/nvm.sh + fi fi branch=$( git branch | grep \* | cut -d ' ' -f2 ) diff --git a/.githooks/pre-commit.sample b/.githooks/pre-commit.sample index 323b36af..a68f4bf5 100755 --- a/.githooks/pre-commit.sample +++ b/.githooks/pre-commit.sample @@ -8,8 +8,10 @@ # Date: 2017.02.09 # -if [[ -f $HOME/.nvm/nvm.sh ]]; then - . $HOME/.nvm/nvm.sh +if [[ -z $NVM_DIR ]]; then + if [[ -f $HOME/.nvm/nvm.sh ]]; then + . $HOME/.nvm/nvm.sh + fi fi if git rev-parse --verify HEAD >/dev/null 2>&1 @@ -28,7 +30,7 @@ fi # ------------- parse ts files=$(git diff --cached --name-only --diff-filter=ACMR $against|grep '\.ts$') if [[ $files != "" ]] ; then - # echo $files | xargs eslint --fix + # echo $files | xargs eslint --fix npm run lint rc=$? if [[ $rc != 0 ]] ; then diff --git a/.githooks/pre-push.sample b/.githooks/pre-push.sample index 1ccb92a6..2545298f 100755 --- a/.githooks/pre-push.sample +++ b/.githooks/pre-push.sample @@ -10,9 +10,10 @@ remote="$1" url="$2" - -if [[ -f $HOME/.nvm/nvm.sh ]]; then - . $HOME/.nvm/nvm.sh +if [[ -z $NVM_DIR ]]; then + if [[ -f $HOME/.nvm/nvm.sh ]]; then + . $HOME/.nvm/nvm.sh + fi fi z40=0000000000000000000000000000000000000000 diff --git a/.github/workflows/benchmark.yml.example b/.github/workflows/benchmark.yml.example index 89234357..0ff61021 100644 --- a/.github/workflows/benchmark.yml.example +++ b/.github/workflows/benchmark.yml.example @@ -20,14 +20,14 @@ jobs: os: [ubuntu-latest] steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Use Node.js ${{ matrix.node }} - uses: actions/setup-node@v3 + uses: actions/setup-node@v4 with: node-version: ${{ matrix.node }} - name: Cache - uses: actions/cache@v3 + uses: actions/cache@v4 id: cache-lerna env: cache-name: cache-lerna diff --git a/.github/workflows/nodejs-win.yml b/.github/workflows/nodejs-win.yml index 6abb0350..31a09c33 100644 --- a/.github/workflows/nodejs-win.yml +++ b/.github/workflows/nodejs-win.yml @@ -17,14 +17,14 @@ jobs: os: [windows-latest] steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Use Node.js ${{ matrix.node }} - uses: actions/setup-node@v3 + uses: actions/setup-node@v4 with: node-version: ${{ matrix.node }} - name: Cache - uses: actions/cache@v3 + uses: actions/cache@v4 id: cache-lerna-win env: cache-name: cache-lerna-win diff --git a/.github/workflows/nodejs.yml b/.github/workflows/nodejs.yml index 07e91809..1f91f432 100644 --- a/.github/workflows/nodejs.yml +++ b/.github/workflows/nodejs.yml @@ -17,14 +17,14 @@ jobs: os: [ubuntu-latest] steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Use Node.js ${{ matrix.node }} - uses: actions/setup-node@v3 + uses: actions/setup-node@v4 with: node-version: ${{ matrix.node }} - name: Cache - uses: actions/cache@v3 + uses: actions/cache@v4 id: cache-lerna env: cache-name: cache-lerna diff --git a/.github/workflows/npm-manual-publish.yml b/.github/workflows/npm-manual-publish.yml index d5db61b1..69242780 100644 --- a/.github/workflows/npm-manual-publish.yml +++ b/.github/workflows/npm-manual-publish.yml @@ -22,7 +22,7 @@ jobs: os: [ubuntu-latest] steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 with: # pulls all commits (needed for lerna / semantic release to correctly version) fetch-depth: "0" @@ -34,13 +34,13 @@ jobs: git config --global --add safe.directory $cwd git fetch --depth=1 origin +refs/tags/*:refs/tags/* - name: Use Node.js ${{ matrix.node }} - uses: actions/setup-node@v3 + uses: actions/setup-node@v4 with: node-version: ${{ matrix.node }} registry-url: 'https://registry.npmjs.org' - name: Cache - uses: actions/cache@v3 + uses: actions/cache@v4 id: cache-lerna env: cache-name: cache-lerna diff --git a/.github/workflows/npm-publish-wo-test.yml b/.github/workflows/npm-publish-wo-test.yml index 3bdffc2b..355267bb 100644 --- a/.github/workflows/npm-publish-wo-test.yml +++ b/.github/workflows/npm-publish-wo-test.yml @@ -22,7 +22,7 @@ jobs: os: [ubuntu-latest] steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 with: # pulls all commits (needed for lerna / semantic release to correctly version) fetch-depth: "0" @@ -34,13 +34,13 @@ jobs: git config --global --add safe.directory $cwd git fetch --depth=1 origin +refs/tags/*:refs/tags/* - name: Use Node.js ${{ matrix.node }} - uses: actions/setup-node@v3 + uses: actions/setup-node@v4 with: node-version: ${{ matrix.node }} registry-url: 'https://registry.npmjs.org' - name: Cache - uses: actions/cache@v3 + uses: actions/cache@v4 id: cache-lerna env: cache-name: cache-lerna diff --git a/.vscode/settings.json b/.vscode/settings.json index 6a558476..e001b3c8 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -7,7 +7,7 @@ "editor.tabSize": 2, "editor.wordWrap": "on", "editor.codeActionsOnSave": { - "source.fixAll.eslint": true + "source.fixAll.eslint": "explicit" }, "eslint.run": "onSave", "eslint.validate": [ diff --git a/package.json b/package.json index 789cb798..e7201119 100644 --- a/package.json +++ b/package.json @@ -11,7 +11,7 @@ "@midwayjs/swagger": "^3.14.0", "@types/koa": "2", "@types/mocha": "10", - "@types/node": "20", + "@types/node": "20.11", "@waiting/eslint-config": "^9.1.1", "@waiting/shared-core": "^23.0.0", "@waiting/shared-types": "^23.0.0", @@ -24,7 +24,7 @@ "madge": "^6.1.0", "mocha": "10", "mocha-lcov-reporter": "1", - "mwtsc": "^1.4.0", + "mwtsc": "^1.5.1", "nx": "17", "ts-node": "^10.9.2", "tsc-alias": "^1.8.8", @@ -43,6 +43,7 @@ "add:pkg": "sh .scripts/add-pkg.sh", "bp:add": "git remote add bp https://github.com/waitingsong/npm-mono-base", "bp:sync": "git fetch --all -v && git pull origin && git merge bp/main -m \"Merge remote-tracking branch 'bp/main'\" ", + "bp:sync-force": "git fetch --all -v && git pull origin && git merge bp/main --allow-unrelated-histories -m \"Merge remote-tracking branch 'bp/main'\" ", "bp:syncxo": "git fetch --all -v && git pull origin && git merge bp/main -m \"Merge remote-tracking branch 'bp/main'\" -Xours", "bootstrap": "npm i --loglevel info --disturl=https://npmmirror.com/dist/", "build": "sh .scripts/build.sh", From de1c148aeba2247ca9710411c7dedac582d914a7 Mon Sep 17 00:00:00 2001 From: waiting <1661926154@qq.com> Date: Fri, 26 Jan 2024 21:10:51 +0800 Subject: [PATCH 2/7] chore: add devDeps --- package.json | 2 ++ 1 file changed, 2 insertions(+) diff --git a/package.json b/package.json index e7201119..26ef56f4 100644 --- a/package.json +++ b/package.json @@ -9,6 +9,7 @@ "@commitlint/config-conventional": "18", "@midwayjs/mock": "^3.14.0", "@midwayjs/swagger": "^3.14.0", + "@midwayjs/validate": "^3.14.0", "@types/koa": "2", "@types/mocha": "10", "@types/node": "20.11", @@ -26,6 +27,7 @@ "mocha-lcov-reporter": "1", "mwtsc": "^1.5.1", "nx": "17", + "swagger-ui-dist": "^5.11.0", "ts-node": "^10.9.2", "tsc-alias": "^1.8.8", "tsconfig-paths": "4", From 649df7c78571a647a197633c2f3a1722e0511684 Mon Sep 17 00:00:00 2001 From: waiting <1661926154@qq.com> Date: Sat, 27 Jan 2024 11:11:13 +0800 Subject: [PATCH 3/7] chore(boilerplate): update mw-demo --- packages/mw-demo/.eslintrc.yml | 1 + packages/mw-demo/README.md | 15 ++++++++++- packages/mw-demo/package.json | 1 + .../mw-demo/src/app/default.controller.ts | 23 +++++++++-------- packages/mw-demo/src/app/default.types.ts | 7 ++++++ packages/mw-demo/src/configuration.ts | 25 +++++++++++++------ packages/mw-demo/src/imports.ts | 12 ++++++--- 7 files changed, 61 insertions(+), 23 deletions(-) create mode 100644 packages/mw-demo/src/app/default.types.ts diff --git a/packages/mw-demo/.eslintrc.yml b/packages/mw-demo/.eslintrc.yml index 3d2c0935..cda1a4a8 100644 --- a/packages/mw-demo/.eslintrc.yml +++ b/packages/mw-demo/.eslintrc.yml @@ -5,6 +5,7 @@ parserOptions: rules: "@typescript-eslint/no-unused-vars": 0 "@typescript-eslint/prefer-ts-expect-error": 0 + "@typescript-eslint/no-extraneous-class": 0 "import/no-extraneous-dependencies": - 2 - packageDir: diff --git a/packages/mw-demo/README.md b/packages/mw-demo/README.md index a14830d7..8d568134 100644 --- a/packages/mw-demo/README.md +++ b/packages/mw-demo/README.md @@ -20,11 +20,21 @@ import { ILifeCycle } from '@midwayjs/core' import { Configuration } from '@midwayjs/decorator' import * as demo from '@mw-components/demo' +import * as DefaultConfig from './config/config.default.js' +import * as LocalConfig from './config/config.local.js' +import * as UnittestConfig from './config/config.unittest.js' + @Configuration({ + importConfigs: [ + { + default: DefaultConfig, + local: LocalConfig, + unittest: UnittestConfig, + }, + ], imports: [ demo, ], - importConfigs: [join(__dirname, 'config')], }) export class ContainerConfiguration implements ILifeCycle { } @@ -32,6 +42,9 @@ export class ContainerConfiguration implements ILifeCycle { } ### Add Configurations +### Swagger API +- start `npm run build && npm run dev` +- open `http://localhost:7001/swagger-ui/index.html` in browser ## License [MIT](LICENSE) diff --git a/packages/mw-demo/package.json b/packages/mw-demo/package.json index 25556033..17c4edb0 100644 --- a/packages/mw-demo/package.json +++ b/packages/mw-demo/package.json @@ -51,6 +51,7 @@ "bin", "database", "dist", + "src", "!**/*.spec.*", "!**/*.tsbuildinfo" ], diff --git a/packages/mw-demo/src/app/default.controller.ts b/packages/mw-demo/src/app/default.controller.ts index a587d89e..a38ee1c3 100644 --- a/packages/mw-demo/src/app/default.controller.ts +++ b/packages/mw-demo/src/app/default.controller.ts @@ -3,26 +3,27 @@ import { Controller, Get, } from '@midwayjs/core' +import { ApiResponse } from '@midwayjs/swagger' + +import { DefaultApi } from './default.types.js' import { Config, ConfigKey, Msg } from '##/lib/types.js' -@Controller(`/_${ConfigKey.namespace}`) +@Controller(DefaultApi.base) export class DefaultComponentController { - @_Config(ConfigKey.config) readonly config: Config + @_Config(ConfigKey.config) private readonly config: Config - @Get('/hello') - hello(): string { - this.valiateRoute() + @Get(DefaultApi.hello) + @ApiResponse({ + type: 'string', + description: Msg.hello, + }) + async hello(): Promise { + void this.config return Msg.hello } - valiateRoute(): void { - if (! this.config.enableDefaultRoute) { - throw new Error('route is not enabled') - } - } - } diff --git a/packages/mw-demo/src/app/default.types.ts b/packages/mw-demo/src/app/default.types.ts new file mode 100644 index 00000000..5ac43dc7 --- /dev/null +++ b/packages/mw-demo/src/app/default.types.ts @@ -0,0 +1,7 @@ +import { ConfigKey } from '##/lib/types.js' + + +export class DefaultApi { + static readonly base = `/_${ConfigKey.namespace}` + static readonly hello = '/hello' +} diff --git a/packages/mw-demo/src/configuration.ts b/packages/mw-demo/src/configuration.ts index 8bcee5ec..9d48344f 100644 --- a/packages/mw-demo/src/configuration.ts +++ b/packages/mw-demo/src/configuration.ts @@ -5,20 +5,22 @@ import { App, Config, Configuration, - MidwayEnvironmentService, - MidwayInformationService, ILifeCycle, ILogger, Inject, Logger, + MidwayEnvironmentService, + MidwayInformationService, + MidwayWebRouterService, } from '@midwayjs/core' import { Application, IMidwayContainer, registerMiddleware, + deleteRouter, } from '@mwcp/share' -import * as DefulatConfig from './config/config.default.js' +import * as DefaultConfig from './config/config.default.js' import * as LocalConfig from './config/config.local.js' import * as UnittestConfig from './config/config.unittest.js' import { useComponents } from './imports.js' @@ -34,7 +36,7 @@ import { DemoMiddleware } from './middleware/index.middleware.js' namespace: ConfigKey.namespace, importConfigs: [ { - default: DefulatConfig, + default: DefaultConfig, local: LocalConfig, unittest: UnittestConfig, }, @@ -47,11 +49,22 @@ export class AutoConfiguration implements ILifeCycle { @Inject() protected readonly environmentService: MidwayEnvironmentService @Inject() protected readonly informationService: MidwayInformationService + @Inject() protected readonly webRouterService: MidwayWebRouterService + @Logger() protected readonly logger: ILogger @Config(ConfigKey.config) protected readonly config: Conf @Config(ConfigKey.middlewareConfig) protected readonly mwConfig: MiddlewareConfig + async onConfigLoad(): Promise { + if (! this.config.enableDefaultRoute) { + await deleteRouter(`/_${ConfigKey.namespace}`, this.webRouterService) + } + else if (this.mwConfig.ignore) { + this.mwConfig.ignore.push(new RegExp(`/_${ConfigKey.namespace}/.+`, 'u')) + } + } + async onReady(container: IMidwayContainer): Promise { void container assert( @@ -59,10 +72,6 @@ export class AutoConfiguration implements ILifeCycle { 'this.app undefined. If start for development, please set env first like `export MIDWAY_SERVER_ENV=local`', ) - if (this.config.enableDefaultRoute && this.mwConfig.ignore) { - this.mwConfig.ignore.push(new RegExp(`/_${ConfigKey.namespace}/.+`, 'u')) - } - const isDevelopmentEnvironment = this.environmentService.isDevelopmentEnvironment() const { enableMiddleware } = this.mwConfig diff --git a/packages/mw-demo/src/imports.ts b/packages/mw-demo/src/imports.ts index c71038c3..1addb811 100644 --- a/packages/mw-demo/src/imports.ts +++ b/packages/mw-demo/src/imports.ts @@ -1,5 +1,6 @@ import * as info from '@midwayjs/info' import * as koa from '@midwayjs/koa' +import * as swagger from '@midwayjs/swagger' /* c8 ignore next 4 */ @@ -10,9 +11,14 @@ const CI = !! (process.env['MIDWAY_SERVER_ENV'] === 'unittest' ) export const useComponents: IComponentInfo[] = [] -if (CI && ! useComponents.includes(koa)) { - useComponents.push(koa) - useComponents.push(info) +if (CI) { + if ( ! useComponents.includes(koa)) { + useComponents.push(koa) + useComponents.push(info) + } + if ( ! useComponents.includes(swagger)) { + useComponents.push(swagger) + } } export interface IComponentInfo { From 582101c690c79ab054596c52d3fd1074480c2a07 Mon Sep 17 00:00:00 2001 From: waiting <1661926154@qq.com> Date: Sat, 27 Jan 2024 18:31:00 +0800 Subject: [PATCH 4/7] chore(boilerplate): update --- .eslintrc.yml | 1 + .scripts/set-env-local.sh.example | 23 +++++++++++++++++++++++ .scripts/set-env-test.sh.example | 23 +++++++++++++++++++++++ .vscode/launch.json.example | 1 - packages/mw-demo/package.json | 4 ++-- packages/mw-demo/src/configuration.ts | 2 ++ packages/mw-demo/src/imports.ts | 13 +++++-------- 7 files changed, 56 insertions(+), 11 deletions(-) create mode 100755 .scripts/set-env-local.sh.example create mode 100755 .scripts/set-env-test.sh.example diff --git a/.eslintrc.yml b/.eslintrc.yml index 6199b7a6..7defee45 100644 --- a/.eslintrc.yml +++ b/.eslintrc.yml @@ -11,5 +11,6 @@ rules: "@typescript-eslint/no-unused-vars": 0 "node/no-unpublished-import": 0 "@typescript-eslint/prefer-ts-expect-error": 0 + "@typescript-eslint/no-extraneous-class": 0 "unicorn/filename-case": 0 diff --git a/.scripts/set-env-local.sh.example b/.scripts/set-env-local.sh.example new file mode 100755 index 00000000..5bb0e92d --- /dev/null +++ b/.scripts/set-env-local.sh.example @@ -0,0 +1,23 @@ +#!/bin/bash + + +export MIDWAY_SERVER_ENV=local +export NODE_ENV=local +export OTEL_EXPORTER_OTLP_ENDPOINT="http://127.0.0.1:4317" +export TS_NODE_PROJECT="test/tsconfig.json" +export POSTGRES_HOST="127.0.0.1" +export POSTGRES_PORT="5432" +export POSTGRES_DB="" +export POSTGRES_USER="postgres" +export POSTGRES_PASSWORD="postgres" +export ALI_ALB_IPS="120.55" +export ALI_ALB_GROUPID="sgp-7z" +export ALI_ECS_AID="LTAI5" +export ALI_ECS_ASECRET="Dr" +export ALI_ECS_IDS="" +export ALI_ECS_IPS="" +export ALI_OSS_AID="LTAI4" +export ALI_OSS_ASECRET="FRK" +export ALI_OSS_ENDPOINT="https://oss-cn-hangzhou.aliyuncs.com" +export ALI_OSS_BUCKET="" + diff --git a/.scripts/set-env-test.sh.example b/.scripts/set-env-test.sh.example new file mode 100755 index 00000000..a03a38ae --- /dev/null +++ b/.scripts/set-env-test.sh.example @@ -0,0 +1,23 @@ +#!/bin/bash + + +export MIDWAY_SERVER_ENV=unittest +export NODE_ENV=unittest +export OTEL_EXPORTER_OTLP_ENDPOINT="http://127.0.0.1:4317" +export TS_NODE_PROJECT="test/tsconfig.json" +export POSTGRES_HOST="127.0.0.1" +export POSTGRES_PORT="5432" +export POSTGRES_DB="" +export POSTGRES_USER="postgres" +export POSTGRES_PASSWORD="postgres" +export ALI_ALB_IPS="120.55" +export ALI_ALB_GROUPID="sgp-7z" +export ALI_ECS_AID="LTAI5" +export ALI_ECS_ASECRET="Dr" +export ALI_ECS_IDS="" +export ALI_ECS_IPS="" +export ALI_OSS_AID="LTAI4" +export ALI_OSS_ASECRET="FRK" +export ALI_OSS_ENDPOINT="https://oss-cn-hangzhou.aliyuncs.com" +export ALI_OSS_BUCKET="" + diff --git a/.vscode/launch.json.example b/.vscode/launch.json.example index 78dd7378..bbd15c5d 100644 --- a/.vscode/launch.json.example +++ b/.vscode/launch.json.example @@ -83,7 +83,6 @@ ], "runtimeExecutable": "npm", "skipFiles": [ - "**/node_modules/**", "**/node_modules/rxjs/**", "/**", "/**/*.js" diff --git a/packages/mw-demo/package.json b/packages/mw-demo/package.json index 17c4edb0..a2c821cf 100644 --- a/packages/mw-demo/package.json +++ b/packages/mw-demo/package.json @@ -32,8 +32,8 @@ }, "license": "MIT", "dependencies": { - "@midwayjs/info": "^3.14.0", - "@mwcp/share": "*" + "@mwcp/otel": "20 -22", + "@mwcp/share": "20 - 22" }, "devDependencies": { }, diff --git a/packages/mw-demo/src/configuration.ts b/packages/mw-demo/src/configuration.ts index 9d48344f..8432578c 100644 --- a/packages/mw-demo/src/configuration.ts +++ b/packages/mw-demo/src/configuration.ts @@ -13,6 +13,7 @@ import { MidwayInformationService, MidwayWebRouterService, } from '@midwayjs/core' +import { TraceInit } from '@mwcp/otel' import { Application, IMidwayContainer, @@ -65,6 +66,7 @@ export class AutoConfiguration implements ILifeCycle { } } + @TraceInit({ namespace: ConfigKey.namespace }) async onReady(container: IMidwayContainer): Promise { void container assert( diff --git a/packages/mw-demo/src/imports.ts b/packages/mw-demo/src/imports.ts index 1addb811..2a6cfb07 100644 --- a/packages/mw-demo/src/imports.ts +++ b/packages/mw-demo/src/imports.ts @@ -1,6 +1,7 @@ import * as info from '@midwayjs/info' import * as koa from '@midwayjs/koa' import * as swagger from '@midwayjs/swagger' +import * as otel from '@mwcp/otel' /* c8 ignore next 4 */ @@ -10,15 +11,11 @@ const CI = !! (process.env['MIDWAY_SERVER_ENV'] === 'unittest' || process.env['NODE_ENV'] === 'local' ) -export const useComponents: IComponentInfo[] = [] +export const useComponents: IComponentInfo[] = [otel] if (CI) { - if ( ! useComponents.includes(koa)) { - useComponents.push(koa) - useComponents.push(info) - } - if ( ! useComponents.includes(swagger)) { - useComponents.push(swagger) - } + useComponents.push(koa) + useComponents.push(info) + useComponents.push(swagger) } export interface IComponentInfo { From b10ba477367d21e5c0828b43903c21e2037a3fe9 Mon Sep 17 00:00:00 2001 From: waiting <1661926154@qq.com> Date: Sun, 28 Jan 2024 19:17:49 +0800 Subject: [PATCH 5/7] chore(boilerplate): update mw-demo --- packages/mw-demo/package.json | 2 +- packages/mw-demo/src/configuration.ts | 6 +++--- packages/mw-demo/src/imports.ts | 3 ++- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/packages/mw-demo/package.json b/packages/mw-demo/package.json index a2c821cf..54f6e4b7 100644 --- a/packages/mw-demo/package.json +++ b/packages/mw-demo/package.json @@ -32,7 +32,7 @@ }, "license": "MIT", "dependencies": { - "@mwcp/otel": "20 -22", + "@mwcp/otel": "20 - 22", "@mwcp/share": "20 - 22" }, "devDependencies": { diff --git a/packages/mw-demo/src/configuration.ts b/packages/mw-demo/src/configuration.ts index 8432578c..0d28d81f 100644 --- a/packages/mw-demo/src/configuration.ts +++ b/packages/mw-demo/src/configuration.ts @@ -3,7 +3,7 @@ import assert from 'node:assert' import { App, - Config, + Config as _Config, Configuration, ILifeCycle, ILogger, @@ -54,8 +54,8 @@ export class AutoConfiguration implements ILifeCycle { @Logger() protected readonly logger: ILogger - @Config(ConfigKey.config) protected readonly config: Conf - @Config(ConfigKey.middlewareConfig) protected readonly mwConfig: MiddlewareConfig + @_Config(ConfigKey.config) protected readonly config: Conf + @_Config(ConfigKey.middlewareConfig) protected readonly mwConfig: MiddlewareConfig async onConfigLoad(): Promise { if (! this.config.enableDefaultRoute) { diff --git a/packages/mw-demo/src/imports.ts b/packages/mw-demo/src/imports.ts index 2a6cfb07..f221ffeb 100644 --- a/packages/mw-demo/src/imports.ts +++ b/packages/mw-demo/src/imports.ts @@ -11,8 +11,9 @@ const CI = !! (process.env['MIDWAY_SERVER_ENV'] === 'unittest' || process.env['NODE_ENV'] === 'local' ) -export const useComponents: IComponentInfo[] = [otel] +export const useComponents: IComponentInfo[] = [] if (CI) { + useComponents.push(otel) useComponents.push(koa) useComponents.push(info) useComponents.push(swagger) From 45ba90ff1a30787361035a9fd2f1bb8c1d1d049d Mon Sep 17 00:00:00 2001 From: waiting <1661926154@qq.com> Date: Tue, 20 Feb 2024 18:01:09 +0800 Subject: [PATCH 6/7] chore: bump devDeps version --- package.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 26ef56f4..be9fe575 100644 --- a/package.json +++ b/package.json @@ -25,8 +25,8 @@ "madge": "^6.1.0", "mocha": "10", "mocha-lcov-reporter": "1", - "mwtsc": "^1.5.1", - "nx": "17", + "mwtsc": "^1.7.0", + "nx": "18", "swagger-ui-dist": "^5.11.0", "ts-node": "^10.9.2", "tsc-alias": "^1.8.8", From 411d4f94328b7afa774ea09017d0a0b018b70955 Mon Sep 17 00:00:00 2001 From: waiting <1661926154@qq.com> Date: Thu, 22 Feb 2024 18:32:09 +0800 Subject: [PATCH 7/7] chore: bump devDeps version --- package.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/package.json b/package.json index be9fe575..58f59141 100644 --- a/package.json +++ b/package.json @@ -7,9 +7,9 @@ "devDependencies": { "@commitlint/cli": "18", "@commitlint/config-conventional": "18", - "@midwayjs/mock": "^3.14.0", - "@midwayjs/swagger": "^3.14.0", - "@midwayjs/validate": "^3.14.0", + "@midwayjs/mock": "^3.15.0", + "@midwayjs/swagger": "^3.15.0", + "@midwayjs/validate": "^3.15.0", "@types/koa": "2", "@types/mocha": "10", "@types/node": "20.11",