Skip to content
This repository has been archived by the owner on Oct 10, 2023. It is now read-only.

Commit

Permalink
chore: bump versions
Browse files Browse the repository at this point in the history
  • Loading branch information
shigma committed Oct 10, 2023
1 parent 1f31385 commit 4d07bba
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 28 deletions.
2 changes: 1 addition & 1 deletion client/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"compilerOptions": {
"outDir": "lib",
"rootDir": ".",
"target": "es2020",
"target": "es2022",
"module": "esnext",
"jsx": "preserve",
"declaration": true,
Expand Down
16 changes: 8 additions & 8 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
21 changes: 3 additions & 18 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down Expand Up @@ -141,29 +141,14 @@ class Launcher extends DataService<Dict<Data>> {
})
}

// 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)
await mkdir(folder, { recursive: true })
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 })
}
}
Expand Down
2 changes: 1 addition & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"compilerOptions": {
"outDir": "lib",
"rootDir": "src",
"target": "es2020",
"target": "es2022",
"module": "commonjs",
"declaration": true,
"composite": true,
Expand Down

0 comments on commit 4d07bba

Please sign in to comment.