bajo 1.1.5 → 1.1.7
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.
package/bajo/intl/en-US.json
CHANGED
|
@@ -157,5 +157,11 @@
|
|
|
157
157
|
"fileNotModuleHandler%s": "File '%s' is NOT a module handler",
|
|
158
158
|
"error%s%s%s": "%s error (%s): %s",
|
|
159
159
|
"invalid%s%s": "Invalid %s (%s)",
|
|
160
|
-
"demo": "Demo"
|
|
160
|
+
"demo": "Demo",
|
|
161
|
+
"documentation": "Documentation",
|
|
162
|
+
"info": "Info",
|
|
163
|
+
"main": "Main",
|
|
164
|
+
"usage": "Usage",
|
|
165
|
+
"monitoring": "Monitoring",
|
|
166
|
+
"faq": "F.A.Q"
|
|
161
167
|
}
|
package/bajo/intl/id.json
CHANGED
|
@@ -157,5 +157,11 @@
|
|
|
157
157
|
"fileNotModuleHandler%s": "Berkas '%s' BUKAN merupakan module handler",
|
|
158
158
|
"error%s%s%s": "Kesalahan %s (%s): %s",
|
|
159
159
|
"invalid%s%s": "%s tidak valid (%s)",
|
|
160
|
-
"demo": "Demo"
|
|
160
|
+
"demo": "Demo",
|
|
161
|
+
"documentation": "Dokumentasi",
|
|
162
|
+
"info": "Info",
|
|
163
|
+
"main": "Utama",
|
|
164
|
+
"usage": "Pemakaian",
|
|
165
|
+
"monitoring": "Pemantauan",
|
|
166
|
+
"faq": "Tanya Jawab"
|
|
161
167
|
}
|
package/boot/class/app.js
CHANGED
|
@@ -36,7 +36,7 @@ export async function buildBaseConfig () {
|
|
|
36
36
|
this.applet = this.app.argv._.applet
|
|
37
37
|
this.config = this.defaultsDeep({}, this.app.env._, this.app.argv._)
|
|
38
38
|
this.alias = this.name
|
|
39
|
-
set(this, 'dir.base', this.app.
|
|
39
|
+
set(this, 'dir.base', this.app.dir)
|
|
40
40
|
const path = currentLoc(import.meta).dir + '/../../..'
|
|
41
41
|
set(this, 'dir.pkg', this.resolvePath(path))
|
|
42
42
|
if (!get(this, 'dir.data')) set(this, 'dir.data', `${this.dir.base}/data`)
|
package/boot/class/bajo-core.js
CHANGED
|
@@ -377,14 +377,14 @@ class BajoCore extends Plugin {
|
|
|
377
377
|
}
|
|
378
378
|
|
|
379
379
|
getModuleDir = (pkgName, base) => {
|
|
380
|
-
if (pkgName === 'main') return resolvePath(
|
|
381
|
-
if (base === 'main') base =
|
|
380
|
+
if (pkgName === 'main') return resolvePath(this.app.dir)
|
|
381
|
+
if (base === 'main') base = this.app.dir
|
|
382
382
|
else if (this && this.app && this.app[base]) base = this.app[base].pkgName
|
|
383
383
|
const pkgPath = pkgName + '/package.json'
|
|
384
384
|
const paths = require.resolve.paths(pkgPath)
|
|
385
385
|
const gdir = this.getGlobalModuleDir()
|
|
386
386
|
paths.unshift(gdir)
|
|
387
|
-
paths.unshift(resolvePath(path.join(
|
|
387
|
+
paths.unshift(resolvePath(path.join(this.app.dir, 'node_modules')))
|
|
388
388
|
let dir = this.findDeep(pkgPath, paths)
|
|
389
389
|
if (base && !dir) dir = this.findDeep(`${base}/node_modules/${pkgPath}`, paths)
|
|
390
390
|
if (!dir) return null
|
|
@@ -503,7 +503,7 @@ class BajoCore extends Plugin {
|
|
|
503
503
|
}
|
|
504
504
|
|
|
505
505
|
isValidApp = (dir) => {
|
|
506
|
-
if (!dir) dir =
|
|
506
|
+
if (!dir) dir = this.app.dir
|
|
507
507
|
dir = resolvePath(dir)
|
|
508
508
|
const hasMainDir = fs.existsSync(`${dir}/main/plugin`)
|
|
509
509
|
const hasPackageJson = fs.existsSync(`${dir}/package.json`)
|
|
@@ -511,7 +511,7 @@ class BajoCore extends Plugin {
|
|
|
511
511
|
}
|
|
512
512
|
|
|
513
513
|
isValidPlugin = (dir) => {
|
|
514
|
-
if (!dir) dir =
|
|
514
|
+
if (!dir) dir = this.app.dir
|
|
515
515
|
dir = resolvePath(dir)
|
|
516
516
|
const hasPluginDir = fs.existsSync(`${dir}/plugin`)
|
|
517
517
|
const hasPackageJson = fs.existsSync(`${dir}/package.json`)
|
|
@@ -32,7 +32,7 @@ class BajoPlugin extends Plugin {
|
|
|
32
32
|
['name', 'version', 'description', 'author', 'license', 'homepage'])
|
|
33
33
|
if (this.name === this.app.bajo.mainNs) {
|
|
34
34
|
this.alias = this.app.bajo.mainNs
|
|
35
|
-
this.title =
|
|
35
|
+
this.title = this.alias
|
|
36
36
|
}
|
|
37
37
|
// merge with config from datadir
|
|
38
38
|
try {
|
|
@@ -41,7 +41,7 @@ class BajoPlugin extends Plugin {
|
|
|
41
41
|
} catch (err) {}
|
|
42
42
|
const envArgv = defaultsDeep({}, omit(this.app.env[this.name] ?? {}, omittedPluginKeys) ?? {}, omit(this.app.argv[this.name] ?? {}, omittedPluginKeys) ?? {})
|
|
43
43
|
cfg = defaultsDeep({}, envArgv ?? {}, cfg ?? {}, this.config ?? {})
|
|
44
|
-
this.title = this.title ?? cfg.title ?? this.
|
|
44
|
+
this.title = this.title ?? cfg.title ?? this.alias
|
|
45
45
|
|
|
46
46
|
this.dependencies = this.dependencies ?? []
|
|
47
47
|
const depFile = `${dir}/plugin/.dependencies`
|
package/boot/class/log.js
CHANGED
|
@@ -54,6 +54,10 @@ class Log {
|
|
|
54
54
|
data = null
|
|
55
55
|
}
|
|
56
56
|
args = without(args, undefined)
|
|
57
|
+
if (data instanceof Error) {
|
|
58
|
+
msg = 'error%s'
|
|
59
|
+
args = [data.message]
|
|
60
|
+
}
|
|
57
61
|
msg = `[${this.plugin.name}] ${this.write(msg, ...args)}`
|
|
58
62
|
if (this.plugin.app[this.bajoLog] && this.plugin.app[this.bajoLog].logger) {
|
|
59
63
|
this.plugin.app[this.bajoLog].logger[level](data, msg, ...args)
|
|
@@ -69,7 +73,10 @@ class Log {
|
|
|
69
73
|
text = `[${dayjs(dt).utc(true).format(this.format)}] ${upperFirst(level)}: ${msg}`
|
|
70
74
|
if (!isEmpty(data)) text += '\n' + JSON.stringify(data)
|
|
71
75
|
}
|
|
72
|
-
if (!this.isIgnored(level))
|
|
76
|
+
if (!this.isIgnored(level)) {
|
|
77
|
+
console.log(text)
|
|
78
|
+
if (data instanceof Error && level === 'trace') console.error(data)
|
|
79
|
+
}
|
|
73
80
|
}
|
|
74
81
|
}
|
|
75
82
|
}
|