Initial commit

This commit is contained in:
zhangshun
2026-06-01 15:55:59 +08:00
commit 40f9bdb590
1799 changed files with 362227 additions and 0 deletions

67
scripts/serve.ps1 Normal file
View File

@@ -0,0 +1,67 @@
# serve.ps1 - 开发服务器启动脚本
Write-Host "=== 启动开发服务器 ===" -ForegroundColor Cyan
Write-Host ""
# 检查是否已构建
if (-not (Test-Path "public/wasm/smart_math.js")) {
Write-Host "[!] 未找到 WASM 文件,正在构建..." -ForegroundColor Yellow
& "$PSScriptRoot\build.ps1"
if (-not (Test-Path "public/wasm/smart_math.js")) {
Write-Host "[✗] 构建失败,无法启动服务器" -ForegroundColor Red
exit 1
}
}
# 检查 Python
try {
python --version 2>&1 | Out-Null
$hasPython = $true
} catch {
$hasPython = $false
}
if (-not $hasPython) {
Write-Host "[!] 未找到 Python尝试使用系统 Python..." -ForegroundColor Yellow
# 尝试常见的 Python 路径
$pythonPaths = @(
"python",
"python3",
"py",
"C:\Python39\python.exe",
"C:\Python38\python.exe",
"C:\Python37\python.exe"
)
foreach ($path in $pythonPaths) {
try {
& $path --version 2>&1 | Out-Null
$env:PATH = "$(Split-Path $path -ErrorAction SilentlyContinue);$env:PATH"
$hasPython = $true
Write-Host "[✓] 找到 Python: $path" -ForegroundColor Green
break
} catch {
continue
}
}
}
if (-not $hasPython) {
Write-Host "[✗] 未找到 Python请安装 Python 3.7+ 并添加到 PATH" -ForegroundColor Red
exit 1
}
# 启动服务器
Write-Host "[ ] 启动开发服务器..." -ForegroundColor Cyan
Write-Host ""
Write-Host "🌐 服务器信息:" -ForegroundColor White
Write-Host "├─ 地址: http://localhost:8080" -ForegroundColor Cyan
Write-Host "├─ 目录: $(Resolve-Path "public")" -ForegroundColor Gray
Write-Host "├─ 主页: /smart_test.html" -ForegroundColor Gray
Write-Host "└─ 按 Ctrl+C 停止服务器" -ForegroundColor Yellow
Write-Host ""
Write-Host ("" * 50) -ForegroundColor DarkGray
Set-Location "public"
python -m http.server 8080