From 38a7aa3b5943cc4609878bb4d924c83e9e6b6666 Mon Sep 17 00:00:00 2001 From: Joey Date: Mon, 24 Aug 2026 22:37:58 +0800 Subject: [PATCH] =?UTF-8?q?chore:=20=E4=BF=AE=E6=94=B9=E5=90=AF=E5=8A=A8?= =?UTF-8?q?=E5=91=BD=E4=BB=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- start.command | 29 +++++++++++++++++++++++++++-- 1 file changed, 27 insertions(+), 2 deletions(-) diff --git a/start.command b/start.command index 65d47d6..779fdd4 100755 --- a/start.command +++ b/start.command @@ -19,8 +19,33 @@ if [[ ! -f .env ]]; then exit 1 fi -echo "启动中:http://127.0.0.1:8800/ozonSeller.html" -echo "按 Ctrl+C 可停止服务" +# studio 依赖检查(node_modules 不存在时安装) +if [[ -d studio ]] && [[ ! -d studio/node_modules ]]; then + echo "未找到 studio/node_modules,正在安装依赖…" + (cd studio && pnpm install) || exit 1 +fi + +# 后台启动 studio(Vite,8900 端口,/api 代理到 8800) +STUDIO_PID="" +if [[ -d studio ]]; then + (cd studio && pnpm dev) & + STUDIO_PID=$! + echo "studio 已后台启动:http://127.0.0.1:8900/" +fi + +# Ctrl-C / 退出时把 studio 一起停掉 +cleanup() { + if [[ -n "$STUDIO_PID" ]]; then + echo "正在停止 studio…" + kill "$STUDIO_PID" 2>/dev/null + fi +} +trap cleanup EXIT INT TERM + +echo +echo "后端启动中:http://127.0.0.1:8800/ozonSeller.html" +echo "studio 启动中:http://127.0.0.1:8900/" +echo "按 Ctrl+C 可停止全部服务" echo # --app-dir server 让 uvicorn 在 server/ 下找 main:app,工作目录仍是仓库根(.env 在此)