From 187c6f60303897e26d28c5e7872a3e4561c6c026 Mon Sep 17 00:00:00 2001 From: wc24 Date: Mon, 1 Jun 2026 19:32:48 +0800 Subject: [PATCH] =?UTF-8?q?v0.6.1:=20=E6=94=B9=E4=B8=BA=E7=BC=96=E8=AF=91?= =?UTF-8?q?=20ship,=E9=80=9A=E8=BF=87=20npm=20prepare=20hook=20=E8=87=AA?= =?UTF-8?q?=E5=8A=A8=E6=9E=84=E5=BB=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 加 tsconfig.build.json,排除 test,rootDir 设为 src - package.json: main/types/exports 指向 dist/main/index.{js,d.ts} - prepare hook: 消费侧 git 安装后自动 tsc,产物不进 git - 解决消费侧 "tsc + 裸 node" 链路 (theseus-server 等) 找不到 .js 的问题 --- package.json | 14 ++++++++------ tsconfig.build.json | 8 ++++++++ 2 files changed, 16 insertions(+), 6 deletions(-) create mode 100644 tsconfig.build.json diff --git a/package.json b/package.json index 6da2f10..6fa4615 100644 --- a/package.json +++ b/package.json @@ -1,22 +1,24 @@ { "name": "shrimp-server", - "version": "0.6.0", - "private": true, + "version": "0.6.1", "description": "Shrimp 框架后端 — 声明式字段驱动的 Node.js 管理后台框架(Express + Mongoose + JWT)", - "main": "src/main/index.ts", - "types": "src/main/index.ts", + "main": "dist/main/index.js", + "types": "dist/main/index.d.ts", "exports": { ".": { - "types": "./src/main/index.ts", - "default": "./src/main/index.ts" + "types": "./dist/main/index.d.ts", + "default": "./dist/main/index.js" }, "./package.json": "./package.json" }, "files": [ + "dist", "src", "README.md" ], "scripts": { + "build": "tsc -p tsconfig.build.json", + "prepare": "tsc -p tsconfig.build.json", "test": "vitest run", "test:watch": "vitest", "typecheck": "tsc --noEmit" diff --git a/tsconfig.build.json b/tsconfig.build.json new file mode 100644 index 0000000..45939a5 --- /dev/null +++ b/tsconfig.build.json @@ -0,0 +1,8 @@ +{ + "extends": "./tsconfig.json", + "compilerOptions": { + "rootDir": "./src" + }, + "include": ["src/**/*"], + "exclude": ["node_modules", "dist", "test"] +}