@yorha2b-lab/autodev 2.0.8 → 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/package.json
CHANGED
|
@@ -10,7 +10,7 @@ module.exports = `
|
|
|
10
10
|
- ⚠️ 字段白名单: [title, dataIndex, sorter, render, filters, onFilter]
|
|
11
11
|
- 禁止输出:
|
|
12
12
|
- 严禁在 columns 中包含“操作”列。
|
|
13
|
-
-
|
|
13
|
+
- ***⚠️⚠️⚠️严禁输出formItems,只允许输出coloumns⚠️⚠️⚠️***
|
|
14
14
|
- 特殊逻辑:
|
|
15
15
|
- 时间列: render 必须为 _CODE_text=>timeRender({time:text})_CODE_
|
|
16
16
|
- 序号列: render 必须为 _CODE_(_, record, index) => index + 1_CODE_
|
|
@@ -19,7 +19,7 @@ module.exports = `
|
|
|
19
19
|
## 2. 表单 (Form)
|
|
20
20
|
- 结构: formItems: [{label:'',name:'',type:'',options:[]}]
|
|
21
21
|
- 禁止输出:
|
|
22
|
-
-
|
|
22
|
+
- ***⚠️⚠️⚠️严禁输出columns,只允许输出formItems⚠️⚠️⚠️***
|
|
23
23
|
- ⚠️ 属性精简规则:
|
|
24
24
|
- 默认输入框: 仅保留 [label, name] 属性。**严禁出现 type 属性**。
|
|
25
25
|
- 非默认组件: 仅当类型为 [auto, date, radio, select, upload, checkbox, textarea, daterange] 时才允许添加 type 属性。
|
|
@@ -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
|
|
55
|
+
value = col.exportRender(value, item)
|
|
66
56
|
}
|
|
67
57
|
if (col.render) {
|
|
68
|
-
const rendered = col.render(value, item
|
|
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] ?? ''}`
|