Skip to content

Commit 1ee6d1d

Browse files
committed
feat: 迁移前端
1 parent 7f59533 commit 1ee6d1d

451 files changed

Lines changed: 83 additions & 21046 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/content-check.yml

Lines changed: 6 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -7,24 +7,14 @@ permissions:
77
on:
88
pull_request:
99
paths:
10-
- "**/*.md"
11-
- "**/*.mdx"
12-
- "source.config.ts"
13-
- "app/docs/**"
14-
- "data/**"
15-
- "tests/**"
16-
- "lib/source.ts"
17-
- "mdx-components.tsx"
18-
- "package.json"
19-
- "pnpm-lock.yaml"
20-
- "next.config.mjs"
21-
- "postcss.config.mjs"
22-
- "tailwind.config.ts"
23-
- "tsconfig.json"
10+
- "frontend/**"
2411

2512
jobs:
2613
check-content:
2714
runs-on: ubuntu-latest
15+
defaults:
16+
run:
17+
working-directory: frontend
2818
env:
2919
NEXT_TELEMETRY_DISABLED: "1"
3020
CI: "true"
@@ -41,6 +31,7 @@ jobs:
4131
with:
4232
node-version: 20
4333
cache: "pnpm"
34+
cache-dependency-path: frontend/pnpm-lock.yaml
4435

4536
# Verify pnpm version matches package.json packageManager field
4637
- name: Check pnpm version
@@ -56,10 +47,7 @@ jobs:
5647
echo "This indicates a pnpm version mismatch or corrupted lockfile"
5748
echo ""
5849
echo "Expected pnpm version from package.json:"
59-
# Use multiple fallback methods to extract version
60-
grep '"packageManager"' package.json | grep -o 'pnpm@[^"]*' || \
61-
node -e "try { console.log(require('./package.json').packageManager || 'not specified') } catch(e) { console.log('Could not read') }" || \
62-
echo "Could not extract version"
50+
grep '"packageManager"' package.json | grep -o 'pnpm@[^"]*' || echo "not specified"
6351
echo ""
6452
echo "Actual pnpm version:"
6553
pnpm --version || echo "pnpm not found"

.github/workflows/deploy.yml

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,19 @@ permissions:
77
on:
88
push:
99
branches: [main]
10+
paths:
11+
- "frontend/**"
1012
pull_request:
13+
paths:
14+
- "frontend/**"
1115
workflow_dispatch:
1216

1317
jobs:
1418
build:
1519
runs-on: ubuntu-latest
20+
defaults:
21+
run:
22+
working-directory: frontend
1623
env:
1724
NEXT_TELEMETRY_DISABLED: "1"
1825
CI: "true"
@@ -30,6 +37,7 @@ jobs:
3037
with:
3138
node-version: 20
3239
cache: pnpm
40+
cache-dependency-path: frontend/pnpm-lock.yaml
3341

3442
# Verify pnpm version matches package.json packageManager field
3543
- name: Check pnpm version
@@ -45,10 +53,7 @@ jobs:
4553
echo "This indicates a pnpm version mismatch or corrupted lockfile"
4654
echo ""
4755
echo "Expected pnpm version from package.json:"
48-
# Use multiple fallback methods to extract version
49-
grep '"packageManager"' package.json | grep -o 'pnpm@[^"]*' || \
50-
node -e "try { console.log(require('./package.json').packageManager || 'not specified') } catch(e) { console.log('Could not read') }" || \
51-
echo "Could not extract version"
56+
grep '"packageManager"' package.json | grep -o 'pnpm@[^"]*' || echo "not specified"
5257
echo ""
5358
echo "Actual pnpm version:"
5459
pnpm --version || echo "pnpm not found"
@@ -73,23 +78,28 @@ jobs:
7378
run: |
7479
set -euo pipefail
7580
81+
# Note: we need to run git commands from the root but parse paths correctly
82+
cd ..
7683
git fetch --depth=2 origin ${{ github.ref }} || true
7784
CHANGED="$(git diff --name-only HEAD~1 HEAD || true)"
78-
CHANGED_DOCS="$(echo "$CHANGED" | grep -E '^(app/docs/|content/docs/).*\.(mdx?|tsx?)$' || true)"
85+
# Updated regex to include frontend/ prefix
86+
CHANGED_DOCS="$(echo "$CHANGED" | grep -E '^frontend/(app/docs/|content/docs/).*\.(mdx?|tsx?)$' || true)"
7987
8088
URLS=()
8189
8290
while IFS= read -r f; do
8391
[ -z "$f" ] && continue
84-
if [[ "$f" =~ ^app/docs/(.*)/page\.(mdx|md|tsx|ts|jsx|js)$ ]]; then
92+
# Match frontend/app/docs/path/page.tsx -> /docs/path
93+
if [[ "$f" =~ ^frontend/app/docs/(.*)/page\.(mdx|md|tsx|ts|jsx|js)$ ]]; then
8594
slug="${BASH_REMATCH[1]}"
8695
URLS+=("$SITE_ORIGIN/docs/$slug")
8796
fi
8897
done <<< "$CHANGED_DOCS"
8998
9099
while IFS= read -r f; do
91100
[ -z "$f" ] && continue
92-
if [[ "$f" =~ ^content/docs/(.*)\.(md|mdx)$ ]]; then
101+
# Match frontend/content/docs/path.md -> /docs/path
102+
if [[ "$f" =~ ^frontend/content/docs/(.*)\.(md|mdx)$ ]]; then
93103
slug="${BASH_REMATCH[1]}"
94104
slug="${slug%/index}"
95105
URLS+=("$SITE_ORIGIN/docs/$slug")

.github/workflows/sync-uuid.yml

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,13 @@ on:
66
- main
77
- feat/contributor
88
paths:
9-
- "app/docs/**"
10-
- "scripts/uuid.mjs"
11-
- "scripts/backfill-contributors.mjs"
12-
- "package.json"
13-
- "pnpm-lock.yaml"
9+
- "frontend/app/docs/**"
10+
- "frontend/scripts/uuid.mjs"
11+
- "frontend/scripts/backfill-contributors.mjs"
12+
- "frontend/package.json"
13+
- "frontend/pnpm-lock.yaml"
1414
- ".github/workflows/sync-uuid.yml"
15-
- "generated/doc-contributors.json"
15+
- "frontend/generated/doc-contributors.json"
1616
workflow_dispatch: {}
1717

1818
concurrency:
@@ -28,10 +28,13 @@ jobs:
2828
runs-on: ubuntu-latest
2929
permissions:
3030
contents: write
31+
defaults:
32+
run:
33+
working-directory: frontend
3134
env:
3235
DATABASE_URL: ${{ secrets.DATABASE_URL }}
3336
GITHUB_TOKEN: ${{ secrets.GH_PAT }} # 供脚本调用 GitHub API 提升速率
34-
DOCS_DIR: app/docs
37+
DOCS_DIR: app/docs # 在 working-directory 为 frontend 时,这是相对路径
3538

3639
steps:
3740
- uses: actions/checkout@v4
@@ -46,6 +49,7 @@ jobs:
4649
with:
4750
node-version: 20
4851
cache: "pnpm" # 顺便启用 pnpm 缓存,加速
52+
cache-dependency-path: frontend/pnpm-lock.yaml
4953

5054
# Verify pnpm version matches package.json packageManager field
5155
- name: Check pnpm version
@@ -67,11 +71,12 @@ jobs:
6771
uses: stefanzweifel/git-auto-commit-action@v5
6872
with:
6973
commit_message: "chore(docs): sync doc metadata [skip ci]" # ← 防循环
70-
file_pattern: "app/docs/**/*.md app/docs/**/*.mdx generated/doc-contributors.json"
74+
file_pattern: "frontend/app/docs/**/*.md frontend/app/docs/**/*.mdx frontend/generated/doc-contributors.json"
75+
working_directory: . # git-auto-commit-action 建议在根目录运行以处理全局路径
7176

7277
- name: Upload snapshot JSON
7378
uses: actions/upload-artifact@v4
7479
with:
7580
name: doc-contributors-snapshot
76-
path: generated/doc-contributors.json
81+
path: frontend/generated/doc-contributors.json
7782
if-no-files-found: ignore

.gitignore

Lines changed: 17 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -1,61 +1,24 @@
1-
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
2-
3-
# dependencies
4-
/node_modules
5-
/.pnp
6-
.pnp.js
7-
.yarn/install-state.gz
8-
9-
# testing
10-
/coverage
11-
12-
# next.js
13-
/.next/
14-
/out/
15-
16-
# production
17-
/build
18-
19-
# misc
1+
# IDE & System
202
.DS_Store
3+
.vscode/
4+
.idea/
5+
.cursor/
216
*.pem
227

23-
# debug
24-
npm-debug.log*
25-
yarn-debug.log*
26-
yarn-error.log*
27-
28-
# local env files
8+
# Environment (Source of Truth)
9+
.env
10+
.env.local
2911
.env*.local
3012

31-
# vercel
32-
.vercel
33-
34-
# typescript
35-
*.tsbuildinfo
36-
next-env.d.ts
13+
# Dependencies (Root level if any)
14+
node_modules/
15+
package-lock.json
16+
pnpm-lock.yaml
3717

38-
# cursor
39-
.cursor
18+
# Testing
19+
coverage/
4020

41-
# contentlayer
42-
.contentlayer
43-
44-
# source
45-
.source
46-
47-
# package管理
48-
.package-lock.json
49-
50-
# Agents.md
51-
AGENTS.md
52-
53-
# Environment variables
54-
.env
55-
56-
# VS code
57-
.vscode
58-
/generated/prisma
59-
60-
.idea
61-
.claude
21+
# Misc
22+
npm-debug.log*
23+
yarn-debug.log*
24+
yarn-error.log*
File renamed without changes.
File renamed without changes.

frontend/.gitignore

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# Next.js Build
2+
/.next/
3+
/out/
4+
/build/
5+
6+
# Dependencies
7+
node_modules/
8+
9+
# Local env files (These are symlinks, but we should still ignore them)
10+
.env*.local
11+
.env
12+
13+
# TypeScript
14+
*.tsbuildinfo
15+
next-env.d.ts
16+
17+
# Contentlayer & Source
18+
.contentlayer/
19+
.source/
20+
21+
# Generated
22+
/generated/
File renamed without changes.

0 commit comments

Comments
 (0)