-
Notifications
You must be signed in to change notification settings - Fork 22
Expand file tree
/
Copy pathdeployment.mdc
More file actions
62 lines (44 loc) · 2.83 KB
/
Copy pathdeployment.mdc
File metadata and controls
62 lines (44 loc) · 2.83 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
---
description: CI/CD pipelines, Vercel deployment, GitHub Pages redirects, SEO preservation
globs: .github/workflows/**,vercel.json,scripts/**,public/sw.js
alwaysApply: false
---
# Deployment
## Production (Vercel)
- **Domain**: codesmells.org
- **Output**: Static (`output: 'static'` in `astro.config.mjs`), no `@astrojs/vercel` adapter
- **Build**: `pnpm build` (runs `scripts/generate-og-images.mjs` then `astro build`)
- **Config**: `vercel.json` — security headers, cache rules for `/_astro/*` and `/og/*`, legacy `/smells/*` redirects (301)
- **Preview deploys**: Automatic on PRs via Vercel GitHub integration
- **Trailing slash**: `never` in both `astro.config.mjs` and `vercel.json`
## Environment Variables
| Variable | Where | Notes |
|----------|-------|-------|
| `PUBLIC_GA_TRACKING_ID` | Vercel (Production only) | GA4 measurement ID, consent-gated |
Site URL is hardcoded in `src/lib/constants.ts` (`https://codesmells.org`), not an env var.
## CI Pipeline (`.github/workflows/ci.yml`)
Runs on push to `main` and PRs:
1. **Lint** — ESLint + Prettier + `astro check` (type-check)
2. **Unit Tests** — Vitest (`pnpm test`)
3. **Build** — `pnpm build`, verifies 56 smell pages in `dist/smells`, validates RSS feed, runs `scripts/verify-sitemap.mjs`, runs `pnpm test:build-output`
4. **Bundle Size** — `size-limit` against build output (configured in `.size-limit.json`)
5. **E2E** — Playwright. PRs: chromium + reduced-motion. Main: 6-browser matrix (chromium, reduced-motion, firefox, webkit, mobile-chrome, mobile-safari)
Node 22, pnpm 10. Build artifact passed between jobs.
## Preview E2E (`.github/workflows/e2e-preview.yml`)
Triggers on `deployment_status` for Vercel preview environments. Runs Playwright smoke tests (`@smoke` tag) against the preview URL.
## GitHub Pages (Redirect Layer)
The `gh-pages` branch serves HTML meta-refresh redirects from the legacy `luzkan.github.io/smells` URLs to `codesmells.org`. Generated by `scripts/generate-gh-pages-redirects.mjs`, deployed via manual workflows.
## SEO Assets
| Asset | Implementation |
|-------|---------------|
| Sitemap | `@astrojs/sitemap` integration |
| RSS | `@astrojs/rss` at `src/pages/rss.xml.ts` |
| Canonical URLs | `<link rel="canonical">` in `SEOHead.astro` pointing to `codesmells.org` |
| Meta tags | `src/components/seo/SEOHead.astro` (title, description, OpenGraph, Twitter) |
| Structured data | `src/components/seo/JsonLd.astro` (WebSite, Article, BreadcrumbList, ItemList) |
| OG images | Pre-generated locally via `scripts/generate-og-images.mjs`, committed as static assets |
| Robots | `public/robots.txt` |
| Manifest | `src/pages/site.webmanifest.ts` (generated from content collection count) |
| Analytics | GA4 via `PUBLIC_GA_TRACKING_ID` (consent-gated) + `@vercel/analytics` |
## Anti-patterns
- Do not add `@astrojs/vercel` — static output needs no adapter