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