From 01da490d92635e9d7df0e9a6aacfa92f304cee69 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=89=8B=E7=93=9C=E4=B8=80=E5=8D=81=E9=9B=AA?= Date: Mon, 26 Jan 2026 18:43:50 +0800 Subject: [PATCH] Bump napcat-types version to 0.0.2 Updated the package version in package.public.json from 0.0.1 to 0.0.2. Update napcat-types package metadata and dependencies Set package as public by changing 'private' to false. Move 'napcat-core' and 'napcat-onebot' from dependencies to devDependencies, and remove 'compressing' from dependencies. Add public packaging and build script for napcat-types Introduces package.public.json and a copy-dist.mjs script to automate copying metadata and README into the dist folder for publishing. Updates build script in package.json to use the new copy step. Adds initial package.json and README for napcat-types. Update scripts in napcat-types package configs Added a publish script to package.json and removed scripts from package.public.json to streamline configuration and avoid duplication. --- package/package.json | 24 ++++++++++++++++++++ packages/napcat-types/README.md | 3 +++ packages/napcat-types/package.json | 14 ++++++------ packages/napcat-types/package.public.json | 25 +++++++++++++++++++++ packages/napcat-types/scripts/copy-dist.mjs | 13 +++++++++++ 5 files changed, 72 insertions(+), 7 deletions(-) create mode 100644 package/package.json create mode 100644 packages/napcat-types/README.md create mode 100644 packages/napcat-types/package.public.json create mode 100644 packages/napcat-types/scripts/copy-dist.mjs diff --git a/package/package.json b/package/package.json new file mode 100644 index 00000000..3780b4c8 --- /dev/null +++ b/package/package.json @@ -0,0 +1,24 @@ +{ + "name": "napcat-types", + "version": "0.0.1", + "type": "module", + "types": "./napcat-types/index.d.ts", + "files": [ + "**/*" + ], + "dependencies": { + "@types/node": "^22.10.7", + "@types/express": "^4.17.21", + "@types/ws": "^8.5.12", + "@types/cors": "^2.8.17", + "@types/multer": "^1.4.12", + "@types/winston": "^2.4.4", + "@types/yaml": "^1.9.7", + "@types/ip": "^1.1.3" + }, + "publishConfig": { + "registry": "https://registry.npmjs.org/", + "access": "public", + "tag": "latest" + } +} \ No newline at end of file diff --git a/packages/napcat-types/README.md b/packages/napcat-types/README.md new file mode 100644 index 00000000..2205c1e4 --- /dev/null +++ b/packages/napcat-types/README.md @@ -0,0 +1,3 @@ +# NapCat-Types + + NapCat 类型定义包,包含 NapCat 及其插件开发所需的所有类型定义。 \ No newline at end of file diff --git a/packages/napcat-types/package.json b/packages/napcat-types/package.json index 96558906..d1efb5f7 100644 --- a/packages/napcat-types/package.json +++ b/packages/napcat-types/package.json @@ -1,19 +1,18 @@ { "name": "napcat-types", "version": "0.0.1", - "private": true, + "private": false, "type": "module", "types": "./dist/napcat-types/index.d.ts", "files": [ "dist/**/*" ], "scripts": { - "build": "tsc --project tsconfig.json && tsc-alias --project tsconfig.json --outDir dist", - "test": "pnpm -s exec tsc --project tsconfig.json --noEmit" + "build": "tsc --project tsconfig.json && tsc-alias --project tsconfig.json --outDir dist && node ./scripts/copy-dist.mjs", + "test": "pnpm -s exec tsc --project tsconfig.json --noEmit", + "publish": "pnpm publish --filter napcat-types" }, "dependencies": { - "napcat-core": "workspace:*", - "napcat-onebot": "workspace:*", "@types/node": "^22.10.7", "@types/express": "^4.17.21", "@types/ws": "^8.5.12", @@ -21,10 +20,11 @@ "@types/multer": "^1.4.12", "@types/winston": "^2.4.4", "@types/yaml": "^1.9.7", - "@types/ip": "^1.1.3", - "compressing": "^1.10.3" + "@types/ip": "^1.1.3" }, "devDependencies": { + "napcat-core": "workspace:*", + "napcat-onebot": "workspace:*", "tsc-alias": "^1.8.16" } } \ No newline at end of file diff --git a/packages/napcat-types/package.public.json b/packages/napcat-types/package.public.json new file mode 100644 index 00000000..6e9a45e7 --- /dev/null +++ b/packages/napcat-types/package.public.json @@ -0,0 +1,25 @@ +{ + "name": "napcat-types", + "version": "0.0.2", + "private": false, + "type": "module", + "types": "./napcat-types/index.d.ts", + "files": [ + "./**/*" + ], + "dependencies": { + "@types/node": "^22.10.7", + "@types/express": "^4.17.21", + "@types/ws": "^8.5.12", + "@types/cors": "^2.8.17", + "@types/multer": "^1.4.12", + "@types/winston": "^2.4.4", + "@types/yaml": "^1.9.7", + "@types/ip": "^1.1.3" + }, + "publishConfig": { + "registry": "https://registry.npmjs.org/", + "access": "public", + "tag": "latest" + } +} \ No newline at end of file diff --git a/packages/napcat-types/scripts/copy-dist.mjs b/packages/napcat-types/scripts/copy-dist.mjs new file mode 100644 index 00000000..4cf85167 --- /dev/null +++ b/packages/napcat-types/scripts/copy-dist.mjs @@ -0,0 +1,13 @@ +// 复制 cp README.md dist/ && cp package.public.json dist/package.json +import { copyFile } from 'node:fs/promises'; +import { join } from 'node:path'; +import { fileURLToPath } from 'node:url'; +const __dirname = fileURLToPath(new URL('../', import.meta.url)); +await copyFile( + join(__dirname, 'package.public.json'), + join(__dirname, 'dist', 'package.json') +); +await copyFile( + join(__dirname, 'README.md'), + join(__dirname, 'dist', 'README.md') +); \ No newline at end of file