0.8.0: express 收紧到 ^5;契约副本改为 build 时自动同步

破坏性:peerDependencies.express 从 "^4 || ^5" 收成 "^5"。
buildShrimpRouter 的 router.post("/*path") 是 Express 5 才有的写法,
声明支持 4 一直是假的。devDeps 同步升到 express 5.1 / @types/express 5,32 个测试通过。

契约同步:新增 postbuild,把 src/IShrimpType.ts 覆盖到同级 shrimp-admin 的副本
(scripts/check-admin-contract.mjs;找不到同级仓库就跳过,不影响 CI 与消费侧 prepare)。
起因是那份副本靠人工复制,漂了一整代没人发现——停在旧的 json 类型,
缺 object/array/fields/item/parse/refs,而前端对未注册类型静默回落成 string,
漂移不报错、只悄悄渲染错。

删掉 @contractVersion 版本轴:代码无人读取,且从 1.0.0 起从未移动,
期间契约实际改了好几处,数字全程说谎。副本新不新改由字节比对回答,
消费侧看钉的 tag 即可,版本收敛成 package version 一根轴。
This commit is contained in:
2026-08-10 19:42:52 +08:00
parent 19afdf3615
commit 064bc108d7
4 changed files with 471 additions and 583 deletions
+5 -4
View File
@@ -1,6 +1,6 @@
{
"name": "shrimp-server",
"version": "0.7.12",
"version": "0.8.0",
"description": "Shrimp 框架后端 — 声明式字段驱动的 Node.js 管理后台框架(Express + Mongoose + JWT)",
"main": "dist/main/index.js",
"types": "dist/main/index.d.ts",
@@ -18,6 +18,7 @@
],
"scripts": {
"build": "tsc -p tsconfig.build.json",
"postbuild": "node scripts/check-admin-contract.mjs",
"prepare": "tsc -p tsconfig.build.json",
"test": "vitest run",
"test:watch": "vitest",
@@ -25,7 +26,7 @@
},
"peerDependencies": {
"bcrypt": "^5 || ^6",
"express": "^4 || ^5",
"express": "^5",
"jsonwebtoken": "^8 || ^9",
"mongoose": "^6 || ^7 || ^8"
},
@@ -45,11 +46,11 @@
},
"devDependencies": {
"@types/bcrypt": "^5.0.0",
"@types/express": "^4.17.21",
"@types/express": "^5.0.0",
"@types/jsonwebtoken": "^9.0.0",
"@types/node": "^20.0.0",
"bcrypt": "^5.1.1",
"express": "^4.19.0",
"express": "^5.1.0",
"jsonwebtoken": "^9.0.2",
"mongoose": "^8.0.0",
"tsx": "^4.7.0",