forked from wwsheng009/yao-app-ts-types
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmake_schemas.sh
executable file
·51 lines (45 loc) · 1.57 KB
/
make_schemas.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
#!/bin/bash
pnpm run build
# convert the typescript type to json-schema files
# format : sourcefile|type|targetfile
#
array=(
"api_http|YaoHttp.HttpDSL|api_http.json"
# "api_rest|YaoRest.RestDSL|api_rest.json"
"form||YaoForm.FormDSL|form.json"
"table|YaoTable.TableDSL|table.json"
"app|YaoApp.AppDSL|app.json"
"chart|YaoChart.ChartDSL|chart.json"
"connector|YaoConnector.ConnectorDSL|connector.json"
"dashboard|YaoDashboard.DashboardDSL|dashboard.json"
"flow|YaoFlow.Flow|flow.json"
"form|YaoForm.FormDSL|form.json"
"importer|YaoImport.Importer|importer.json"
"list|YaoList.ListDSL|list.json"
"login|YaoLogin.LoginDSL|login.json"
"model|YaoModel.ModelDSL|model.json"
"query_param|YaoQueryParam.QueryParam|query_param.json"
"query|YaoQuery.QueryDSL|query.json"
"schedule|YaoSchedule.Schedule|schedule.json"
"service|YaoService.Service|service.json"
"socket|YaoSocket.Socket|socket.json"
"store|YaoStore.Store|store.json"
"task|YaoTask.Task|task.json"
"web_socket|YaoWebSocket.Server|ws_server.json"
"web_socket|YaoWebSocket.Client|ws_client.json"
"widget|YaoCustomWidget.Widget|widget.json"
)
if [ ! -d "json-schemas" ]; then
mkdir json-schemas
fi
# array=(
# "model|YaoModel.ModelDSL|model.json"
# )
for line in "${array[@]}"
do
words=($(echo $line | tr "|" "\n"))
echo "begin convert schema ${words[1]}"
npx ts-json-schema-generator --path "src/types/dsl/${words[0]}.ts" --type "${words[1]}" > "./json-schemas/0.10.3/${words[2]}"
echo "schema ${words[1]} converted"
done
echo "done"