From 8c642d79c28291ba2b43303c7cd346ce680f8d44 Mon Sep 17 00:00:00 2001 From: QCQCQC <1220204124@zust.edu.cn> Date: Thu, 16 Oct 2025 11:08:33 +0800 Subject: [PATCH 1/5] =?UTF-8?q?fix:=20=E6=B7=BB=E5=8A=A0=E4=B8=80=E5=B1=82?= =?UTF-8?q?catch=E5=A4=84=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/server/start.js | 2 ++ src/server/start.ts | 2 ++ 2 files changed, 4 insertions(+) diff --git a/lib/server/start.js b/lib/server/start.js index b99c28f..940c38b 100644 --- a/lib/server/start.js +++ b/lib/server/start.js @@ -171,6 +171,8 @@ async function startup(path, connector, omitWatchers, omitTimers, routine) { if (props.level === "error") { appLoader.execRoutine(async (ctx) => { await errorHandler(props.caller, props.args, ctx); + }).catch((err) => { + console.warn('执行全局错误处理失败:', err); }); } return props.args; diff --git a/src/server/start.ts b/src/server/start.ts index 6911d9d..da2fbb7 100644 --- a/src/server/start.ts +++ b/src/server/start.ts @@ -219,6 +219,8 @@ export async function startup { await errorHandler( props.caller, props.args, ctx); + }).catch((err) => { + console.warn('执行全局错误处理失败:', err); }); } return props.args; From 0b833b8fd69ab9594b8c9b5a8837da500e3f5736 Mon Sep 17 00:00:00 2001 From: Xc Date: Thu, 16 Oct 2025 11:11:29 +0800 Subject: [PATCH 2/5] 4.0.28 --- package.json | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/package.json b/package.json index a6881b7..e81ab17 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@xuchangzju/oak-cli", - "version": "4.0.27", + "version": "4.0.28", "description": "client for oak framework", "main": "lib/index.js", "scripts": { @@ -112,9 +112,9 @@ "lodash": "^4.17.21", "mini-css-extract-plugin": "^2.5.3", "node-watch": "^0.7.4", - "oak-backend-base": "^4.1.22", - "oak-domain": "^5.1.28", - "oak-frontend-base": "^5.3.38", + "oak-backend-base": "file:../oak-backend-base", + "oak-domain": "file:../oak-domain", + "oak-frontend-base": "file:../oak-frontend-base", "parse-asn1": "5.1.6", "postcss": "^8.4.4", "postcss-flexbugs-fixes": "^5.0.2", From df8426d1029ab098b4041caaa25d5c0ad790eb9f Mon Sep 17 00:00:00 2001 From: QCQCQC <1220204124@zust.edu.cn> Date: Thu, 16 Oct 2025 11:18:42 +0800 Subject: [PATCH 3/5] =?UTF-8?q?fix:=20=E5=A4=84=E7=90=86require=20errors.j?= =?UTF-8?q?s=E4=B8=8D=E5=AD=98=E5=9C=A8=E7=9A=84=E6=83=85=E5=86=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/server/start.js | 8 +++++++- src/server/start.ts | 20 +++++++++++++------- 2 files changed, 20 insertions(+), 8 deletions(-) diff --git a/lib/server/start.js b/lib/server/start.js index 940c38b..51e772a 100644 --- a/lib/server/start.js +++ b/lib/server/start.js @@ -39,7 +39,13 @@ function concat(...paths) { }); } async function startup(path, connector, omitWatchers, omitTimers, routine) { - const errorHandler = require((0, path_1.join)(path, 'lib', 'configuration', 'errors')).default; + let errorHandler = undefined; + try { + errorHandler = require((0, path_1.join)(path, 'lib', 'configuration', 'errors')).default; + } + catch (err) { + // 不存在errors配置 + } const serverConfiguration = require((0, path_1.join)(path, 'lib', 'configuration', 'server')).default; // 拿到package.json,用作项目的唯一标识,否则无法区分不同项目的Redis+socketIO连接 const packageJson = require((0, path_1.join)(path, 'package.json')); diff --git a/src/server/start.ts b/src/server/start.ts index da2fbb7..80485f8 100644 --- a/src/server/start.ts +++ b/src/server/start.ts @@ -57,12 +57,18 @@ export async function startup) => Promise, ): Promise<(() => Promise) | any> { - const errorHandler: ErrorHandler = require(join( - path, - 'lib', - 'configuration', - 'errors' - )).default; + let errorHandler: ErrorHandler | undefined = undefined; + + try { + errorHandler = require(join( + path, + 'lib', + 'configuration', + 'errors' + )).default; + } catch (err) { + // 不存在errors配置 + } const serverConfiguration: ServerConfiguration = require(join( path, @@ -218,7 +224,7 @@ export async function startup { if (props.level === "error") { appLoader.execRoutine(async (ctx) => { - await errorHandler( props.caller, props.args, ctx); + await errorHandler(props.caller, props.args, ctx); }).catch((err) => { console.warn('执行全局错误处理失败:', err); }); From 97bc9b80427701a242ceb97f2cd4f893c3edf73e Mon Sep 17 00:00:00 2001 From: QCQCQC <1220204124@zust.edu.cn> Date: Thu, 16 Oct 2025 11:21:43 +0800 Subject: [PATCH 4/5] =?UTF-8?q?fix:=20=E4=BF=AE=E6=94=B9=E4=B8=80=E5=A4=84?= =?UTF-8?q?=E5=B7=B2=E5=BC=83=E7=94=A8=E7=9A=84=E7=B1=BB=E5=9E=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/server/watch.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/server/watch.ts b/src/server/watch.ts index d930ffb..abad55b 100644 --- a/src/server/watch.ts +++ b/src/server/watch.ts @@ -16,7 +16,7 @@ import { LogFormatter, LogFormatterProp, polyfillConsole } from "./polyfill"; 服务器重启 → 清理缓存并重新启动服务 */ -declare const require: NodeRequire; +declare const require: NodeJS.Require; declare const process: NodeJS.Process; From af34753f484fd670099c998ce27d531223fa79a7 Mon Sep 17 00:00:00 2001 From: Xc Date: Thu, 16 Oct 2025 15:10:41 +0800 Subject: [PATCH 5/5] 4.0.28-pub --- package.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/package.json b/package.json index e81ab17..a1d0d1f 100644 --- a/package.json +++ b/package.json @@ -112,9 +112,9 @@ "lodash": "^4.17.21", "mini-css-extract-plugin": "^2.5.3", "node-watch": "^0.7.4", - "oak-backend-base": "file:../oak-backend-base", - "oak-domain": "file:../oak-domain", - "oak-frontend-base": "file:../oak-frontend-base", + "oak-backend-base": "^4.1.23", + "oak-domain": "^5.1.28", + "oak-frontend-base": "^5.3.38", "parse-asn1": "5.1.6", "postcss": "^8.4.4", "postcss-flexbugs-fixes": "^5.0.2",