@yorha2b-lab/autodev 1.0.40 → 1.0.41

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/README.md CHANGED
@@ -143,6 +143,11 @@ module.exports = {
143
143
  visionModel: 'qwen3.5-plus',
144
144
  textModel: 'qwen-turbo',
145
145
 
146
+ // 自定义模板目录
147
+ // 如果为空,将使用内置模板
148
+ // 自定义模板需要在hbsdir目录创建自己的index.hbs和resource.hbs文件
149
+ hbsDir: '',
150
+
146
151
  // 目标项目的目录路径
147
152
  hooksDir: 'src/hooks',
148
153
  pagesDir: 'src/pages',
package/README_EN.md CHANGED
@@ -143,6 +143,11 @@ module.exports = {
143
143
  visionModel: 'qwen3.5-plus',
144
144
  textModel: 'qwen-turbo',
145
145
 
146
+ // Custom template directory path
147
+ // If empty, will use built-in templates
148
+ // Custom templates need to create their own index.hbs and resource.hbs files in the hbsdir directory
149
+ hbsDir: '',
150
+
146
151
  // Target project directory paths
147
152
  hooksDir: 'src/hooks',
148
153
  pagesDir: 'src/pages',
package/config.js CHANGED
@@ -16,6 +16,11 @@ module.exports = {
16
16
 
17
17
  textModel: 'qwen-turbo',
18
18
 
19
+ // 自定义模板目录
20
+ // 如果为空,将使用内置模板
21
+ // 自定义模板需要在hbsdir目录创建自己的index.hbs和resource.hbs文件
22
+ hbsDir: '',
23
+
19
24
  // 目标项目的 hooks 目录路径
20
25
  hooksDir: 'src/hooks',
21
26
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yorha2b-lab/autodev",
3
- "version": "1.0.40",
3
+ "version": "1.0.41",
4
4
  "description": "基于视觉大模型的前端(Umi+Antd)全自动 CRUD 代码生成器",
5
5
  "bin": {
6
6
  "autodev": "bin/autodev.js"
@@ -42,9 +42,12 @@ const watchPage = options => {
42
42
  const { index, resource } = require(compilerPath)
43
43
 
44
44
  try {
45
- copyTemplateDir(options, 'hooks', config.hooksDir)
46
- copyTemplateDir(options, 'utils', config.utilsDir)
47
- copyTemplateDir(options, 'components', config.componentsDir)
45
+ //默认使用内置模板
46
+ if (config.hbsDir === '') {
47
+ copyTemplateDir(options, 'hooks', config.hooksDir)
48
+ copyTemplateDir(options, 'utils', config.utilsDir)
49
+ copyTemplateDir(options, 'components', config.componentsDir)
50
+ }
48
51
  } catch (error) {
49
52
  console.error(language('❌ 程序运行出错:', '❌ Runtime error:'), error)
50
53
  }
@@ -52,7 +55,7 @@ const watchPage = options => {
52
55
  const queue = createTaskQueue(2)
53
56
  const menus = getExistingMenus()
54
57
 
55
- const tplDir = path.join(__dirname, `../../templates/${options.template}`)
58
+ const tplDir = config.hbsDir !== '' ? path.join(process.cwd(), config.hbsDir) : path.join(__dirname, `../../templates/${options.template}`)
56
59
  const indexTpl = Handlebars.compile(fs.readFileSync(path.join(tplDir, 'index.hbs'), 'utf-8'))
57
60
  const resourceTpl = Handlebars.compile(fs.readFileSync(path.join(tplDir, 'resource.hbs'), 'utf-8'))
58
61