diff --git a/.gitignore b/.gitignore index d57c6807..61f61658 100644 --- a/.gitignore +++ b/.gitignore @@ -16,4 +16,4 @@ checkVersion.sh bun.lockb tests/run/ guild1.db-wal -guild1.db-shm +guild1.db-shm \ No newline at end of file diff --git a/package.json b/package.json index 2e8f9338..cf32cd66 100644 --- a/package.json +++ b/package.json @@ -6,7 +6,8 @@ "scripts": { "build:shell": "pnpm --filter napcat-shell run build || exit 1", "build:framework": "pnpm --filter napcat-framework run build || exit 1", - "build:webui": "pnpm --filter napcat-webui-frontend run build || exit 1" + "build:webui": "pnpm --filter napcat-webui-frontend run build || exit 1", + "dev:shell": "pnpm --filter napcat-develop run dev || exit 1" }, "devDependencies": { "@rollup/plugin-node-resolve": "^16.0.3", diff --git a/packages/napcat-develop/loadNapCat.cjs b/packages/napcat-develop/loadNapCat.cjs index 7ba9989b..e866999d 100644 --- a/packages/napcat-develop/loadNapCat.cjs +++ b/packages/napcat-develop/loadNapCat.cjs @@ -18,9 +18,9 @@ if (versionFolders.length !== 1) { } const BASE_DIR = path.join(versionsDir, versionFolders[0], 'resources', 'app'); -const TARGET_DIR = path.join(__dirname, 'run'); +const TARGET_DIR = path.join(__dirname, 'dist'); const QQNT_FILE = path.join(__dirname, 'QQNT.dll'); -const NAPCAT_MJS_PATH = path.join(__dirname, '..', 'dist', 'napcat.mjs'); +const NAPCAT_MJS_PATH = path.join(__dirname, '..', 'napcat-shell','dist', 'napcat.mjs'); const itemsToCopy = [ 'avif_convert.dll', @@ -60,7 +60,7 @@ async function copyAll () { process.env.NAPCAT_QQ_PACKAGE_INFO_PATH = path.join(TARGET_DIR, 'package.json'); process.env.NAPCAT_QQ_VERSION_CONFIG_PATH = path.join(TARGET_DIR, 'config.json'); process.env.NAPCAT_DISABLE_PIPE = '1'; - process.env.NAPCAT_WORKDIR = path.join(__dirname, 'run'); + process.env.NAPCAT_WORKDIR = TARGET_DIR; console.log('Loading NapCat module...'); await import(pathToFileURL(NAPCAT_MJS_PATH).href); diff --git a/packages/napcat-develop/nodeTest.ps1 b/packages/napcat-develop/nodeTest.ps1 index e44f082e..1118337a 100644 --- a/packages/napcat-develop/nodeTest.ps1 +++ b/packages/napcat-develop/nodeTest.ps1 @@ -5,4 +5,4 @@ $uninstall = $uninstall.Trim('"') $qqPath = Split-Path $uninstall -Parent Write-Host "QQPath: $qqPath" -node.exe "tests/loadNapCat.cjs" "$qqPath" +node.exe "./loadNapCat.cjs" "$qqPath" diff --git a/packages/napcat-develop/package.json b/packages/napcat-develop/package.json new file mode 100644 index 00000000..22890afa --- /dev/null +++ b/packages/napcat-develop/package.json @@ -0,0 +1,27 @@ +{ + "name": "napcat-develop", + "version": "0.0.1", + "private": true, + "type": "module", + "main": "index.cjs", + "scripts": { + "dev": "powershell ./nodeTest.ps1" + }, + "exports": { + ".": { + "require": "./index.cjs" + }, + "./*": { + "require": "./*" + } + }, + "dependencies": { + "fs-extra": "^11.3.2" + }, + "devDependencies": { + "@types/node": "^22.0.1" + }, + "engines": { + "node": ">=18.0.0" + } +} \ No newline at end of file diff --git a/packages/napcat-develop/tsconfig.json b/packages/napcat-develop/tsconfig.json new file mode 100644 index 00000000..e8b7d5c2 --- /dev/null +++ b/packages/napcat-develop/tsconfig.json @@ -0,0 +1,49 @@ +{ + "compilerOptions": { + "target": "ES2021", + "module": "ESNext", + "moduleResolution": "Node", + "lib": [ + "ES2021" + ], + "typeRoots": [ + "./node_modules/@types" + ], + "esModuleInterop": true, + "outDir": "dist", + "rootDir": "./", + "noEmit": false, + "sourceMap": true, + "strict": true, + "noImplicitAny": false, + "strictFunctionTypes": true, + "strictBindCallApply": true, + "alwaysStrict": true, + "noImplicitThis": true, + "noImplicitReturns": true, + "noPropertyAccessFromIndexSignature": true, + "noUncheckedIndexedAccess": true, + "exactOptionalPropertyTypes": false, + "forceConsistentCasingInFileNames": true, + "useUnknownInCatchVariables": true, + "noImplicitOverride": true, + "noUnusedLocals": true, + "noUnusedParameters": true, + "noFallthroughCasesInSwitch": true, + "useDefineForClassFields": true, + "experimentalDecorators": true, + "allowSyntheticDefaultImports": true, + "resolveJsonModule": true, + "baseUrl": "./", + "skipLibCheck": true, + "skipDefaultLibCheck": true, + "allowJs": true + }, + "include": [ + "**/*.cjs" + ], + "exclude": [ + "node_modules", + "dist" + ] +} \ No newline at end of file