Skip to content

Commit 48396f9

Browse files
committed
Update data.json in zh and add Workflow checking
1 parent 613a73c commit 48396f9

3 files changed

Lines changed: 120 additions & 130 deletions

File tree

Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
name: Validate JSON Files
2+
3+
on:
4+
push:
5+
paths:
6+
- '**/*.json'
7+
pull_request:
8+
paths:
9+
- '**/*.json'
10+
workflow_dispatch: # Allows manual triggering
11+
12+
jobs:
13+
validate-json:
14+
runs-on: ubuntu-latest
15+
16+
steps:
17+
- name: Checkout repository
18+
uses: actions/checkout@v4
19+
20+
- name: Setup Node.js
21+
uses: actions/setup-node@v4
22+
with:
23+
node-version: '18'
24+
25+
- name: Install dependencies
26+
run: npm install -g ajv-cli ajv-formats
27+
28+
- name: Create JSON schema for validation
29+
run: |
30+
cat > schema.json << 'EOL'
31+
{
32+
"$schema": "http://json-schema.org/draft-07/schema#",
33+
"type": "array",
34+
"items": {
35+
"type": "object",
36+
"required": ["version", "new"],
37+
"properties": {
38+
"version": {
39+
"type": "string",
40+
"pattern": "^\\d+\\.\\d+$|^\\d+\\.\\d+\\.\\d+$"
41+
},
42+
"subVersion": {
43+
"type": "string",
44+
"pattern": "^\\d+\\.\\d+\\.\\d+$"
45+
},
46+
"new": {
47+
"type": "array",
48+
"items": {
49+
"type": "object",
50+
"required": ["icon", "title", "subtitle", "body"],
51+
"properties": {
52+
"icon": { "type": "string" },
53+
"title": { "type": "string" },
54+
"subtitle": { "type": "string" },
55+
"body": { "type": "string" }
56+
}
57+
},
58+
"minItems": 1
59+
}
60+
}
61+
},
62+
"minItems": 1
63+
}
64+
EOL
65+
66+
- name: Find and validate data.json files
67+
run: |
68+
echo "Validating JSON files..."
69+
for FILE in $(find Demo -name "data.json"); do
70+
echo "Checking $FILE"
71+
# Check JSON syntax
72+
if ! jq empty "$FILE" 2>/dev/null; then
73+
echo "❌ Invalid JSON syntax in $FILE"
74+
exit 1
75+
fi
76+
77+
# Validate against schema
78+
if ! npx ajv -s schema.json -d "$FILE" --strict=false; then
79+
echo "❌ $FILE does not match the required schema"
80+
exit 1
81+
else
82+
echo "✅ $FILE is valid"
83+
fi
84+
done
85+
86+
echo "All JSON files are valid! 🎉"

Demo/What's New?/zh-Hans.lproj/data.json

Lines changed: 17 additions & 65 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
[
22
{
3-
"version": "5.5",
4-
"subVersion": "5.5.0",
3+
"version": "6.0",
4+
"subVersion": "6.0.0",
55
"new": [
66
{
7-
"icon": "snowflake",
8-
"title": "飘雪",
7+
"icon": "wineglass",
8+
"title": "玻璃",
99
"subtitle": "效果",
10-
"body": "更多特别效果即将推出!"
10+
"body": "即将推出!"
1111
},
1212
{
1313
"icon": "macpro.gen3.server",
@@ -23,6 +23,18 @@
2323
}
2424
]
2525
},
26+
{
27+
"version": "5.5",
28+
"subVersion": "5.5.0",
29+
"new": [
30+
{
31+
"icon": "snowflake",
32+
"title": "飘雪",
33+
"subtitle": "效果",
34+
"body": "更多特别效果即将推出!"
35+
}
36+
]
37+
},
2638
{
2739
"version": "5.4",
2840
"subVersion": "5.4.0",
@@ -86,18 +98,6 @@
8698
"title": "终结",
8799
"subtitle": "支援",
88100
"body": "iOS14, watchOS7, and macOS11。"
89-
},
90-
{
91-
"icon": "macpro.gen3.server",
92-
"title": "无服务器",
93-
"subtitle": "设计",
94-
"body": "免费开源! ❤️‍🔥"
95-
},
96-
{
97-
"icon": "arrow.triangle.pull",
98-
"title": "贡献",
99-
"subtitle": "一起",
100-
"body": "提出请求,变得更好! 🎉"
101101
}
102102
]
103103
},
@@ -110,18 +110,6 @@
110110
"title": "小型",
111111
"subtitle": "更新",
112112
"body": "一些错误修正和UI更新"
113-
},
114-
{
115-
"icon": "macpro.gen3.server",
116-
"title": "无服务器",
117-
"subtitle": "设计",
118-
"body": "免费开源! ❤️‍🔥"
119-
},
120-
{
121-
"icon": "arrow.triangle.pull",
122-
"title": "贡献",
123-
"subtitle": "一起",
124-
"body": "提出请求,变得更好! 🎉"
125113
}
126114
]
127115
},
@@ -134,18 +122,6 @@
134122
"title": "支持 Vision Pro",
135123
"subtitle": "和 visionOS",
136124
"body": "Drops Framework 由于冲突而被临时禁用。"
137-
},
138-
{
139-
"icon": "macpro.gen3.server",
140-
"title": "无服务器",
141-
"subtitle": "设计",
142-
"body": "免费开源! ❤️‍🔥"
143-
},
144-
{
145-
"icon": "arrow.triangle.pull",
146-
"title": "贡献",
147-
"subtitle": "一起",
148-
"body": "提出请求,变得更好! 🎉"
149125
}
150126
]
151127
},
@@ -158,18 +134,6 @@
158134
"title": "更好兼容性",
159135
"subtitle": "在版本和构建中",
160136
"body": "您现在可以使用 x.y.z 或 x.y。"
161-
},
162-
{
163-
"icon": "macpro.gen3.server",
164-
"title": "无服务器",
165-
"subtitle": "设计",
166-
"body": "免费开源! ❤️‍🔥"
167-
},
168-
{
169-
"icon": "arrow.triangle.pull",
170-
"title": "贡献",
171-
"subtitle": "一起",
172-
"body": "提出请求,变得更好! 🎉"
173137
}
174138
]
175139
},
@@ -187,18 +151,6 @@
187151
"title": "演示",
188152
"subtitle": "现在好多了",
189153
"body": "遵循包版本。"
190-
},
191-
{
192-
"icon": "macpro.gen3.server",
193-
"title": "无服务器",
194-
"subtitle": "设计",
195-
"body": "免费开源! ❤️‍🔥"
196-
},
197-
{
198-
"icon": "arrow.triangle.pull",
199-
"title": "贡献",
200-
"subtitle": "一起",
201-
"body": "提出请求,变得更好! 🎉"
202154
}
203155
]
204156
}

Demo/What's New?/zh-Hant.lproj/data.json

Lines changed: 17 additions & 65 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
[
22
{
3-
"version": "5.5",
4-
"subVersion": "5.5.0",
3+
"version": "6.0",
4+
"subVersion": "6.0.0",
55
"new": [
66
{
7-
"icon": "snowflake",
8-
"title": "飄雪",
7+
"icon": "wineglass",
8+
"title": "玻璃",
99
"subtitle": "效果",
10-
"body": "更多特別效果即將推出!"
10+
"body": "即將推出!"
1111
},
1212
{
1313
"icon": "macpro.gen3.server",
@@ -23,6 +23,18 @@
2323
}
2424
]
2525
},
26+
{
27+
"version": "5.5",
28+
"subVersion": "5.5.0",
29+
"new": [
30+
{
31+
"icon": "snowflake",
32+
"title": "飄雪",
33+
"subtitle": "效果",
34+
"body": "更多特別效果即將推出!"
35+
}
36+
]
37+
},
2638
{
2739
"version": "5.4",
2840
"subVersion": "5.4.0",
@@ -86,18 +98,6 @@
8698
"title": "終結",
8799
"subtitle": "支援",
88100
"body": "iOS14, watchOS7, and macOS11。"
89-
},
90-
{
91-
"icon": "macpro.gen3.server",
92-
"title": "無服務器",
93-
"subtitle": "設計",
94-
"body": "免費開源! ❤️‍🔥"
95-
},
96-
{
97-
"icon": "arrow.triangle.pull",
98-
"title": "貢獻",
99-
"subtitle": "一起",
100-
"body": "提出請求,變得更好! 🎉"
101101
}
102102
]
103103
},
@@ -110,18 +110,6 @@
110110
"title": "小型",
111111
"subtitle": "更新",
112112
"body": "一些錯誤修正和UI更新"
113-
},
114-
{
115-
"icon": "macpro.gen3.server",
116-
"title": "無服務器",
117-
"subtitle": "設計",
118-
"body": "免費開源! ❤️‍🔥"
119-
},
120-
{
121-
"icon": "arrow.triangle.pull",
122-
"title": "貢獻",
123-
"subtitle": "一起",
124-
"body": "提出請求,變得更好! 🎉"
125113
}
126114
]
127115
},
@@ -134,18 +122,6 @@
134122
"title": "支持 Vision Pro",
135123
"subtitle": "和 visionOS",
136124
"body": "Drops Framework 由於衝突而被臨時禁用。"
137-
},
138-
{
139-
"icon": "macpro.gen3.server",
140-
"title": "無服務器",
141-
"subtitle": "設計",
142-
"body": "免費開源! ❤️‍🔥"
143-
},
144-
{
145-
"icon": "arrow.triangle.pull",
146-
"title": "貢獻",
147-
"subtitle": "一起",
148-
"body": "提出請求,變得更好! 🎉"
149125
}
150126
]
151127
},
@@ -158,18 +134,6 @@
158134
"title": "更好兼容性",
159135
"subtitle": "在版本和構建中",
160136
"body": "您現在可以使用 x.y.z 或 x.y。"
161-
},
162-
{
163-
"icon": "macpro.gen3.server",
164-
"title": "無服務器",
165-
"subtitle": "設計",
166-
"body": "免費開源! ❤️‍🔥"
167-
},
168-
{
169-
"icon": "arrow.triangle.pull",
170-
"title": "貢獻",
171-
"subtitle": "一起",
172-
"body": "提出請求,變得更好! 🎉"
173137
}
174138
]
175139
},
@@ -187,18 +151,6 @@
187151
"title": "演示",
188152
"subtitle": "現在好多了",
189153
"body": "遵循包版本。"
190-
},
191-
{
192-
"icon": "macpro.gen3.server",
193-
"title": "無服務器",
194-
"subtitle": "設計",
195-
"body": "免費開源! ❤️‍🔥"
196-
},
197-
{
198-
"icon": "arrow.triangle.pull",
199-
"title": "貢獻",
200-
"subtitle": "一起",
201-
"body": "提出請求,變得更好! 🎉"
202154
}
203155
]
204156
}

0 commit comments

Comments
 (0)