@yorha2b-lab/autodev 5.4.0 → 5.5.0
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/bin/autodev.js +3 -1
- package/package.json +1 -1
- package/src/bootstrap/index.js +2 -2
- package/src/utils/foundation.js +3 -2
- package/src/bootstrap/registry.js +0 -14
package/bin/autodev.js
CHANGED
|
@@ -4,9 +4,11 @@ const path = require('path')
|
|
|
4
4
|
const chalk = require('chalk')
|
|
5
5
|
const pkg = require('../package.json')
|
|
6
6
|
const { program } = require('commander')
|
|
7
|
+
|
|
8
|
+
const { discover } = require('../src/utils/foundation')
|
|
7
9
|
const { local, matrixEffect, bootSequence } = require('../src/utils/ux')
|
|
8
10
|
|
|
9
|
-
const dialogs =
|
|
11
|
+
const dialogs = discover(path.join(__dirname, '../src/dialogs'))
|
|
10
12
|
const dialog = dialogs[local] ?? dialogs['EN-US']
|
|
11
13
|
|
|
12
14
|
program
|
package/package.json
CHANGED
package/src/bootstrap/index.js
CHANGED
|
@@ -27,9 +27,9 @@ module.exports = {
|
|
|
27
27
|
openAI: require('./openai')(),
|
|
28
28
|
core: require('../utils/core'),
|
|
29
29
|
menus: foundation.getExistingMenus(),
|
|
30
|
+
handlers: foundation.discover(path.join(__dirname, '../handlers')),
|
|
30
31
|
handlebars: require('./handlebar')({ config, template, ...foundation }),
|
|
31
|
-
|
|
32
|
-
prompts: require('./registry')({ dir: path.join(__dirname, `../framework/${template}/prompts`) }),
|
|
32
|
+
prompts: foundation.discover(path.join(__dirname, `../framework/${template}/prompts`)),
|
|
33
33
|
}
|
|
34
34
|
|
|
35
35
|
require('./foundation')(accessPoint)
|
package/src/utils/foundation.js
CHANGED
|
@@ -11,7 +11,6 @@ const fs = require('fs')
|
|
|
11
11
|
const path = require('path')
|
|
12
12
|
const stringify = require('json-stringify-pretty-compact')
|
|
13
13
|
|
|
14
|
-
|
|
15
14
|
/**
|
|
16
15
|
* 获取项目配置信息
|
|
17
16
|
* 优先读取项目根目录的 config.js,如果不存在则使用默认配置
|
|
@@ -63,4 +62,6 @@ const copyTemplateDir = (template, templateSubDir, targetSubDir) => {
|
|
|
63
62
|
|
|
64
63
|
const contextStringify = ({ context, indent = 4, maxLength = 200 }) => stringify.default(context, { indent, maxLength })
|
|
65
64
|
|
|
66
|
-
|
|
65
|
+
const discover = dir => Object.fromEntries(fs.readdirSync(dir).filter(file => file.endsWith('.js')).map(file => [path.basename(file, '.js'), require(path.join(dir, file))]))
|
|
66
|
+
|
|
67
|
+
module.exports = { discover, getConfig, getExistingMenus, copyTemplateDir, contextStringify }
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
module.exports = ({ dir }) => {
|
|
2
|
-
|
|
3
|
-
const fs = require('fs')
|
|
4
|
-
const path = require('path')
|
|
5
|
-
|
|
6
|
-
return Object.fromEntries(
|
|
7
|
-
fs.readdirSync(dir)
|
|
8
|
-
.filter(file => file.endsWith('.js'))
|
|
9
|
-
.map(file => [
|
|
10
|
-
path.basename(file, '.js'),
|
|
11
|
-
require(path.join(dir, file))
|
|
12
|
-
])
|
|
13
|
-
)
|
|
14
|
-
}
|