refactor: 完成静态网站转换,移除所有 CMS 和动态功能

- 删除数据库相关代码 (src/db/)
- 删除 API 路由 (src/app/api/)
- 删除认证相关代码 (src/lib/auth/, src/providers/)
- 删除监控和安全中间件 (src/lib/security/, src/lib/monitoring/)
- 删除 hooks (use-news, use-products, use-services)
- 更新组件为静态数据源
- 添加 nginx 静态配置和部署脚本
- 添加 static-link 组件
This commit is contained in:
张翔
2026-04-21 07:53:56 +08:00
parent cd1d6aa28a
commit 6403489954
197 changed files with 654 additions and 24762 deletions
-28
View File
@@ -1,28 +0,0 @@
when:
branch: [main, develop]
event: [push, pull_request]
steps:
lint:
image: node:18-alpine
commands:
- npm ci
- npm run lint
- npm run type-check
test:
image: node:18-alpine
commands:
- npm ci
- npm run db:push
- npm run test:unit -- --coverage --coverageReporters=text --coverageReporters=lcov
- npx playwright install --with-deps
- npm run test:e2e
build:
image: node:18-alpine
commands:
- npm ci
- npm run build
when:
status: [success]
-12
View File
@@ -1,12 +0,0 @@
when:
branch: [main]
event: [push]
steps:
deploy:
image: node:18-alpine
commands:
- npm ci
- npm run build
- echo "Deploying to production..."
secrets: [deploy_key]
-71
View File
@@ -1,71 +0,0 @@
when:
event: [pull_request]
branch: [main, develop]
steps:
install-dependencies:
image: node:18-alpine
commands:
- npm ci
lint:
image: node:18-alpine
commands:
- echo "=== Running ESLint ==="
- npm run lint
- echo "✅ ESLint check passed"
type-check:
image: node:18-alpine
commands:
- echo "=== Running TypeScript type check ==="
- npm run type-check
- echo "✅ TypeScript type check passed"
unit-tests:
image: node:18-alpine
commands:
- echo "=== Running unit tests with coverage ==="
- npm run test:unit -- --coverage --coverageReporters=json
- |
COVERAGE=$(cat coverage/coverage-summary.json | grep -o '"lines":{"pct":[0-9.]*' | grep -o '[0-9.]*$')
echo "Current coverage: $COVERAGE%"
if [ $(echo "$COVERAGE < 42" | bc -l) -eq 1 ]; then
echo "❌ Coverage $COVERAGE% is below threshold 42%"
exit 1
fi
echo "✅ Coverage $COVERAGE% meets threshold 42%"
e2e-tests:
image: node:18-alpine
commands:
- echo "=== Running E2E tests ==="
- npx playwright install --with-deps
- npm run test:e2e
- echo "✅ E2E tests passed"
security-check:
image: node:18-alpine
commands:
- echo "=== Running security audit ==="
- npm audit --audit-level=moderate
- echo "✅ Security audit passed"
performance-check:
image: node:18-alpine
commands:
- echo "=== Running performance checks ==="
- npm run audit:performance
- echo "✅ Performance audit passed"
quality-summary:
image: node:18-alpine
commands:
- echo "=== Quality Gate Summary ==="
- echo "✅ All quality checks passed"
- echo " - ESLint: PASSED"
- echo " - TypeScript: PASSED"
- echo " - Unit Tests: PASSED (Coverage ≥ 42%)"
- echo " - E2E Tests: PASSED"
- echo " - Security: PASSED"
- echo " - Performance: PASSED"
-50
View File
@@ -1,50 +0,0 @@
when:
event:
- push
- pull_request
pipeline:
test-tier-fast:
image: mcr.microsoft.com/playwright:v1.42.0-jammy
environment:
TEST_TIER: fast
CI: true
commands:
- cd e2e
- npm ci
- npx playwright install --with-deps
- npm run test:tier:fast
when:
branch:
- main
- develop
- feat-dynamic
test-tier-standard:
image: mcr.microsoft.com/playwright:v1.42.0-jammy
environment:
TEST_TIER: standard
CI: true
commands:
- cd e2e
- npm ci
- npx playwright install --with-deps
- npm run test:tier:standard
when:
branch:
- main
- develop
test-tier-deep:
image: mcr.microsoft.com/playwright:v1.42.0-jammy
environment:
TEST_TIER: deep
CI: true
commands:
- cd e2e
- npm ci
- npx playwright install --with-deps
- npm run test:tier:deep
when:
branch:
- main
-102
View File
@@ -1,102 +0,0 @@
when:
event:
- push
- pull_request
- tag
pipeline:
setup:
image: node:20-alpine
commands:
- node -v
- npm -v
- npm ci
- cd e2e && npm ci
test-tier-fast:
image: mcr.microsoft.com/playwright:v1.42.0-jammy
environment:
TEST_TIER: fast
CI: true
commands:
- cd e2e
- npx playwright install --with-deps
- npm run test:tier:fast
depends_on:
- setup
test-tier-standard:
image: mcr.microsoft.com/playwright:v1.42.0-jammy
environment:
TEST_TIER: standard
CI: true
commands:
- cd e2e
- npx playwright install --with-deps
- npm run test:tier:standard
depends_on:
- test-tier-fast
when:
status:
- success
test-tier-deep:
image: mcr.microsoft.com/playwright:v1.42.0-jammy
environment:
TEST_TIER: deep
CI: true
commands:
- cd e2e
- npx playwright install --with-deps
- npm run test:tier:deep
depends_on:
- test-tier-standard
when:
status:
- success
generate-report:
image: node:20-alpine
commands:
- cd e2e
- node scripts/generate-report.js
depends_on:
- test-tier-fast
- test-tier-standard
- test-tier-deep
upload-artifacts:
image: plugins/s3
settings:
bucket: test-reports
source: e2e/test-results/**
target: /${CI_REPO}/${CI_BUILD_NUMBER}/
path_style: true
depends_on:
- generate-report
when:
status:
- success
- failure
notify:
image: plugins/webhook
settings:
urls:
from_secret: webhook_url
content_type: application/json
template: |
{
"repo": "{{ repo.name }}",
"build": "{{ build.number }}",
"status": "{{ build.status }}",
"message": "{{ build.message }}",
"author": "{{ commit.author }}",
"link": "{{ build.link }}"
}
depends_on:
- upload-artifacts
when:
status:
- success
- failure