From 4d07bbad74977aa3f33c0603aeb863058a14e46b Mon Sep 17 00:00:00 2001 From: Shigma Date: Wed, 11 Oct 2023 02:53:38 +0800 Subject: [PATCH] chore: bump versions --- client/tsconfig.json | 2 +- package.json | 16 ++++++++-------- src/index.ts | 21 +++------------------ tsconfig.json | 2 +- 4 files changed, 13 insertions(+), 28 deletions(-) diff --git a/client/tsconfig.json b/client/tsconfig.json index 20daed3..758c132 100644 --- a/client/tsconfig.json +++ b/client/tsconfig.json @@ -2,7 +2,7 @@ "compilerOptions": { "outDir": "lib", "rootDir": ".", - "target": "es2020", + "target": "es2022", "module": "esnext", "jsx": "preserve", "declaration": true, diff --git a/package.json b/package.json index 555d1b6..af1db00 100644 --- a/package.json +++ b/package.json @@ -50,16 +50,16 @@ } }, "peerDependencies": { - "koishi": "^4.13.5" + "koishi": "^4.15.0" }, "devDependencies": { - "@koishijs/client": "^5.11.6", - "@koishijs/plugin-adapter-onebot": "^5.7.1", - "@koishijs/plugin-console": "^5.11.6", - "@koishijs/plugin-market": "^2.2.1", - "@types/node": "^18.16.9", - "koishi": "^4.13.5", - "typescript": "^5.0.4" + "@koishijs/client": "^5.16.0", + "@koishijs/plugin-adapter-onebot": "^6.0.2", + "@koishijs/plugin-console": "^5.16.0", + "@koishijs/plugin-market": "^2.3.0", + "@types/node": "^20.4.2", + "koishi": "^4.15.0", + "typescript": "^5.1.6" }, "dependencies": { "go-cqhttp": "^5.0.0", diff --git a/src/index.ts b/src/index.ts index 9163ab3..4cb023e 100644 --- a/src/index.ts +++ b/src/index.ts @@ -3,8 +3,8 @@ import OneBotBot from '@koishijs/plugin-adapter-onebot' import { DataService } from '@koishijs/plugin-console' import {} from '@koishijs/plugin-market' import { ChildProcess } from 'child_process' -import { join, resolve } from 'path' -import { copyFile, mkdir, readdir, readFile, rm, stat, writeFile } from 'fs/promises' +import { resolve } from 'path' +import { cp, mkdir, readFile, rm, stat, writeFile } from 'fs/promises' import { createReadStream, promises as fsp, Stats } from 'fs' import gocqhttp from 'go-cqhttp' import strip from 'strip-ansi' @@ -141,21 +141,6 @@ class Launcher extends DataService> { }) } - // cp() can only be used since node 16 - private async cp(src: string, dest: string) { - const dirents = await readdir(src, { withFileTypes: true }) - for (const dirent of dirents) { - const srcFile = join(src, dirent.name) - const destFile = join(dest, dirent.name) - if (dirent.isFile()) { - await copyFile(srcFile, destFile) - } else if (dirent.isDirectory()) { - await mkdir(destFile) - await this.cp(srcFile, destFile) - } - } - } - private async migrate() { const legacy = resolve(this.ctx.baseDir, 'accounts') const folder = resolve(this.ctx.baseDir, this.config.root) @@ -163,7 +148,7 @@ class Launcher extends DataService> { const stats: Stats = await stat(legacy).catch(() => null) if (stats?.isDirectory()) { logger.info('migrating to data directory') - await this.cp(legacy, folder) + await cp(legacy, folder) await rm(legacy, { recursive: true, force: true }) } } diff --git a/tsconfig.json b/tsconfig.json index 23aacdf..2129da6 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -2,7 +2,7 @@ "compilerOptions": { "outDir": "lib", "rootDir": "src", - "target": "es2020", + "target": "es2022", "module": "commonjs", "declaration": true, "composite": true,