@yorha2b-lab/autodev 5.3.1 → 5.4.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 CHANGED
@@ -20,7 +20,7 @@ program
20
20
  .description(dialog.bunker.initDesc)
21
21
  .action(() => {
22
22
  const battlefield = {
23
- dirs: ['response', 'screenShot', 'screenPart'],
23
+ dirs: [],
24
24
  files: [
25
25
  { from: '.env.example', to: '.env', exist: 'envCheck', success: 'envCopy' },
26
26
  { from: 'config.js', to: 'config.js', exist: 'configCheck', success: 'configCopy' }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yorha2b-lab/autodev",
3
- "version": "5.3.1",
3
+ "version": "5.4.0",
4
4
  "description": "基于视觉大模型的前端(react+Antd)全自动 CRUD 代码生成器",
5
5
  "bin": {
6
6
  "autodev": "bin/autodev.js"
@@ -1,9 +1,13 @@
1
- module.exports = ({ config, yorha, dialog, template, foundation }) => {
1
+ const fs = require('fs')
2
+ const path = require('path')
3
+
4
+ module.exports = ({ yorha, config, dialog, handlers, template, foundation }) => {
2
5
 
3
6
  const { copyTemplateDir } = foundation
4
7
  const { hbsDir, hooksDir, utilsDir, componentsDir } = config
5
8
 
6
9
  try {
10
+ Object.values(handlers).forEach(handler => fs.mkdirSync(path.join(process.cwd(), handler.watch), { recursive: true }))
7
11
  if (hbsDir === '') {
8
12
  copyTemplateDir(template, 'hooks', hooksDir)
9
13
  copyTemplateDir(template, 'utils', utilsDir)
@@ -8,6 +8,7 @@ module.exports = () => {
8
8
  const ctx = bootstrap.get()
9
9
 
10
10
  const queue = ctx.core.createTaskQueue(2)
11
+ const routes = Object.values(ctx.handlers)
11
12
 
12
13
  queue.onIdle(() => {
13
14
  ctx.yorha.pod042.report(ctx.dialog.pod042.queueEmpty)
@@ -25,12 +26,10 @@ module.exports = () => {
25
26
  }
26
27
 
27
28
  const fileWatcher = chokidar.watch(['./config.js'], options)
28
- const dirWatcher = chokidar.watch(['./screenShot', './screenPart', './response'], options)
29
+ const dirWatcher = chokidar.watch(routes.map(route => `${route.watch}`), options)
29
30
 
30
31
  ctx.yorha.operator6O.report(ctx.dialog.operator6O.call2B)
31
32
 
32
- const routes = Object.values(ctx.handlers)
33
-
34
33
  dirWatcher.on('add', filePath => {
35
34
  const absolutePath = path.resolve(filePath)
36
35
  const route = routes.find(route => absolutePath.includes(route.watch))