Add napcat-develop package and update scripts

Introduces the napcat-develop package with its own package.json and tsconfig.json. Updates build and dev scripts in the root package.json, modifies loadNapCat.cjs to adjust paths and output directories, and updates nodeTest.ps1 to use the correct script path.
This commit is contained in:
手瓜一十雪 2025-11-13 19:30:33 +08:00
parent eebce222cf
commit 85b5c881ba
6 changed files with 83 additions and 6 deletions

2
.gitignore vendored
View File

@ -16,4 +16,4 @@ checkVersion.sh
bun.lockb bun.lockb
tests/run/ tests/run/
guild1.db-wal guild1.db-wal
guild1.db-shm guild1.db-shm

View File

@ -6,7 +6,8 @@
"scripts": { "scripts": {
"build:shell": "pnpm --filter napcat-shell run build || exit 1", "build:shell": "pnpm --filter napcat-shell run build || exit 1",
"build:framework": "pnpm --filter napcat-framework 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": { "devDependencies": {
"@rollup/plugin-node-resolve": "^16.0.3", "@rollup/plugin-node-resolve": "^16.0.3",

View File

@ -18,9 +18,9 @@ if (versionFolders.length !== 1) {
} }
const BASE_DIR = path.join(versionsDir, versionFolders[0], 'resources', 'app'); 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 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 = [ const itemsToCopy = [
'avif_convert.dll', '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_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_QQ_VERSION_CONFIG_PATH = path.join(TARGET_DIR, 'config.json');
process.env.NAPCAT_DISABLE_PIPE = '1'; 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...'); console.log('Loading NapCat module...');
await import(pathToFileURL(NAPCAT_MJS_PATH).href); await import(pathToFileURL(NAPCAT_MJS_PATH).href);

View File

@ -5,4 +5,4 @@ $uninstall = $uninstall.Trim('"')
$qqPath = Split-Path $uninstall -Parent $qqPath = Split-Path $uninstall -Parent
Write-Host "QQPath: $qqPath" Write-Host "QQPath: $qqPath"
node.exe "tests/loadNapCat.cjs" "$qqPath" node.exe "./loadNapCat.cjs" "$qqPath"

View File

@ -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"
}
}

View File

@ -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"
]
}