diff --git a/package.json b/package.json index 1cae211..cbf1e09 100644 --- a/package.json +++ b/package.json @@ -4,7 +4,7 @@ "description": "一个项目用COOL就够了", "private": true, "dependencies": { - "@cool-midway/core": "^7.1.8", + "@cool-midway/core": "^7.1.10", "@cool-midway/rpc": "^7.0.0", "@cool-midway/task": "^7.0.0", "@midwayjs/bootstrap": "^3.15.0", @@ -38,7 +38,6 @@ "ws": "^8.16.0" }, "devDependencies": { - "@midwayjs/cli": "^2.1.1", "@midwayjs/mock": "^3.15.2", "@types/jest": "^29.5.12", "@types/koa": "^2.15.0", @@ -46,6 +45,7 @@ "cross-env": "^7.0.3", "jest": "^29.7.0", "mwts": "^1.3.0", + "mwtsc": "^1.7.2", "ts-jest": "^29.1.2", "typescript": "~5.4.2" }, @@ -54,12 +54,12 @@ }, "scripts": { "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", "lint": "mwts check", "lint:fix": "mwts fix", "ci": "npm run cov", - "build": "midway-bin build -c", + "build": "mwtsc --cleanOutDir", "pm2:start": "pm2 start ./bootstrap.js -i max --name cool-admin", "pm2:stop": "pm2 stop cool-admin & pm2 delete cool-admin", "pm2:debug": "pm2-runtime start ./bootstrap.js -i max --name cool-admin" diff --git a/src/modules/demo/controller/open/cache.ts b/src/modules/demo/controller/open/cache.ts index 17cf57a..cf3ac4b 100644 --- a/src/modules/demo/controller/open/cache.ts +++ b/src/modules/demo/controller/open/cache.ts @@ -6,9 +6,8 @@ import { CachingFactory, MidwayCache } from '@midwayjs/cache-manager'; /** * 缓存 */ -@Provide() @CoolController() -export class AppDemoCacheController extends BaseController { +export class OpenDemoCacheController extends BaseController { @InjectClient(CachingFactory, 'default') midwayCache: MidwayCache; diff --git a/src/modules/demo/controller/open/event.ts b/src/modules/demo/controller/open/event.ts index 6e053c5..6ada13e 100644 --- a/src/modules/demo/controller/open/event.ts +++ b/src/modules/demo/controller/open/event.ts @@ -9,7 +9,7 @@ import { * 事件 */ @CoolController() -export class AppDemoEventController extends BaseController { +export class OpenDemoEventController extends BaseController { @Inject() coolEventManager: CoolEventManager; diff --git a/src/modules/demo/controller/open/goods.ts b/src/modules/demo/controller/open/goods.ts index 790f998..06ba287 100644 --- a/src/modules/demo/controller/open/goods.ts +++ b/src/modules/demo/controller/open/goods.ts @@ -8,13 +8,12 @@ import { Repository } from 'typeorm'; /** * 测试 */ -@Provide() @CoolController({ api: ['add', 'delete', 'update', 'info', 'list', 'page'], entity: DemoGoodsEntity, service: DemoGoodsService, }) -export class AppDemoGoodsController extends BaseController { +export class OpenDemoGoodsController extends BaseController { @InjectEntityModel(DemoGoodsEntity) demoGoodsEntity: Repository; diff --git a/src/modules/demo/controller/open/queue.ts b/src/modules/demo/controller/open/queue.ts index 230ae16..df5c639 100644 --- a/src/modules/demo/controller/open/queue.ts +++ b/src/modules/demo/controller/open/queue.ts @@ -6,9 +6,8 @@ import { DemoGetterQueue } from '../../queue/getter'; /** * 队列 */ -@Provide() @CoolController() -export class DemoQueueController extends BaseController { +export class OpenDemoQueueController extends BaseController { // 普通队列 @Inject() demoCommQueue: DemoCommQueue; diff --git a/src/modules/demo/controller/open/rpc.ts b/src/modules/demo/controller/open/rpc.ts index 4a716d7..2086169 100644 --- a/src/modules/demo/controller/open/rpc.ts +++ b/src/modules/demo/controller/open/rpc.ts @@ -5,9 +5,8 @@ import { DemoRpcService } from '../../service/rpc'; /** * 远程RPC调用 */ -@Provide() @CoolController() -export class AppDemoRpcController extends BaseController { +export class OpenDemoRpcController extends BaseController { @Inject() demoRpcService: DemoRpcService; diff --git a/src/modules/demo/controller/open/transaction.ts b/src/modules/demo/controller/open/transaction.ts index aa1ccd5..804f055 100644 --- a/src/modules/demo/controller/open/transaction.ts +++ b/src/modules/demo/controller/open/transaction.ts @@ -6,10 +6,9 @@ import { DemoTransactionService } from '../../service/transaction'; /** * 事务 */ -@Provide() @CoolController({ api: ['add', 'delete', 'update', 'info', 'list', 'page'], entity: DemoGoodsEntity, service: DemoTransactionService, }) -export class AppDemoTransactionController extends BaseController {} +export class OpenDemoTransactionController extends BaseController {} diff --git a/tsconfig.json b/tsconfig.json index ea66150..eb4731b 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -16,7 +16,8 @@ "declaration": true, "noImplicitAny": false, "typeRoots": [ "./typings", "./node_modules/@types"], - "outDir": "dist" + "outDir": "dist", + "rootDir": "src" }, "exclude": [ "dist",