You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Snapshots are stored under `tests/__screenshots__/{platform}/` where platform is auto-detected via `process.platform` in `playwright.config.ts`. No env var needed — macOS and Linux CI each use their own folder automatically.
**Updating baselines locally** (after a deliberate visual change):
18
45
```bash
19
-
yarn playwright test# Run all tests
20
-
yarn playwright testvisual-regression.spec.ts # Run single test file
21
-
yarn playwright test --debug # Debug mode
46
+
yarn build && yarn serve
47
+
yarn playwright test--update-snapshots
48
+
git add tests/__screenshots__/darwin/
22
49
```
23
50
24
-
Tests run against a live URL. Locally defaults to `https://ajeetchaulagain.com`; override with `PLAYWRIGHT_TEST_BASE_URL`. In CI, they run against the Netlify preview deployment on PRs to master.
51
+
**Updating CI baselines:** Trigger a CI run with `--update-snapshots` and commit the updated `tests/__screenshots__/linux/` files. The darwin and linux folders are independent — updating one doesn't affect the other.
52
+
53
+
**If Gatsby caching causes a webpack error** after switching branches or reverting packages, run `yarn clean` before `yarn build`.
25
54
26
55
## Architecture
27
56
28
-
**Gatsby static site** — personal portfolio/blog. Content is authored in MDX files and Gatsby dynamically generates pages from them.
57
+
**Gatsby 5 static site** — personal portfolio/blog. Content is MDX files; Gatsby generates pages from them at build time.
29
58
30
59
### Content flow
31
60
32
-
-`src/posts/` — Blog posts as MDX files → rendered via `src/templates/BlogPage/`
33
-
-`src/projects/` — Project entries as MDX files → rendered via `src/templates/ProjectPage/`
34
-
-`gatsby-node.ts` — Queries GraphQL for all posts/projects and programmatically creates pages
-**Markdown decorators** (`src/markdown-decorators/`) — Custom React components injected into MDX rendering (e.g., `ProjectCardDecorator`, `BlogPostCardDecorator`, `ButtonLinkDecorator`). These are passed as components to the MDX provider so MDX authors can use them directly.
40
-
-**Global context** (`src/contexts/GlobalContextProvider.tsx`) — App-wide state (e.g., dark/light theme). Wrapped in `gatsby-browser.js` and `gatsby-ssr.js` to apply to all pages.
41
-
-**Styled components** throughout — use `styled-components-breakpoint` for responsive styles and `styled-components-spacing` for spacing utilities.
42
-
-**TypeScript path alias** — `baseUrl: ./src/` in `tsconfig.json`, so imports can use `components/...`, `hooks/...`, etc. directly.
68
+
-**Markdown decorators** (`src/markdown-decorators/`) — Custom React components injected into MDX (e.g. `BlogPostCardDecorator`, `ButtonLinkDecorator`). Registered in the MDX provider so MDX authors can use them as JSX tags directly in content.
69
+
-**MarkdownRenderer** (`src/components/markdown-renderer/`) — Wraps `MDXProvider`, maps HTML elements (h1–h4, ul, ol, a, p, etc.) to styled components. Add new MDX-injectable components here.
70
+
-**Global context** (`src/contexts/GlobalContextProvider.tsx`) — App-wide state (dark/light theme toggle). Wrapped in both `gatsby-browser.js` and `gatsby-ssr.js`.
71
+
-**Theme system** — `src/components/theme/colors.ts` defines light/dark color tokens; `src/components/theme/brand.ts` defines brand colors (primary, accent). Theme is injected via `ThemeProvider` from styled-components.
72
+
-**TypeScript path alias** — `baseUrl: ./src/` in `tsconfig.json`. Pages and templates import from `components/...`, `hooks/...` etc. (absolute). Components import siblings with relative paths (`../heading/Heading`).
73
+
74
+
### Import conventions
75
+
76
+
-`src/pages/` and `src/templates/` — use absolute barrel imports: `import { Foo } from 'components/foo/Foo'`
77
+
-`src/components/` — use relative imports for siblings: `import { Bar } from '../bar/Bar'`
78
+
- Do not re-export internal styled components from `src/components/index.ts` — only export public-facing React components
43
79
44
80
### Styling
45
81
46
-
Global styles live in `src/styles/` (CSS reset, base styles, Prism themes for light/dark mode). Component styles are co-located with components using styled-components.
82
+
Component styles are co-located in a `styles.tsx` file next to each component. Global styles live in `src/styles/` and are composed in `GlobalStyle` (CSS reset, base styles, Prism themes, scrollbar, code titles).
|`heroBackground`| Header / hero area background |
190
+
|`heroText` / `heroParagraph`| Text rendered on brand background |
191
+
|`cardBorder`| Card / code block borders |
192
+
|`codeHighlightBackground`| Highlighted line fill |
193
+
|`codeHighlightBorderColor`| Highlighted line left-border accent |
194
+
195
+
Theme is toggled via `useThemeToggle` hook → `GlobalContextProvider` → `GlobalStateContext`. Default is `lightTheme`. Wrapped in `gatsby-browser.js` and `gatsby-ssr.js` so it applies to all pages including SSR.
196
+
197
+
### Code syntax highlighting
198
+
199
+
Two Prism themes co-located in `src/styles/`:
200
+
-**Dark:** Laserwave — colourful on dark background
201
+
-**Light:** One Light (Atom) — subtle on white background
202
+
203
+
Theme is applied conditionally in `CodeBlockStyles.tsx`:
The `resolutions` field in `package.json` pins specific transitive dependency versions. Do not remove these without understanding why they were added:
232
+
The `resolutions` field in `package.json` pins transitive dependency versions. Do not remove without understanding why:
51
233
52
234
| Package | Reason |
53
235
|---------|--------|
54
-
|`@types/react`|`@reach/router` (used internally by Gatsby) bundles its own older `@types/react`, causing duplicate React type conflicts. Pinned to force a single version. |
55
-
|`webpack`|CVE-2025-68458 and CVE-2025-68157 (SSRF, LOW) introduced via `gatsby@5`. Fixed in `webpack@5.104.1`. |
56
-
|`sharp`| Gatsby image plugins (gatsby-plugin-sharp, gatsby-transformer-sharp, gatsby-plugin-manifest, gatsby-sharp) each install their own nested copy of `sharp`, causing libvips integrity check failures on Netlify's Linux CI environment. Pinned to force a single hoisted installation. |
236
+
|`@types/react`|`@reach/router` (Gatsby internal) ships its own older `@types/react`, causing duplicate type conflicts. Pinned to force a single version. |
237
+
|`webpack`|CVE-2025-68458 and CVE-2025-68157 (SSRF) via `gatsby@5`. Fixed in `webpack@5.104.1`. |
238
+
|`sharp`| Gatsby image plugins each install their own nested `sharp`, causing libvips integrity failures on Netlify CI. Pinned to force a single hoisted copy. |
57
239
58
240
## Code style
59
241
60
-
- ESLint with Airbnb config + TypeScript; Prettier with single quotes, 2-space indent, 80-char line width, trailing commas (es5)
61
-
- Strict TypeScript — no unused locals/parameters
242
+
- ESLint with Airbnb config + TypeScript; Prettier: single quotes, 2-space indent, 80-char line width, trailing commas (es5)
243
+
- Strict TypeScript — no unused locals/parameters (`strict: true` in tsconfig)
244
+
- No default exports — use named exports throughout
0 commit comments