Skip to content

Commit cec8c26

Browse files
authored
PR.02 setup/devflow-assets
Add project assets and update dependencies
2 parents 7813b15 + 9f3f25e commit cec8c26

89 files changed

Lines changed: 10831 additions & 2787 deletions

Some content is hidden

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

README.md

Lines changed: 7 additions & 173 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,12 @@
1-
![Next.js 16 - a modern template repo](x_docs/images/github-social-thin.jpg)
1+
# README - Devflow
22

3-
*A Next.js 16 template with modern tooling and CI/CD automation. Code quality checks (linting, formatting, type checking, testing) run via Lefthook locally and GitHub Actions on PRs. Dependency updates automated via Dependabot. Deployments handled by Vercel: Preview for PRs, Production for main. Assumes Claude Code.*
4-
5-
<div align="center">
6-
<a href="x_docs/images/app_screenshot.jpg" target="_blank">
7-
<img src="x_docs/images/app_screenshot.jpg" alt="Homepage in light and dark modes with UI library guidance" width="750">
8-
</a>
9-
<p><em>Template homepage with theming setup — UI component library still needed</em></p>
10-
</div>
3+
A community-driven platform for asking and answering programming questions. Get help, share knowledge, and collaborate with other developers from around the world.
114

125
---
136

14-
## 🎯 Use This Template
15-
16-
1. Follow [x_docs/project-setup.md](x_docs/project-setup.md) to clone, set up GitHub, set up Vercel.
17-
18-
2. Install UI components like shadcn/ui
19-
20-
3. Replace page.tsx, layout.tsx, counter.tsx, button.tsx, theme-toggle.tsx (use an icon), globals.css, fonts.ts
21-
227
## What's Installed?
238

24-
For exact list see [package.json](package.json)
9+
Next.js 16 with the below:
2510

2611
| Category | Tool | What it does |
2712
| :------- | :--- | :----------- |
@@ -38,29 +23,7 @@ For exact list see [package.json](package.json)
3823
| Analytics | [Vercel Speed Insights](https://vercel.com/docs/speed-insights) | Real user performance metrics viewable on Vercel |
3924
| | [Vercel Web Analytics](https://vercel.com/docs/analytics) | Privacy-friendly visitor analytics viewable on Vercel |
4025

41-
![Explained banner](x_docs/images/explained.jpg)
42-
43-
## 📦 Next.js Installation Explained
44-
45-
This template was initialised with the following options and then updated:
46-
47-
```bash
48-
# Next.js installer
49-
$ npx create-next-app@latest
50-
51-
Would you like to use TypeScript? ✔️ Yes
52-
Which linter would you like to use? ✔️ Biome
53-
Would you like to use React Compiler? ✔️ Yes
54-
Would you like to use Tailwind CSS? ✔️ Yes
55-
Would you like your code inside a src/ directory? ❌ No
56-
Would you like to use App Router? (recommended) ✔️ Yes
57-
Would you like to customise the import alias (@/* by default)? ❌ No
58-
59-
# Update all dependencies to latest versions
60-
npm outdated # Check outdated packages (2025-11-20)
61-
npx npm-check-updates -u # Rewrite package.json with latest
62-
npm install # Install updated versions
63-
```
26+
For exact list see [package.json](package.json)
6427

6528
## ⚙️ Config Files Explained
6629

@@ -93,139 +56,10 @@ npm install # Install updated versions
9356

9457
---
9558

96-
## 🔄 CI/CD Workflow Explained
97-
98-
This diagram shows how CI automation integrates into a typical development workflow:
99-
100-
```text
101-
┌─────────────────────────────────────────────────────────────────────────────┐
102-
│ 💻 LAPTOP: Create a new branch (tests on local dev machine)
103-
└─────────────────────────────────────────────────────────────────────────────┘
104-
105-
git checkout -b feature/add-dark-mode
106-
107-
├─ Commit 1: Add light/dark mode ⚡ pre-commit hook runs (3s)
108-
│ ├─ 🎨 Biome lint and format ✅ Auto-fixed & staged
109-
│ ├─ 🔍 TypeScript type check ✅ Pass
110-
│ └─ 🧪 Vitest unit tests ✅ Pass
111-
│ (then committed on all pass)
112-
113-
├─ Commit 2: (some more work here) ⚡ pre-commit hook runs again
114-
115-
└─ Commit 3: (some more work here) ⚡ pre-commit hook runs again
116-
117-
git push origin feature/add-dark-mode ⚡ pre-PUSH hook runs
118-
└─ 🎭 Playwright E2E tests ✅ Pass (then pushed to GH)
119-
120-
┌─────────────────────────────────────────────────────────────────────────────┐
121-
│ ☁️ GITHUB: Workflows kickoff on GitHub machines when PR is created
122-
└─────────────────────────────────────────────────────────────────────────────┘
123-
124-
Create Pull Request → GitHub Actions triggered automatically
125-
126-
├─ 🤖 Workflow 1: Lint & Type (biome, tsc)
127-
│ ├─ Checkout code
128-
│ ├─ Setup Node.js LTS
129-
│ ├─ Install dependencies (npm ci)
130-
│ ├─ Run Biome checks ✅ Pass
131-
│ └─ Run TypeScript checks ✅ Pass
132-
133-
├─ 🤖 Workflow 2: Unit Tests (vitest)
134-
│ ├─ Checkout code
135-
│ ├─ Setup Node.js LTS
136-
│ ├─ Install dependencies (npm ci)
137-
│ └─ Run Vitest tests ✅ Pass
138-
139-
└─ 🤖 Workflow 3: E2E Tests (playwright)
140-
├─ Checkout code
141-
├─ Setup Node.js LTS
142-
├─ Install dependencies (npm ci)
143-
├─ Install Playwright browsers
144-
├─ Build Next.js production
145-
└─ Run Playwright tests ✅ Pass
146-
147-
── Meanwhile, Vercel deploys Preview ──────────────────────────
148-
149-
🚀 Vercel: Preview deployment ready
150-
└─ Sends repository_dispatch event to GitHub
151-
152-
└─ 🤖 Workflow 4: E2E Tests on Vercel Preview
153-
├─ Triggered by Vercel (not PR event)
154-
├─ Runs Playwright against live Preview URL
155-
└─ Tests real Vercel deployment ✅ Pass
156-
157-
GITHUB PR Status: ✅ All checks passed
158-
159-
🐰 CodeRabbit AI Review Complete
160-
└─ 3 nitpick comments posted:
161-
├─ "Consider using const instead of let" (Button.tsx:12)
162-
├─ "Add JSDoc comment" (ThemeContext.tsx:8)
163-
└─ "Extract magic string to constant" (utils.ts:45)
164-
165-
┌─────────────────────────────────────────────────────────────────────────────┐
166-
│ 💻 Back to Laptop (Addressing 1 out of 3 nitpick comments on open PR)
167-
└─────────────────────────────────────────────────────────────────────────────┘
168-
169-
├─ Commit 4: Use const instead of let ⚡ pre-commit hook runs
170-
171-
git push origin feature/add-dark-mode ⚡ pre-push hook runs
172-
└─ 🎭 Playwright E2E tests ✅ Pass (then pushed to GH)
173-
174-
┌─────────────────────────────────────────────────────────────────────────────┐
175-
│ ☁️ GITHUB (Workflows kick off again on any PR changes)
176-
└─────────────────────────────────────────────────────────────────────────────┘
177-
178-
New commits pushed → GitHub Actions re-run automatically
179-
180-
├─ 🤖 Lint & Type ✅ Pass
181-
├─ 🤖 Unit Tests ✅ Pass
182-
└─ 🤖 E2E Tests ✅ Pass
183-
184-
PR Status: ✅ All checks passed (1 new commit)
185-
🐰 CodeRabbit: "Looks good! 1 issue resolved."
186-
187-
Okay I'm ready! [Merge Pull Request] ← Click! 🎉
188-
189-
┌─────────────────────────────────────────────┐
190-
│ Branch Protection Verified: │
191-
│ ✅ All status checks passed │
192-
│ ✅ Branch is up to date with main │
193-
└─────────────────────────────────────────────┘
194-
195-
main branch updated (merge commit preserves 4 commits)
196-
└─ 🚀 Vercel deployment triggered → Production
197-
```
198-
199-
Key CI Takeaways
200-
201-
- Local Hooks — Catch issues before commit or reaching GitHub
202-
- GitHub Actions — Validate every PR with fresh environment (reproducible CI)
203-
- Branch Protection — Prevents merging broken code (all checks must pass)
204-
- Fast Feedback — Pre-commit catches 90% of issues locally in ~3s vs ~2min CI wait
205-
- Quality Gates — Code is validated 2× (local + CI) before reaching production
206-
207-
![Quick rough notes](x_docs/images/rough.jpg)
208-
20959
## 📝 Quick Notes
21060

211-
(1) Use Ngrok to Test App From Phone
212-
213-
```markdown
214-
1. Sign up and follow https://dashboard.ngrok.com/get-started/setup/linux
215-
2. Then: (Terminal 1: `npm run dev`) + (Terminal 2: `ngrok http 3000`)
216-
3. Ngrok gives a URL to connect from phone (shareable)
217-
```
218-
219-
(2) How Vitest Pieces Work Together
220-
221-
```markdown
222-
1. When you run npm test, Vitest loads vitest.config.ts
223-
2. The config tells Vitest to use jsdom and load `vitest.setup.ts`
224-
3. Your test files can use global test functions and extended matchers
225-
4. The @/* import alias works in tests thanks to `vite-tsconfig-paths`
226-
5. React components are compiled with React Compiler (matching prod)
227-
```
61+
(1) Use Ngrok to Test App From Phone: (Terminal 1: `npm run dev`) + (Terminal 2: `ngrok http 3000`)
22862

229-
(3) GitHub - A branch protection ruleset to be setup to protect main. Incldues checks for GitHub workflow jobs to pass before merging PR to main. See [x_docs/project-setup.md](x_docs/project-setup.md).
63+
(2) GitHub Action - A branch protection ruleset exists to protect main. Incldues checks for GitHub workflow jobs to pass before merging PR to main. See [x_docs/project-setup.md](x_docs/project-setup.md) for config details.
23064

231-
(4) Vercel For Deploys - When you raise a PR it automatically deploys to Vercel Preview and Playwright e2e tests run on that too in addition to GitHub servers. When you merge the PR into main, you are deploying to Vercel prod. See [x_docs/project-setup.md](x_docs/project-setup.md).
65+
(3) Vercel For Deploys - When you raise a PR it automatically deploys to Vercel Preview and Playwright e2e tests run on that too in addition to GitHub servers. When you merge the PR into main, you are deploying to Vercel prod. See [x_docs/project-setup.md](x_docs/project-setup.md) for config details.

biome.json

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"$schema": "https://biomejs.dev/schemas/2.3.7/schema.json",
2+
"$schema": "https://biomejs.dev/schemas/2.3.8/schema.json",
33
"vcs": {
44
"enabled": true,
55
"clientKind": "git",
@@ -8,7 +8,14 @@
88
},
99
"files": {
1010
"ignoreUnknown": true,
11-
"includes": ["**", "!node_modules", "!.next", "!dist", "!build"]
11+
"includes": [
12+
"**",
13+
"!node_modules",
14+
"!.next",
15+
"!dist",
16+
"!build",
17+
"!x_docs/reference"
18+
]
1219
},
1320
"css": {
1421
"parser": {

0 commit comments

Comments
 (0)