兼容二进制打包

This commit is contained in:
COOL 2025-01-13 21:22:53 +08:00
parent d6ba2d897b
commit eadf113c6d
7 changed files with 27 additions and 17 deletions

View File

@ -40,7 +40,8 @@
"mwtsc": "^1.15.1", "mwtsc": "^1.15.1",
"pkg": "^5.8.1", "pkg": "^5.8.1",
"ts-jest": "^29.2.5", "ts-jest": "^29.2.5",
"typescript": "~5.7.3" "typescript": "~5.7.3",
"rimraf": "^5.0.5"
}, },
"engines": { "engines": {
"node": ">=18.0.0" "node": ">=18.0.0"
@ -48,7 +49,7 @@
"scripts": { "scripts": {
"start": "NODE_ENV=production node ./bootstrap.js", "start": "NODE_ENV=production node ./bootstrap.js",
"entity": "cool entity", "entity": "cool entity",
"dev": "cool check entity && bundle && cross-env NODE_ENV=local mwtsc --watch --run @midwayjs/mock/app.js", "dev": "cool check entity && cross-env NODE_ENV=local mwtsc --watch --run @midwayjs/mock/app.js",
"test": "cross-env NODE_ENV=unittest jest", "test": "cross-env NODE_ENV=unittest jest",
"cov": "jest --coverage", "cov": "jest --coverage",
"lint": "mwts check", "lint": "mwts check",
@ -56,7 +57,7 @@
"ci": "npm run cov", "ci": "npm run cov",
"build": "cool entity && bundle && mwtsc --cleanOutDir", "build": "cool entity && bundle && mwtsc --cleanOutDir",
"build:obfuscate": "cool entity && bundle && mwtsc --cleanOutDir && cool obfuscate", "build:obfuscate": "cool entity && bundle && mwtsc --cleanOutDir && cool obfuscate",
"pkg": "npm run build && pkg . -d > build/pkg.log", "pkg": "rimraf build && mkdir build && npm run build && pkg . -d > build/pkg.log",
"pm2:start": "pm2 start ./bootstrap.js -i 1 --name cool-admin", "pm2:start": "pm2 start ./bootstrap.js -i 1 --name cool-admin",
"pm2:stop": "pm2 stop cool-admin & pm2 delete cool-admin" "pm2:stop": "pm2 stop cool-admin & pm2 delete cool-admin"
}, },

3
pnpm-lock.yaml generated
View File

@ -108,6 +108,9 @@ importers:
pkg: pkg:
specifier: ^5.8.1 specifier: ^5.8.1
version: 5.8.1 version: 5.8.1
rimraf:
specifier: ^5.0.5
version: 5.0.10
ts-jest: ts-jest:
specifier: ^29.2.5 specifier: ^29.2.5
version: 29.2.5(@babel/core@7.26.0)(@jest/transform@29.7.0)(@jest/types@29.6.3)(babel-jest@29.7.0(@babel/core@7.26.0))(jest@29.7.0(@types/node@22.10.5))(typescript@5.7.3) version: 29.2.5(@babel/core@7.26.0)(@jest/transform@29.7.0)(@jest/types@29.6.3)(babel-jest@29.7.0(@babel/core@7.26.0))(jest@29.7.0(@types/node@22.10.5))(typescript@5.7.3)

View File

@ -8,8 +8,8 @@
<title>COOL-AMIND 一个很酷的后台权限管理系统</title> <title>COOL-AMIND 一个很酷的后台权限管理系统</title>
<meta name="keywords" content="cool-admin后台管理系统vueelement-uinodejs" /> <meta name="keywords" content="cool-admin后台管理系统vueelement-uinodejs" />
<meta name="description" content="element-ui、midway.js、mysql、redis、node.js、前后端分离、权限管理、快速开发 COOL-AMIND 一个很酷的后台权限管理系统" /> <meta name="description" content="element-ui、midway.js、mysql、redis、node.js、前后端分离、权限管理、快速开发 COOL-AMIND 一个很酷的后台权限管理系统" />
<link rel="stylesheet" href="public/css/welcome.css"> <link rel="stylesheet" href="css/welcome.css">
<link rel="shortcut icon" href="public/favicon.ico" type="image/x-icon" /> <link rel="shortcut icon" href="favicon.ico" type="image/x-icon" />
<body> <body>
<div class="reveal">HELLO COOL-ADMIN AI快速开发框架</div> <div class="reveal">HELLO COOL-ADMIN AI快速开发框架</div>
@ -24,7 +24,7 @@
</div> </div>
</div> </div>
<script src="public/js/welcome.js"></script> <script src="js/welcome.js"></script>
</body> </body>
</html> </html>

View File

@ -19,13 +19,6 @@ export default {
prefix: '/public', prefix: '/public',
dir: path.join(__dirname, '..', '..', 'public'), dir: path.join(__dirname, '..', '..', 'public'),
}, },
welcome: {
prefix: '/',
dir: path.join(__dirname, '..', '..', 'public'),
alias: {
'/': '/welcome.html',
},
},
}, },
}, },
// 文件上传 // 文件上传

View File

@ -1,6 +1,5 @@
import { CoolConfig } from '@cool-midway/core'; import { CoolConfig } from '@cool-midway/core';
import { MidwayConfig } from '@midwayjs/core'; import { MidwayConfig } from '@midwayjs/core';
import { entities } from '../entities';
/** /**
* npm run dev * npm run dev
@ -24,7 +23,7 @@ export default {
// 是否开启缓存 // 是否开启缓存
cache: true, cache: true,
// 实体路径 // 实体路径
entities, entities: ['**/modules/*/entity'],
// 扩展配置 // 扩展配置
extra: { extra: {
keepAliveInitialDelay: 10000, keepAliveInitialDelay: 10000,

View File

@ -5,6 +5,7 @@ import {
IMidwayApplication, IMidwayApplication,
Inject, Inject,
ILogger, ILogger,
MidwayWebRouterService,
} from '@midwayjs/core'; } from '@midwayjs/core';
import * as koa from '@midwayjs/koa'; import * as koa from '@midwayjs/koa';
// import * as crossDomain from '@midwayjs/cross-domain'; // import * as crossDomain from '@midwayjs/cross-domain';
@ -53,8 +54,21 @@ export class MainConfiguration {
@App() @App()
app: IMidwayApplication; app: IMidwayApplication;
@Inject()
webRouterService: MidwayWebRouterService;
@Inject() @Inject()
logger: ILogger; logger: ILogger;
async onReady() {} async onReady() {
this.webRouterService.addRouter(
async ctx => {
ctx.redirect('/public/index.html');
},
{
url: '/',
requestMethod: 'GET',
}
);
}
} }

View File

@ -2,6 +2,7 @@
export { MainConfiguration as Configuration } from './configuration'; export { MainConfiguration as Configuration } from './configuration';
export * from './comm/utils'; export * from './comm/utils';
export * from './config/config.default'; export * from './config/config.default';
export * from './config/config.local';
export * from './modules/base/entity/sys/user_role'; export * from './modules/base/entity/sys/user_role';
export * from './modules/base/entity/sys/user'; export * from './modules/base/entity/sys/user';
export * from './modules/base/entity/sys/role_menu'; export * from './modules/base/entity/sys/role_menu';
@ -13,7 +14,6 @@ export * from './modules/base/entity/sys/log';
export * from './modules/base/entity/sys/department'; export * from './modules/base/entity/sys/department';
export * from './modules/base/entity/sys/conf'; export * from './modules/base/entity/sys/conf';
export * from './entities'; export * from './entities';
export * from './config/config.local';
export * from './config/config.prod'; export * from './config/config.prod';
export * from './interface'; export * from './interface';
export * from './modules/base/service/sys/conf'; export * from './modules/base/service/sys/conf';