kindergarten_java/api-generator.bat
En 745f4e4b06 feat(api): 新增自动化 API 更新工具和协作文档
- 添加 api-generator.bat/api-generator.sh 脚本,简化后端接口修改后的前端 API 同步流程
- 新增 reading-platform-frontend/README.md,说明 API 开发协作规范
- 更新 docs/开发协作指南.md,补充协作模式说明和新功能开发检查清单
- 同步最新 API 规范和生成的 TypeScript 类型代码

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-09 18:04:29 +08:00

50 lines
1.1 KiB
Batchfile
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

@echo off
REM 后端接口变更后自动更新前端 API 规范
REM 使用方式:修改接口后运行 api-generator.bat
echo === 自动更新前端 API 规格 ===
REM 检查前端目录是否存在
if not exist "reading-platform-frontend" (
echo ❌ 错误:前端目录不存在
exit /b 1
)
REM 进入前端目录
cd reading-platform-frontend
REM 检查 npm 是否安装
node --version > NUL 2>&1
if %errorlevel% neq 0 (
echo ❌ 错误:未找到 Node.js请安装 Node.js 18+
exit /b 1
)
REM 检查 package.json 中是否有 api:update 脚本
findstr "api:update" package.json > NUL
if %errorlevel% neq 0 (
echo ❌ 错误package.json 中未找到 api:update 脚本
exit /b 1
)
echo 📦 正在安装依赖...
call npm install
echo 🔄 正在拉取最新 API 规范并生成代码...
call npm run api:update
echo ✅ 完成!
REM 显示修改的文件
echo.
echo 📝 修改的文件:
git status --short
REM 提示用户检查并提交
echo.
echo 💡 请检查生成的文件,然后提交:
echo git add api-spec.yml src/api/generated/
echo git commit -m "chore(api): 同步最新接口规范"
echo git push