feat(M01-A): 建立后端API基础骨架
This commit is contained in:
@@ -0,0 +1,26 @@
|
||||
$ErrorActionPreference = "Stop"
|
||||
|
||||
$requiredFiles = @(
|
||||
"backend/package.json",
|
||||
"backend/tsconfig.json",
|
||||
"backend/.env.example",
|
||||
"backend/src/app.ts",
|
||||
"backend/src/config.ts",
|
||||
"backend/src/routes/health.ts",
|
||||
"backend/src/server.ts",
|
||||
"backend/tests/backend-contract.test.mjs",
|
||||
"deploy/pm2/ecosystem.config.cjs"
|
||||
)
|
||||
|
||||
foreach ($path in $requiredFiles) {
|
||||
if (-not (Test-Path $path)) {
|
||||
throw "Required backend file missing: $path"
|
||||
}
|
||||
}
|
||||
|
||||
& npm --prefix backend test
|
||||
if ($LASTEXITCODE -ne 0) {
|
||||
throw "backend contract test failed"
|
||||
}
|
||||
|
||||
Write-Host "PASS: backend M01-A skeleton check passed."
|
||||
@@ -2,14 +2,17 @@ $ErrorActionPreference = "Stop"
|
||||
|
||||
$head = (& git rev-parse HEAD).Trim()
|
||||
$shortHead = (& git rev-parse --short HEAD).Trim()
|
||||
$backendBuild = if (Test-Path "backend/package.json") { "PROJECT_PRESENT_BUILD_NOT_RUN" } else { "SKIPPED_NO_PROJECT" }
|
||||
$adminBuild = if (Test-Path "admin/package.json") { "PROJECT_PRESENT_BUILD_NOT_RUN" } else { "SKIPPED_NO_PROJECT" }
|
||||
|
||||
$rawText = @"
|
||||
{
|
||||
"releaseId": "DRYRUN-$shortHead",
|
||||
"generatedAt": "WINDOWS_CHECK",
|
||||
"commit": "$head",
|
||||
"branch": "main",
|
||||
"backendBuild": "SKIPPED_NO_PROJECT",
|
||||
"adminBuild": "SKIPPED_NO_PROJECT",
|
||||
"backendBuild": "$backendBuild",
|
||||
"adminBuild": "$adminBuild",
|
||||
"miniappMirror": "RECORDED_SOURCE_COMMIT_ONLY",
|
||||
"databaseMigration": "SKIPPED_NO_MIGRATIONS",
|
||||
"deployed": false
|
||||
@@ -39,8 +42,17 @@ if ($manifest.deployed -ne $false) {
|
||||
throw "Dry-run manifest must not mark deployed=true"
|
||||
}
|
||||
|
||||
if ($manifest.backendBuild -ne "SKIPPED_NO_PROJECT" -or $manifest.adminBuild -ne "SKIPPED_NO_PROJECT") {
|
||||
throw "Dry-run manifest should record skipped builds until projects exist"
|
||||
if ((Test-Path "backend/package.json") -and $manifest.backendBuild -ne "PROJECT_PRESENT_BUILD_NOT_RUN") {
|
||||
throw "Dry-run manifest should record backend project presence"
|
||||
}
|
||||
if ((-not (Test-Path "backend/package.json")) -and $manifest.backendBuild -ne "SKIPPED_NO_PROJECT") {
|
||||
throw "Dry-run manifest should record missing backend project"
|
||||
}
|
||||
if ((Test-Path "admin/package.json") -and $manifest.adminBuild -ne "PROJECT_PRESENT_BUILD_NOT_RUN") {
|
||||
throw "Dry-run manifest should record admin project presence"
|
||||
}
|
||||
if ((-not (Test-Path "admin/package.json")) -and $manifest.adminBuild -ne "SKIPPED_NO_PROJECT") {
|
||||
throw "Dry-run manifest should record missing admin project"
|
||||
}
|
||||
|
||||
if ($manifest.databaseMigration -ne "SKIPPED_NO_MIGRATIONS") {
|
||||
|
||||
@@ -21,6 +21,7 @@ $requiredPaths = @(
|
||||
"docs/reference-redaction-log.md",
|
||||
"docs/repository-completeness.md",
|
||||
"scripts/dev/windows/check-workspace.ps1",
|
||||
"scripts/dev/windows/check-backend.ps1",
|
||||
"scripts/dev/windows/check-reference.ps1",
|
||||
"scripts/dev/windows/check-repo-completeness.ps1",
|
||||
"scripts/dev/windows/check-secrets.ps1",
|
||||
|
||||
@@ -6,7 +6,7 @@ $patterns = @(
|
||||
"WECHAT_SECRET\s*=\s*['""]?(?!<|\r?\n|$)[^'"">\s]{8,}",
|
||||
"PRIVATE_KEY\s*[:=]\s*['""]?(?!<|\r?\n|$)[^'"">\s]{8,}",
|
||||
"api_key\s*[:=]\s*['""]?(?!<|\r?\n|$)[^'"">\s]{8,}",
|
||||
"password\s*[:=]\s*['""]?(?!<|\r?\n|$|\-|\$|\{)[^'"">\s]{8,}"
|
||||
"\bpassword\b\s*[:=]\s*['""]?(?!<|\r?\n|$|\-|\$|\{)[^'"">\s]{8,}"
|
||||
)
|
||||
|
||||
$excluded = @("\.git\", "node_modules", "dist", "build")
|
||||
|
||||
@@ -8,6 +8,7 @@ $ErrorActionPreference = "Stop"
|
||||
& powershell -ExecutionPolicy Bypass -File scripts/dev/windows/check-release-manifest.ps1
|
||||
& powershell -ExecutionPolicy Bypass -File scripts/dev/windows/check-status-docs.ps1
|
||||
& powershell -ExecutionPolicy Bypass -File scripts/dev/windows/check-readme-config.ps1
|
||||
& powershell -ExecutionPolicy Bypass -File scripts/dev/windows/check-backend.ps1
|
||||
|
||||
if (Test-Path "package.json") {
|
||||
npm run lint --if-present
|
||||
|
||||
Reference in New Issue
Block a user