From ff93aa3dc79ca519a68bd74b5ed94a1b92d3ca4a 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: Sun, 1 Feb 2026 11:01:53 +0800 Subject: [PATCH] Add dev config and copy-env build script Add development config files and wiring to include them in the shell build. Creates packages/napcat-develop/config/.env and packages/napcat-develop/config/onebot11.json, adds a root script `build:shell:config` that builds napcat-shell and then runs napcat-develop's `copy-env` script. Update packages/napcat-develop/package.json to add the `copy-env` script (uses xcopy to copy config into the napcat-shell dist), tidy exports and metadata. This ensures dev configuration is packaged into napcat-shell during the build process. --- package.json | 3 +- packages/napcat-develop/config/.env | 4 ++ packages/napcat-develop/config/onebot11.json | 39 ++++++++++++++++ packages/napcat-develop/package.json | 47 ++++++++++---------- 4 files changed, 69 insertions(+), 24 deletions(-) create mode 100644 packages/napcat-develop/config/.env create mode 100644 packages/napcat-develop/config/onebot11.json diff --git a/package.json b/package.json index 462db7de..a7fdd555 100644 --- a/package.json +++ b/package.json @@ -14,7 +14,8 @@ "test": "pnpm --filter napcat-test run test", "test:ui": "pnpm --filter napcat-test run test:ui", "lint": "eslint .", - "lint:fix": "eslint . --fix" + "lint:fix": "eslint . --fix", + "build:shell:config": "pnpm --filter napcat-shell run build && pnpm --filter napcat-develop run copy-env" }, "devDependencies": { "@rollup/plugin-node-resolve": "^16.0.3", diff --git a/packages/napcat-develop/config/.env b/packages/napcat-develop/config/.env new file mode 100644 index 00000000..14629708 --- /dev/null +++ b/packages/napcat-develop/config/.env @@ -0,0 +1,4 @@ +NAPCAT_DISABLE_PIPE=1 +NAPCAT_DISABLE_MULTI_PROCESS=1 +NAPCAT_WEBUI_JWT_SECRET_KEY=napcat_dev_secret_key +NAPCAT_WEBUI_SECRET_KEY=napcat \ No newline at end of file diff --git a/packages/napcat-develop/config/onebot11.json b/packages/napcat-develop/config/onebot11.json new file mode 100644 index 00000000..fa3000df --- /dev/null +++ b/packages/napcat-develop/config/onebot11.json @@ -0,0 +1,39 @@ +{ + "network": { + "httpServers": [ + { + "enable": true, + "name": "HTTP", + "host": "127.0.0.1", + "port": 3000, + "enableCors": true, + "enableWebsocket": false, + "messagePostFormat": "array", + "token": "", + "debug": false + } + ], + "httpSseServers": [], + "httpClients": [], + "websocketServers": [ + { + "enable": true, + "name": "WebSocket", + "host": "127.0.0.1", + "port": 3001, + "reportSelfMessage": false, + "enableForcePushEvent": true, + "messagePostFormat": "array", + "token": "", + "debug": false, + "heartInterval": 30000 + } + ], + "websocketClients": [], + "plugins": [] + }, + "musicSignUrl": "", + "enableLocalFile2Url": false, + "parseMultMsg": false, + "imageDownloadProxy": "" +} \ No newline at end of file diff --git a/packages/napcat-develop/package.json b/packages/napcat-develop/package.json index c769c2c9..4212e683 100644 --- a/packages/napcat-develop/package.json +++ b/packages/napcat-develop/package.json @@ -1,27 +1,28 @@ { - "name": "napcat-develop", - "version": "0.0.1", - "private": true, - "type": "module", - "main": "index.js", - "scripts": { - "dev": "powershell ./nodeTest.ps1" + "name": "napcat-develop", + "version": "0.0.1", + "private": true, + "type": "module", + "main": "index.js", + "scripts": { + "dev": "powershell ./nodeTest.ps1", + "copy-env": "xcopy config ..\\napcat-shell\\dist\\config /E /I /Y" + }, + "exports": { + ".": { + "require": "./index.js" }, - "exports": { - ".": { - "require": "./index.js" - }, - "./*": { - "require": "./*" - } - }, - "dependencies": { - "fs-extra": "^11.3.2" - }, - "devDependencies": { - "@types/node": "^22.0.1" - }, - "engines": { - "node": ">=18.0.0" + "./*": { + "require": "./*" } + }, + "dependencies": { + "fs-extra": "^11.3.2" + }, + "devDependencies": { + "@types/node": "^22.0.1" + }, + "engines": { + "node": ">=18.0.0" + } } \ No newline at end of file