Skip to content

Commit

Permalink
fix(config): resolve top level to loader entry, fix #261
Browse files Browse the repository at this point in the history
  • Loading branch information
shigma committed Dec 11, 2023
1 parent 648bc55 commit e6c1813
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion plugins/config/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@koishijs/plugin-config",
"description": "Manage your bots and plugins with console",
"version": "2.5.1",
"version": "2.5.2",
"main": "lib/node/index.js",
"types": "lib/index.d.ts",
"exports": {
Expand Down
4 changes: 2 additions & 2 deletions plugins/config/src/shared/writer.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { DataService } from '@koishijs/console'
import { Context, Dict, Logger, remove } from 'koishi'
import { Context, Logger, remove } from 'koishi'
import { Loader } from '@koishijs/loader'

declare module '@koishijs/console' {
Expand Down Expand Up @@ -107,6 +107,7 @@ export class ConfigWriter extends DataService<Context.Config> {
}

private resolveFork(ident: string) {
if (!ident) return this.loader.entry.scope
for (const main of this.ctx.registry.values()) {
for (const fork of main.children) {
if (fork.key === ident) return fork
Expand Down Expand Up @@ -149,7 +150,6 @@ export class ConfigWriter extends DataService<Context.Config> {
const scope = this.resolveFork(parent)
this.loader.unload(scope.ctx, key)
rename(scope.config, key, '~' + key, config)
console.log(scope.config)
await this.loader.writeConfig()
}

Expand Down

0 comments on commit e6c1813

Please sign in to comment.