docs+feat: 重构规格与 Gitea 式 SSR 骨架(首页)

在 rebuild/gitea-ssr 落地产品规格、Cursor 规则,以及 Go 模板 SSR 首页/板块列表;未迁移路径仍回落 SPA,便于对照 main。

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-08-29 03:11:25 +08:00
parent 4dc3bbb13f
commit 1414c71dec
28 changed files with 2891 additions and 24 deletions

View File

@@ -3,7 +3,7 @@
# .\build.ps1 -Target build-windows
param(
[ValidateSet('build', 'build-windows', 'build-linux', 'build-darwin', 'build-all', 'frontend', 'tidy', 'run', 'dev', 'clean', 'docker', 'compose-up', 'compose-down', 'help')]
[ValidateSet('build', 'build-windows', 'build-linux', 'build-darwin', 'build-all', 'frontend', 'web-src', 'tidy', 'run', 'dev', 'clean', 'docker', 'compose-up', 'compose-down', 'help')]
[string]$Target = 'build'
)
@@ -22,6 +22,17 @@ function Ensure-Dir($path) {
}
}
function Build-WebSrc {
Write-Host '[web_src] npm run build...' -ForegroundColor Cyan
Push-Location web_src
try {
npm run build
if ($LASTEXITCODE -ne 0) { throw 'web_src build failed' }
} finally {
Pop-Location
}
}
function Build-Frontend {
Write-Host '[frontend] npm run build...' -ForegroundColor Cyan
Push-Location frontend
@@ -70,12 +81,13 @@ function Build-Go([string]$OutFile, [string]$GoOS = '', [string]$GoArch = '') {
switch ($Target) {
'help' {
Write-Host '.\build.ps1 build current platform'
Write-Host '.\build.ps1 -Target frontend frontend only'
Write-Host '.\build.ps1 -Target frontend SPA frontend only (legacy)'
Write-Host '.\build.ps1 -Target web-src SSR progressive assets'
Write-Host '.\build.ps1 -Target build-windows'
Write-Host '.\build.ps1 -Target build-linux'
Write-Host '.\build.ps1 -Target build-all'
Write-Host '.\build.ps1 -Target run backend only (port 3000)'
Write-Host '.\build.ps1 -Target dev backend + Vite HMR (recommended for frontend dev)'
Write-Host '.\build.ps1 -Target run backend (SSR on :3000)'
Write-Host '.\build.ps1 -Target dev backend + Vite SPA对照'
Write-Host '.\build.ps1 -Target tidy'
Write-Host '.\build.ps1 -Target clean'
Write-Host '.\build.ps1 -Target docker build Docker image'
@@ -85,6 +97,7 @@ switch ($Target) {
Write-Host 'Note: Windows "make" is often Embarcadero MAKE, not GNU Make.'
}
'frontend' { Build-Frontend }
'web-src' { Build-WebSrc }
'tidy' { go mod tidy }
'clean' {
if (Test-Path $BuildDir) { Remove-Item -Recurse -Force $BuildDir }
@@ -117,23 +130,28 @@ switch ($Target) {
}
}
'build' {
Build-WebSrc
Build-Frontend
Build-Go -OutFile $AppName
}
'build-windows' {
Build-WebSrc
Build-Frontend
Build-Go -OutFile $AppName -GoOS 'windows' -GoArch 'amd64'
}
'build-linux' {
Write-Host '[build-linux] will npm run build then go:embed SPA' -ForegroundColor Yellow
Write-Host '[build-linux] will build web_src + SPA then go:embed' -ForegroundColor Yellow
Build-WebSrc
Build-Frontend
Build-Go -OutFile "$AppName-linux-amd64" -GoOS 'linux' -GoArch 'amd64'
}
'build-darwin' {
Build-WebSrc
Build-Frontend
Build-Go -OutFile "$AppName-darwin-arm64" -GoOS 'darwin' -GoArch 'arm64'
}
'build-all' {
Build-WebSrc
Build-Frontend
Build-Go -OutFile $AppName -GoOS 'windows' -GoArch 'amd64'
Build-Go -OutFile "$AppName-linux-amd64" -GoOS 'linux' -GoArch 'amd64'