首次提交:脑晴测 H5 项目
包含前端源码、预构建产物(dist/)、零依赖 Node.js 服务器(server.mjs)、 Cloudflare Worker 版本(worker/)、部署文档(DEPLOY.md)和交接文档。 技术总监可直接 clone 后运行 node server.mjs 启动,无需安装 React 或 build。 DEEPSEEK_API_KEY 通过环境变量注入,未纳入仓库。
This commit is contained in:
58
brain-h5/scripts/start-local.cmd
Normal file
58
brain-h5/scripts/start-local.cmd
Normal file
@@ -0,0 +1,58 @@
|
||||
@echo off
|
||||
setlocal
|
||||
cd /d "%~dp0.."
|
||||
|
||||
set "BUNDLED_NODE=%USERPROFILE%\.cache\codex-runtimes\codex-primary-runtime\dependencies\node\bin"
|
||||
set "BUNDLED_PNPM=%USERPROFILE%\.cache\codex-runtimes\codex-primary-runtime\dependencies\bin\fallback\pnpm.cmd"
|
||||
|
||||
if exist "%BUNDLED_PNPM%" goto bundled_check
|
||||
where npm.cmd >nul 2>nul
|
||||
if errorlevel 1 goto missing
|
||||
|
||||
if not exist "node_modules" goto npm_install
|
||||
node -e "import('vite')" >nul 2>nul
|
||||
if errorlevel 1 goto npm_repair
|
||||
goto npm_run
|
||||
|
||||
:npm_repair
|
||||
echo Existing dependencies are damaged. Reinstalling...
|
||||
rmdir /s /q "%CD%\node_modules"
|
||||
|
||||
:npm_install
|
||||
call npm.cmd install
|
||||
if errorlevel 1 goto install_failed
|
||||
|
||||
:npm_run
|
||||
call npm.cmd run dev -- --host 0.0.0.0 --port 4173
|
||||
exit /b %errorlevel%
|
||||
|
||||
:bundled_check
|
||||
set "PATH=%BUNDLED_NODE%;%PATH%"
|
||||
if not exist "node_modules" goto bundled_install
|
||||
"%BUNDLED_NODE%\node.exe" -e "import('vite')" >nul 2>nul
|
||||
if errorlevel 1 goto bundled_repair
|
||||
goto bundled_run
|
||||
|
||||
:bundled_repair
|
||||
echo Existing dependencies are damaged. Reinstalling...
|
||||
rmdir /s /q "%CD%\node_modules"
|
||||
|
||||
:bundled_install
|
||||
call "%BUNDLED_PNPM%" install --frozen-lockfile
|
||||
if errorlevel 1 goto install_failed
|
||||
|
||||
:bundled_run
|
||||
call "%BUNDLED_PNPM%" dev --host 0.0.0.0 --port 4173
|
||||
exit /b %errorlevel%
|
||||
|
||||
:install_failed
|
||||
echo.
|
||||
echo Dependency installation failed. Check the network, then run this launcher again.
|
||||
pause
|
||||
exit /b 1
|
||||
|
||||
:missing
|
||||
echo No local web runtime was found.
|
||||
echo Install Node.js or reopen this project in Codex, then retry.
|
||||
pause
|
||||
exit /b 1
|
||||
Reference in New Issue
Block a user