Compare commits
2 Commits
c0ff3b29de
...
b7018f8423
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b7018f8423 | ||
|
|
d9a089be3f |
@@ -8,8 +8,8 @@
|
|||||||
"node": "^20.6.0 || >=22.0.0"
|
"node": "^20.6.0 || >=22.0.0"
|
||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"docs:dev": "vuepress dev docs --port 4567",
|
"docs:dev": "vuepress dev docs",
|
||||||
"docs:dev-clean": "vuepress dev docs --clean-cache --clean-temp --port 4567",
|
"docs:dev-clean": "vuepress dev docs --clean-cache --clean-temp",
|
||||||
"docs:build": "vuepress build docs --clean-cache --clean-temp",
|
"docs:build": "vuepress build docs --clean-cache --clean-temp",
|
||||||
"docs:preview": "http-server docs/.vuepress/dist",
|
"docs:preview": "http-server docs/.vuepress/dist",
|
||||||
"vp-update": "npx vp-update"
|
"vp-update": "npx vp-update"
|
||||||
|
|||||||
@@ -4,8 +4,8 @@ setlocal EnableExtensions
|
|||||||
chcp 65001 >nul
|
chcp 65001 >nul
|
||||||
|
|
||||||
REM Paths and settings
|
REM Paths and settings
|
||||||
set "ROOT_DIR=%~dp0"
|
cd /d "%~dp0.."
|
||||||
set "PROJECT_DIR=%ROOT_DIR%"
|
set "PROJECT_DIR=%CD%\"
|
||||||
set "DIST_DIR=%PROJECT_DIR%docs\.vuepress\dist"
|
set "DIST_DIR=%PROJECT_DIR%docs\.vuepress\dist"
|
||||||
set "PUBLISH_DIR=%PROJECT_DIR%_publish"
|
set "PUBLISH_DIR=%PROJECT_DIR%_publish"
|
||||||
set "REMOTE_URL=https://gitea.simengweb.com/si-meng-spec/build_notes_simengweb.git"
|
set "REMOTE_URL=https://gitea.simengweb.com/si-meng-spec/build_notes_simengweb.git"
|
||||||
3
script/start.bat
Normal file
3
script/start.bat
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
@echo off
|
||||||
|
cd /d "%~dp0.."
|
||||||
|
npm run docs:dev -- --host 0.0.0.0 --port 8888
|
||||||
1
start.sh → script/start.sh
Executable file → Normal file
1
start.sh → script/start.sh
Executable file → Normal file
@@ -1 +1,2 @@
|
|||||||
|
cd "$(dirname "$0")/.."
|
||||||
npm run docs:dev -- --host 0.0.0.0 --port 8888
|
npm run docs:dev -- --host 0.0.0.0 --port 8888
|
||||||
59
start.bat
59
start.bat
@@ -1,59 +0,0 @@
|
|||||||
@echo off
|
|
||||||
setlocal ENABLEDELAYEDEXPANSION
|
|
||||||
|
|
||||||
REM Usage:
|
|
||||||
REM start.bat [host] [port]
|
|
||||||
REM Examples:
|
|
||||||
REM start.bat -> try 0.0.0.0:4567, fallback to localhost and 5173
|
|
||||||
REM start.bat local 8080 -> localhost:8080
|
|
||||||
REM start.bat lan 4567 -> 0.0.0.0:4567
|
|
||||||
|
|
||||||
set HOST=%~1
|
|
||||||
if "%HOST%"=="" set HOST=0.0.0.0
|
|
||||||
if /I "%HOST%"=="lan" set HOST=0.0.0.0
|
|
||||||
if /I "%HOST%"=="local" set HOST=localhost
|
|
||||||
|
|
||||||
set PORT=%~2
|
|
||||||
if "%PORT%"=="" set PORT=4567
|
|
||||||
set FALLBACK_PORT=5173
|
|
||||||
|
|
||||||
echo [Start] VuePress dev on host %HOST% port %PORT%
|
|
||||||
call npx vuepress@2.0.0-rc.24 dev docs --host %HOST% --port %PORT%
|
|
||||||
if %ERRORLEVEL% EQU 0 goto success
|
|
||||||
|
|
||||||
REM Fallback 1: switch to localhost same port
|
|
||||||
if NOT "%HOST%"=="localhost" (
|
|
||||||
echo [Fallback] switch to localhost on same port %PORT%...
|
|
||||||
call npx vuepress@2.0.0-rc.24 dev docs --host localhost --port %PORT%
|
|
||||||
if %ERRORLEVEL% EQU 0 goto success
|
|
||||||
)
|
|
||||||
|
|
||||||
REM Fallback 2: clean cache and use localhost on fallback port
|
|
||||||
if NOT "%PORT%"=="%FALLBACK_PORT%" (
|
|
||||||
echo [Fallback] clean cache and start on localhost:%FALLBACK_PORT%...
|
|
||||||
call npx vuepress@2.0.0-rc.24 dev docs --clean-cache --clean-temp --host localhost --port %FALLBACK_PORT%
|
|
||||||
if %ERRORLEVEL% EQU 0 (
|
|
||||||
set HOST=localhost
|
|
||||||
set PORT=%FALLBACK_PORT%
|
|
||||||
goto success
|
|
||||||
)
|
|
||||||
)
|
|
||||||
|
|
||||||
REM Fallback 3: try another common port
|
|
||||||
set ALT_PORT=8080
|
|
||||||
if NOT "%PORT%"=="%ALT_PORT%" (
|
|
||||||
echo [Fallback] try localhost:%ALT_PORT%...
|
|
||||||
call npx vuepress@2.0.0-rc.24 dev docs --host localhost --port %ALT_PORT%
|
|
||||||
if %ERRORLEVEL% EQU 0 (
|
|
||||||
set HOST=localhost
|
|
||||||
set PORT=%ALT_PORT%
|
|
||||||
goto success
|
|
||||||
)
|
|
||||||
)
|
|
||||||
|
|
||||||
echo [Error] Failed to start dev server. Please check firewall or port usage.
|
|
||||||
exit /b 1
|
|
||||||
|
|
||||||
:success
|
|
||||||
echo [Ready] Open http://localhost:%PORT%/ (or http://%HOST%:%PORT%/ if accessible)
|
|
||||||
exit /b 0
|
|
||||||
Reference in New Issue
Block a user