@yorha2b-lab/autodev 2.0.7 → 2.0.9

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.
@@ -0,0 +1,52 @@
1
+ name: GitHub Repo Stats
2
+
3
+ on:
4
+ schedule:
5
+ - cron: '45 19 * * *'
6
+ workflow_dispatch:
7
+
8
+ # 💡 在这里全局开启 Node.js 24 强制模式,消灭警告
9
+ env:
10
+ FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: true
11
+
12
+ jobs:
13
+ run-stats:
14
+ runs-on: ubuntu-latest
15
+ permissions:
16
+ contents: write
17
+ steps:
18
+ - name: Checkout main
19
+ uses: actions/checkout@v4 # 已经是最新版
20
+
21
+ - name: run-ghrs
22
+ uses: jgehrcke/github-repo-stats@v1.4.1
23
+ with:
24
+ repository: ${{ github.repository }}
25
+ ghtoken: ${{ secrets.STATS_TOKEN }}
26
+ databranch: github-repo-stats
27
+
28
+ - name: Clean and Format Stats Branch
29
+ run: |
30
+ git fetch origin github-repo-stats
31
+ git checkout github-repo-stats
32
+
33
+ mkdir -p ../temp_backup
34
+ REPORT_DIR=$(find . -type d -name "latest-report" | head -n 1)
35
+ DATA_DIR=$(find . -type d -name "ghrs-data" | head -n 1)
36
+ PLOT_DIR=$(find . -type d -name "plots" | head -n 1)
37
+
38
+ if [ -d "$REPORT_DIR" ]; then sudo cp -r $REPORT_DIR/* ../temp_backup/; fi
39
+ if [ -d "$DATA_DIR" ]; then sudo cp -r $DATA_DIR ../temp_backup/; fi
40
+ if [ -d "$PLOT_DIR" ]; then sudo cp -r $PLOT_DIR ../temp_backup/; fi
41
+
42
+ sudo rm -rf *
43
+ sudo rm -rf .github .env.example .gitignore .npmignore
44
+ sudo cp -r ../temp_backup/* .
45
+ if [ -f "report.md" ]; then sudo mv report.md README.md; fi
46
+ sudo chown -R runner:docker .
47
+
48
+ git config user.name github-actions
49
+ git config user.email github-actions@github.com
50
+ git add -A
51
+ git commit -m "style: clean stable stats with node24" || echo "no changes"
52
+ git push origin github-repo-stats --force
package/bin/autodev.js CHANGED
@@ -6,8 +6,6 @@ const { program } = require('commander')
6
6
  const pkg = require(path.join(__dirname, '../package.json'))
7
7
  const { language, matrixEffect, bootSequence } = require(path.join(__dirname, '../src/utils/utils.js'))
8
8
 
9
- bootSequence(pkg.version)
10
-
11
9
  program
12
10
  .version(pkg.version)
13
11
  .description(language('AI驱动的前端CRUD代码生成器', 'AI-powered frontend CRUD code generator'))
@@ -53,6 +51,7 @@ program
53
51
  .alias('start')
54
52
  .description(language('开启全频道联动监控:支持 Page/Part/API 协同构筑', 'Start full-channel linked monitoring: Coordinated Page/Part/API construction'))
55
53
  .action(() => {
54
+ bootSequence(pkg.version)
56
55
  const watch = require('../src/commands/watch')
57
56
  watch(program.opts())
58
57
  process.on('SIGINT', () => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yorha2b-lab/autodev",
3
- "version": "2.0.7",
3
+ "version": "2.0.9",
4
4
  "description": "基于视觉大模型的前端(react+Antd)全自动 CRUD 代码生成器",
5
5
  "bin": {
6
6
  "autodev": "bin/autodev.js"
@@ -8,14 +8,18 @@ module.exports = `
8
8
  ## 1. 表格 (Table)
9
9
  - 结构: { columns: [{ title: '', dataIndex: '' }] }
10
10
  - ⚠️ 字段白名单: [title, dataIndex, sorter, render, filters, onFilter]
11
- - 禁止输出: 严禁在 columns 中包含“操作”列。
11
+ - 禁止输出:
12
+ - 严禁在 columns 中包含“操作”列。
13
+ - ***⚠️⚠️⚠️严禁输出formItems,只允许输出coloumns⚠️⚠️⚠️***
12
14
  - 特殊逻辑:
13
15
  - 时间列: render 必须为 _CODE_text=>timeRender({time:text})_CODE_
14
16
  - 序号列: render 必须为 _CODE_(_, record, index) => index + 1_CODE_
15
- - 下拉映射列: render 必须为 _CODE_text=>对应的options.find(item=>item.value===text)?.label_CODE_
17
+ - 下拉映射列: render 必须为 _CODE_text=>字段英文名Options.find(item=>item.value===text)?.label_CODE_
16
18
 
17
19
  ## 2. 表单 (Form)
18
20
  - 结构: formItems: [{label:'',name:'',type:'',options:[]}]
21
+ - 禁止输出:
22
+ - ***⚠️⚠️⚠️严禁输出columns,只允许输出formItems⚠️⚠️⚠️***
19
23
  - ⚠️ 属性精简规则:
20
24
  - 默认输入框: 仅保留 [label, name] 属性。**严禁出现 type 属性**。
21
25
  - 非默认组件: 仅当类型为 [auto, date, radio, select, upload, checkbox, textarea, daterange] 时才允许添加 type 属性。
@@ -27,6 +31,6 @@ module.exports = `
27
31
  - 文字单位: 若项末尾有单位(如 元/kg),必须存入 unit 属性。
28
32
 
29
33
  ## 3. 下拉选项字典 (OptionDict)
30
- - 结构: optionDict: { _CODE_字段名Options_CODE_: [] }
34
+ - 结构: optionDict: { _CODE_字段英文名Options_CODE_: [] }
31
35
  - 内容: 数组元素必须为 {label: '', value: ''} 格式。
32
36
  `
@@ -45,16 +45,6 @@ export const timeRender = ({ time, date, minute }) => {
45
45
  }
46
46
  }
47
47
 
48
- export const moneyRender = (value, { decimals = 2, showSymbol = true } = {}) => {
49
- if (value === null || value === undefined || value === '') return '-'
50
- const number = Number(value)
51
- if (isNaN(number)) return '-'
52
- const options = showSymbol
53
- ? { style: 'currency', currency: 'CNY', minimumFractionDigits: decimals }
54
- : { style: 'decimal', minimumFractionDigits: decimals, maximumFractionDigits: decimals }
55
- return new Intl.NumberFormat('zh-CN', options).format(number)
56
- }
57
-
58
48
  export const exportDataToExcel = async (url, options, columns, fileName, resultKey = 'data') => {
59
49
  /* const response = await request(url, options)
60
50
  if (response?.[resultKey]?.length > 0) {
@@ -62,10 +52,10 @@ export const exportDataToExcel = async (url, options, columns, fileName, resultK
62
52
  const datas = response?.[resultKey]?.map(item => Object.fromEntries(columns.map(col => {
63
53
  let value = item[col.dataIndex]
64
54
  if (col.exportRender) {
65
- value = col.exportRender(value, item, index)
55
+ value = col.exportRender(value, item)
66
56
  }
67
57
  if (col.render) {
68
- const rendered = col.render(value, item, index)
58
+ const rendered = col.render(value, item)
69
59
  value = typeof rendered === 'object' ? (rendered?.props?.children || value) : rendered
70
60
  }
71
61
  return [col.title, value]
@@ -79,6 +69,16 @@ export const exportDataToExcel = async (url, options, columns, fileName, resultK
79
69
  } */
80
70
  }
81
71
 
72
+ export const moneyRender = (value, { decimals = 2, currency = 'CNY', language = 'zh-CN', showSymbol = true } = {}) => {
73
+ if (value === null || value === undefined || value === '') return '-'
74
+ const number = Number(value)
75
+ if (isNaN(number)) return '-'
76
+ const options = showSymbol
77
+ ? { style: 'currency', currency, minimumFractionDigits: decimals }
78
+ : { style: 'decimal', minimumFractionDigits: decimals, maximumFractionDigits: decimals }
79
+ return new Intl.NumberFormat(language, options).format(number)
80
+ }
81
+
82
82
  export const formatUnit = (value, { k = 1024, units = ['B', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB'], decimals = 2 } = {}) => {
83
83
  if (value === null || value === undefined || isNaN(value) || value === 0) {
84
84
  return `0 ${units[0] ?? ''}`