bajo 0.2.26 → 0.2.27
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/boot/run-tool.js +9 -2
- package/package.json +1 -1
package/boot/run-tool.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { isString, map, find } from 'lodash-es'
|
|
2
|
+
import Path from 'path'
|
|
2
3
|
const tools = []
|
|
3
4
|
|
|
4
5
|
async function runTool () {
|
|
@@ -27,8 +28,14 @@ async function runTool () {
|
|
|
27
28
|
if (!tool) print.fatal('Sidetool \'%s\' not found. Aborted!', name)
|
|
28
29
|
const opts = { ns, toc, path, params, args: config.args }
|
|
29
30
|
const mod = await importModule(tool.file)
|
|
30
|
-
|
|
31
|
-
|
|
31
|
+
if (mod === 'defCliHandler' && this.bajoCli) {
|
|
32
|
+
const { runToolMethod } = this.bajoCli.helper
|
|
33
|
+
const dir = `${Path.dirname(tool.file)}/tool`
|
|
34
|
+
await runToolMethod({ path, args: config.args, dir })
|
|
35
|
+
} else {
|
|
36
|
+
const handler = mod.handler ?? mod
|
|
37
|
+
await handler.call(this, opts)
|
|
38
|
+
}
|
|
32
39
|
}
|
|
33
40
|
|
|
34
41
|
export default runTool
|