Pārlūkot izejas kodu

add Web/api_build/build.sh.
增加一键生成前端 API 请求代理Linux/Mac脚本

Signed-off-by: brachetto <2136067+brachetto@user.noreply.gitee.com>

brachetto 3 gadi atpakaļ
vecāks
revīzija
f9b689f5ea
1 mainītis faili ar 28 papildinājumiem un 0 dzēšanām
  1. 28 0
      Web/api_build/build.sh

+ 28 - 0
Web/api_build/build.sh

@@ -0,0 +1,28 @@
+#!/bin/sh
+
+currPath=$(pwd)
+parentPath=$(dirname "$currPath")
+apiServicesPath=${parentPath}/src/api-services/
+
+echo "================================ 生成目录 ${apiServicesPath} ================================"
+
+# 判断目录是否存在
+if test -d "$apiServicesPath"; then
+  echo "================================ 删除目录 api-services ================================"
+  rm -rf "${apiServicesPath}"
+fi
+
+echo "================================ 开始生成 api-services ================================"
+
+java -jar "${currPath}"/swagger-codegen-cli.jar generate -i http://localhost:5000/swagger/All%20Groups/swagger.json -l typescript-axios -o "${apiServicesPath}"
+
+rm -rf "${apiServicesPath}".swagger-codegen
+rm -f "${apiServicesPath}".gitignore
+rm -f "${apiServicesPath}".npmignore
+rm -f "${apiServicesPath}".swagger-codegen-ignore
+rm -f "${apiServicesPath}"git_push.sh
+rm -f "${apiServicesPath}"package.json
+rm -f "${apiServicesPath}"README.md
+rm -f "${apiServicesPath}"tsconfig.json
+
+echo "================================ 生成结束 ================================"