启动脚本
This commit is contained in:
1 parent
202a81d0a9
commit
5e024f77a2
3 files changed
+86
No files matched your search
@@ -0,0 +1,42 @@
|
||||
@echo off
|
||||
setlocal
|
||||
cd /d "%~dp0"
|
||||
title PicHost Development
|
||||
|
||||
where node >nul 2>&1
|
||||
if errorlevel 1 goto missing_node
|
||||
|
||||
where npm >nul 2>&1
|
||||
if errorlevel 1 goto missing_npm
|
||||
|
||||
if exist "node_modules" goto dependencies_ready
|
||||
echo Installing project dependencies...
|
||||
call npm ci
|
||||
if errorlevel 1 goto failed
|
||||
|
||||
:dependencies_ready
|
||||
if exist ".env" goto env_ready
|
||||
if not exist ".env.example" goto env_ready
|
||||
copy /Y ".env.example" ".env" >nul
|
||||
|
||||
:env_ready
|
||||
echo Starting PicHost development server...
|
||||
start "" powershell -NoProfile -WindowStyle Hidden -Command "Start-Sleep -Seconds 5; Start-Process 'http://127.0.0.1:3000/'"
|
||||
call npm run dev
|
||||
if errorlevel 1 goto failed
|
||||
exit /b 0
|
||||
|
||||
:missing_node
|
||||
echo Node.js 22 or newer was not found.
|
||||
pause
|
||||
exit /b 1
|
||||
|
||||
:missing_npm
|
||||
echo npm was not found. Check the Node.js installation.
|
||||
pause
|
||||
exit /b 1
|
||||
|
||||
:failed
|
||||
echo PicHost failed to start. Check the error output above.
|
||||
pause
|
||||
exit /b 1
|
||||
Reference in new issue
Block a user