feat: add compile plugin info

Signed-off-by: MiaoWoo <admin@yumc.pw>
This commit is contained in:
2020-12-17 16:58:37 +08:00
parent aa182fb169
commit f35c8cd3fb
6 changed files with 40 additions and 6 deletions

View File

@@ -92,6 +92,16 @@ export class PluginConfigManager {
} else {
value = configLoader.load(base.read(metadata.file))
console.debug(`[${plugin.description.name}] Load Config ${metadata.variable} from file ${metadata.file} =>\n${JSON.stringify(value, undefined, 4)}`)
if (metadata.default) {
let needSave = false
for (const key of Object.keys(metadata.default)) {
if (!value[key]) {
value[key] = metadata.default[key]
needSave = true
}
}
needSave && base.save(metadata.file, configLoader.dump(value))
}
}
this.defienConfigProp(plugin, metadata, value)
} catch (error) {