更新启动方式到midway最新,修复多数据源报错BUG

This commit is contained in:
cool 2024-03-20 11:40:56 +08:00
parent d1829e5316
commit 43f02ea698
8 changed files with 12 additions and 16 deletions

View File

@ -4,7 +4,7 @@
"description": "一个项目用COOL就够了", "description": "一个项目用COOL就够了",
"private": true, "private": true,
"dependencies": { "dependencies": {
"@cool-midway/core": "^7.1.8", "@cool-midway/core": "^7.1.10",
"@cool-midway/rpc": "^7.0.0", "@cool-midway/rpc": "^7.0.0",
"@cool-midway/task": "^7.0.0", "@cool-midway/task": "^7.0.0",
"@midwayjs/bootstrap": "^3.15.0", "@midwayjs/bootstrap": "^3.15.0",
@ -38,7 +38,6 @@
"ws": "^8.16.0" "ws": "^8.16.0"
}, },
"devDependencies": { "devDependencies": {
"@midwayjs/cli": "^2.1.1",
"@midwayjs/mock": "^3.15.2", "@midwayjs/mock": "^3.15.2",
"@types/jest": "^29.5.12", "@types/jest": "^29.5.12",
"@types/koa": "^2.15.0", "@types/koa": "^2.15.0",
@ -46,6 +45,7 @@
"cross-env": "^7.0.3", "cross-env": "^7.0.3",
"jest": "^29.7.0", "jest": "^29.7.0",
"mwts": "^1.3.0", "mwts": "^1.3.0",
"mwtsc": "^1.7.2",
"ts-jest": "^29.1.2", "ts-jest": "^29.1.2",
"typescript": "~5.4.2" "typescript": "~5.4.2"
}, },
@ -54,12 +54,12 @@
}, },
"scripts": { "scripts": {
"start": "NODE_ENV=production node ./bootstrap.js", "start": "NODE_ENV=production node ./bootstrap.js",
"dev": "cross-env && cross-env NODE_ENV=local TS_NODE_TYPE_CHECK=false TS_NODE_TRANSPILE_ONLY=true midway-bin dev --ts", "dev": "cross-env NODE_ENV=local mwtsc --watch --run @midwayjs/mock/app.js",
"cov": "midway-bin cov --ts", "cov": "midway-bin cov --ts",
"lint": "mwts check", "lint": "mwts check",
"lint:fix": "mwts fix", "lint:fix": "mwts fix",
"ci": "npm run cov", "ci": "npm run cov",
"build": "midway-bin build -c", "build": "mwtsc --cleanOutDir",
"pm2:start": "pm2 start ./bootstrap.js -i max --name cool-admin", "pm2:start": "pm2 start ./bootstrap.js -i max --name cool-admin",
"pm2:stop": "pm2 stop cool-admin & pm2 delete cool-admin", "pm2:stop": "pm2 stop cool-admin & pm2 delete cool-admin",
"pm2:debug": "pm2-runtime start ./bootstrap.js -i max --name cool-admin" "pm2:debug": "pm2-runtime start ./bootstrap.js -i max --name cool-admin"

View File

@ -6,9 +6,8 @@ import { CachingFactory, MidwayCache } from '@midwayjs/cache-manager';
/** /**
* *
*/ */
@Provide()
@CoolController() @CoolController()
export class AppDemoCacheController extends BaseController { export class OpenDemoCacheController extends BaseController {
@InjectClient(CachingFactory, 'default') @InjectClient(CachingFactory, 'default')
midwayCache: MidwayCache; midwayCache: MidwayCache;

View File

@ -9,7 +9,7 @@ import {
* *
*/ */
@CoolController() @CoolController()
export class AppDemoEventController extends BaseController { export class OpenDemoEventController extends BaseController {
@Inject() @Inject()
coolEventManager: CoolEventManager; coolEventManager: CoolEventManager;

View File

@ -8,13 +8,12 @@ import { Repository } from 'typeorm';
/** /**
* *
*/ */
@Provide()
@CoolController({ @CoolController({
api: ['add', 'delete', 'update', 'info', 'list', 'page'], api: ['add', 'delete', 'update', 'info', 'list', 'page'],
entity: DemoGoodsEntity, entity: DemoGoodsEntity,
service: DemoGoodsService, service: DemoGoodsService,
}) })
export class AppDemoGoodsController extends BaseController { export class OpenDemoGoodsController extends BaseController {
@InjectEntityModel(DemoGoodsEntity) @InjectEntityModel(DemoGoodsEntity)
demoGoodsEntity: Repository<DemoGoodsEntity>; demoGoodsEntity: Repository<DemoGoodsEntity>;

View File

@ -6,9 +6,8 @@ import { DemoGetterQueue } from '../../queue/getter';
/** /**
* *
*/ */
@Provide()
@CoolController() @CoolController()
export class DemoQueueController extends BaseController { export class OpenDemoQueueController extends BaseController {
// 普通队列 // 普通队列
@Inject() @Inject()
demoCommQueue: DemoCommQueue; demoCommQueue: DemoCommQueue;

View File

@ -5,9 +5,8 @@ import { DemoRpcService } from '../../service/rpc';
/** /**
* RPC调用 * RPC调用
*/ */
@Provide()
@CoolController() @CoolController()
export class AppDemoRpcController extends BaseController { export class OpenDemoRpcController extends BaseController {
@Inject() @Inject()
demoRpcService: DemoRpcService; demoRpcService: DemoRpcService;

View File

@ -6,10 +6,9 @@ import { DemoTransactionService } from '../../service/transaction';
/** /**
* *
*/ */
@Provide()
@CoolController({ @CoolController({
api: ['add', 'delete', 'update', 'info', 'list', 'page'], api: ['add', 'delete', 'update', 'info', 'list', 'page'],
entity: DemoGoodsEntity, entity: DemoGoodsEntity,
service: DemoTransactionService, service: DemoTransactionService,
}) })
export class AppDemoTransactionController extends BaseController {} export class OpenDemoTransactionController extends BaseController {}

View File

@ -16,7 +16,8 @@
"declaration": true, "declaration": true,
"noImplicitAny": false, "noImplicitAny": false,
"typeRoots": [ "./typings", "./node_modules/@types"], "typeRoots": [ "./typings", "./node_modules/@types"],
"outDir": "dist" "outDir": "dist",
"rootDir": "src"
}, },
"exclude": [ "exclude": [
"dist", "dist",