mirror of
https://github.com/hansjone/netx.git
synced 2026-10-09 00:43:17 +08:00
feat(start): auto-install web dependencies when WithWeb is enabled
Install frontend npm dependencies automatically in start_netx so fresh machines can bring up the 5173 Vite UI without separate manual npm install. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
parent
d529ff70ff
commit
ab1b76dd47
1 changed files with 18 additions and 0 deletions
|
|
@ -44,6 +44,24 @@ if (-not $SkipInstall) {
|
|||
Write-Host "==> Skip dependency install (if API fails with ModuleNotFoundError, run once without -SkipInstall)"
|
||||
}
|
||||
|
||||
if ($WithWeb) {
|
||||
$webRoot = Join-Path $projectRoot "web"
|
||||
$webNodeModules = Join-Path $webRoot "node_modules"
|
||||
if (-not (Get-Command "npm.cmd" -ErrorAction SilentlyContinue)) {
|
||||
throw "npm_not_found: install Node.js (includes npm) and reopen terminal"
|
||||
}
|
||||
$needWebInstall = (-not (Test-Path $webNodeModules)) -or (-not $SkipInstall)
|
||||
if ($needWebInstall) {
|
||||
Write-Host "==> Installing web dependencies (npm install)"
|
||||
& npm.cmd install --prefix $webRoot
|
||||
if ($LASTEXITCODE -ne 0) {
|
||||
throw "npm_install_failed"
|
||||
}
|
||||
} else {
|
||||
Write-Host "==> Skip web dependency install (node_modules exists)"
|
||||
}
|
||||
}
|
||||
|
||||
$env:NETX_HOST = $BindHost
|
||||
$env:NETX_PORT = "$Port"
|
||||
$baseUrl = "http://$BindHost`:$Port"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue