Add development and production scripts for PVideoDl. Introduced dev.bat, dev.sh for development mode with backend and Vite server, and run.bat, run.sh for production launch with dependency installation and frontend build. Enhanced user experience with clear instructions and error handling.
This commit is contained in:
@@ -0,0 +1,20 @@
|
|||||||
|
@echo off
|
||||||
|
rem Дев-режим: бэкенд (:8000) в отдельном окне + Vite dev-сервер (:5173).
|
||||||
|
rem Откройте http://localhost:5173 — Vite проксирует /api на бэкенд.
|
||||||
|
chcp 65001 >nul
|
||||||
|
setlocal
|
||||||
|
cd /d "%~dp0"
|
||||||
|
|
||||||
|
call uv sync || exit /b 1
|
||||||
|
if not exist "frontend\node_modules" (
|
||||||
|
pushd frontend
|
||||||
|
call npm install || exit /b 1
|
||||||
|
popd
|
||||||
|
)
|
||||||
|
|
||||||
|
echo ==^> Бэкенд ^(:8000^) — отдельное окно
|
||||||
|
start "PVideoDl backend" cmd /k "uv run python -m app.main"
|
||||||
|
|
||||||
|
echo ==^> Vite dev ^(:5173^) — http://localhost:5173
|
||||||
|
cd frontend
|
||||||
|
npm run dev
|
||||||
@@ -0,0 +1,17 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
# Дев-режим: бэкенд (:8000) + Vite dev-сервер (:5173) с hot-reload фронта.
|
||||||
|
# Откройте http://localhost:5173 — Vite проксирует /api на бэкенд.
|
||||||
|
set -euo pipefail
|
||||||
|
cd "$(dirname "$0")"
|
||||||
|
|
||||||
|
uv sync
|
||||||
|
[ -d frontend/node_modules ] || (cd frontend && npm install)
|
||||||
|
|
||||||
|
echo "==> Бэкенд → http://127.0.0.1:8000 (в фоне)"
|
||||||
|
uv run python -m app.main &
|
||||||
|
backend_pid=$!
|
||||||
|
trap 'kill "$backend_pid" 2>/dev/null' EXIT INT TERM
|
||||||
|
|
||||||
|
echo "==> Vite dev → http://localhost:5173"
|
||||||
|
cd frontend
|
||||||
|
npm run dev
|
||||||
@@ -0,0 +1,22 @@
|
|||||||
|
@echo off
|
||||||
|
rem Прод-запуск одной командой: зависимости -> сборка фронта (если нужна) -> сервер.
|
||||||
|
rem Файлы складываются в downloads\, UI на http://127.0.0.1:8000
|
||||||
|
chcp 65001 >nul
|
||||||
|
setlocal
|
||||||
|
cd /d "%~dp0"
|
||||||
|
|
||||||
|
echo ==^> uv sync
|
||||||
|
call uv sync || exit /b 1
|
||||||
|
|
||||||
|
if not exist "frontend\build" (
|
||||||
|
echo ==^> Сборка фронтенда ^(frontend\build отсутствует^)
|
||||||
|
pushd frontend
|
||||||
|
call npm install || exit /b 1
|
||||||
|
call npm run build || exit /b 1
|
||||||
|
popd
|
||||||
|
) else (
|
||||||
|
echo ==^> Фронтенд уже собран — пропускаю сборку ^(удалите frontend\build для пересборки^)
|
||||||
|
)
|
||||||
|
|
||||||
|
echo ==^> Запуск PVideoDl на http://127.0.0.1:8000
|
||||||
|
uv run pvideodl
|
||||||
@@ -0,0 +1,18 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
# Прод-запуск одной командой: зависимости -> сборка фронта (если нужна) -> сервер.
|
||||||
|
# Файлы складываются в downloads/, UI на http://127.0.0.1:8000
|
||||||
|
set -euo pipefail
|
||||||
|
cd "$(dirname "$0")"
|
||||||
|
|
||||||
|
echo "==> uv sync"
|
||||||
|
uv sync
|
||||||
|
|
||||||
|
if [ ! -d frontend/build ]; then
|
||||||
|
echo "==> Сборка фронтенда (frontend/build отсутствует)"
|
||||||
|
(cd frontend && npm install && npm run build)
|
||||||
|
else
|
||||||
|
echo "==> Фронтенд уже собран — пропускаю сборку (удалите frontend/build для пересборки)"
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "==> Запуск PVideoDl на http://127.0.0.1:8000"
|
||||||
|
exec uv run pvideodl
|
||||||
Reference in New Issue
Block a user