bajo 1.2.5 → 1.2.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -2,7 +2,7 @@ import lodash from 'lodash'
|
|
|
2
2
|
import fs from 'fs-extra'
|
|
3
3
|
import resolvePath from '../../lib/resolve-path.js'
|
|
4
4
|
|
|
5
|
-
const { isString, filter, map, trim, without, uniq, camelCase, isEmpty } = lodash
|
|
5
|
+
const { isString, filter, map, trim, without, uniq, camelCase, isEmpty, omit } = lodash
|
|
6
6
|
|
|
7
7
|
async function buildPlugins () {
|
|
8
8
|
let pluginPkgs = this.config.plugins ?? []
|
|
@@ -38,7 +38,7 @@ async function buildPlugins () {
|
|
|
38
38
|
this.pluginNames.push(plugin.name)
|
|
39
39
|
this.app.addPlugin(plugin)
|
|
40
40
|
}
|
|
41
|
-
|
|
41
|
+
this.config = omit(this.config, this.pluginNames)
|
|
42
42
|
}
|
|
43
43
|
|
|
44
44
|
export default buildPlugins
|
|
@@ -13,6 +13,7 @@ class BajoPlugin extends Plugin {
|
|
|
13
13
|
|
|
14
14
|
loadConfig = async () => {
|
|
15
15
|
const { defaultsDeep } = this.lib.aneka
|
|
16
|
+
const { get } = this.lib._
|
|
16
17
|
const { log, readJson, parseObject, getModuleDir } = this.app.bajo
|
|
17
18
|
log.trace('- %s', this.name)
|
|
18
19
|
const dir = this.name === this.app.bajo.mainNs ? (`${this.app.bajo.dir.base}/${this.app.bajo.mainNs}`) : getModuleDir(this.pkgName)
|
|
@@ -37,7 +38,9 @@ class BajoPlugin extends Plugin {
|
|
|
37
38
|
const altCfg = await readAllConfigs.call(this.app, `${this.app.bajo.dir.data}/config/${this.name}`)
|
|
38
39
|
cfg = defaultsDeep({}, omit(altCfg, omittedPluginKeys), cfg)
|
|
39
40
|
} catch (err) {}
|
|
40
|
-
const
|
|
41
|
+
const cfgEnv = omit(get(this, `app.env._.${this.name}`, {}), omittedPluginKeys) ?? {}
|
|
42
|
+
const cfgArgv = omit(get(this, `app.argv._.${this.name}`, {}), omittedPluginKeys) ?? {}
|
|
43
|
+
const envArgv = defaultsDeep({}, cfgEnv, cfgArgv)
|
|
41
44
|
cfg = defaultsDeep({}, envArgv ?? {}, cfg ?? {}, this.config ?? {})
|
|
42
45
|
this.title = this.title ?? cfg.title ?? this.alias
|
|
43
46
|
|