Skip to content

Commit fc4d457

Browse files
thejimbirchclaude
andcommitted
fix(www): convert SVG attributes to JSX-valid camelCase
- Change clip-path to clipPath - Change fill-rule to fillRule - Change clip-rule to clipRule Fixes build errors in layout.tsx Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
1 parent 10c1ae5 commit fc4d457

3 files changed

Lines changed: 241 additions & 6 deletions

File tree

.claude/settings.local.json

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"permissions": {
3+
"allow": [
4+
"Bash(npm --version)",
5+
"Bash(node --version)",
6+
"Bash(git add:*)",
7+
"Bash(git commit:*)"
8+
]
9+
}
10+
}

CLAUDE.md

Lines changed: 225 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,225 @@
1+
# CLAUDE.md
2+
3+
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
4+
5+
## Project Overview
6+
7+
Next.js for Drupal is a monorepo providing a bridge between Next.js applications and Drupal CMS. It consists of:
8+
9+
- **NPM package** (`packages/next-drupal`): TypeScript library for fetching Drupal content via JSON:API
10+
- **Drupal module** (`modules/next`): Drupal 10/11 module for ISR, draft mode, and revalidation
11+
- **Examples** and **starters**: Reference implementations
12+
13+
## Development Commands
14+
15+
### Setup
16+
17+
```bash
18+
yarn install # Install all dependencies
19+
```
20+
21+
### Running Workspaces
22+
23+
```bash
24+
yarn workspace www dev # Run documentation site (next-drupal.org)
25+
yarn workspace next-drupal dev # Watch mode for next-drupal package
26+
yarn dev # Run all workspaces in parallel
27+
yarn dev:starter # Run drupal + basic-starter in parallel
28+
```
29+
30+
### Testing
31+
32+
```bash
33+
yarn test # Run next-drupal Jest tests (requires .env setup)
34+
yarn test:next # Run Drupal module PHPUnit tests
35+
yarn test:e2e:ci # Run all Cypress end-to-end tests
36+
```
37+
38+
**Note**: Jest tests require environment variables. Copy `.env.example` to `.env` in `packages/next-drupal/`:
39+
40+
```bash
41+
cp packages/next-drupal/.env.example packages/next-drupal/.env
42+
```
43+
44+
### Linting & Formatting
45+
46+
```bash
47+
yarn lint # ESLint for TypeScript/JavaScript
48+
yarn format # Prettier formatting
49+
yarn format:check # Check formatting without writing
50+
yarn phpcs # PHP CodeSniffer for Drupal module
51+
```
52+
53+
### Building
54+
55+
```bash
56+
yarn workspace next-drupal prepare # Build next-drupal package with tsup
57+
```
58+
59+
## Architecture
60+
61+
### Monorepo Structure
62+
63+
- **Turborepo** for build orchestration
64+
- **Lerna** for versioning and publishing (independent versioning)
65+
- **Yarn workspaces** for dependency management
66+
67+
### NPM Package (`packages/next-drupal`)
68+
69+
The package has three main class hierarchies:
70+
71+
1. **NextDrupalBase** (`src/next-drupal-base.ts`)
72+
73+
- Base class providing authentication, fetching, and low-level API interactions
74+
- Handles OAuth token management (client credentials, username/password)
75+
- Provides `fetch()` wrapper with auth and error handling
76+
77+
2. **NextDrupal** (`src/next-drupal.ts`) extends `NextDrupalBase`
78+
79+
- Main class for JSON:API resource operations
80+
- Methods: `getResource()`, `getResourceCollection()`, `createResource()`, `updateResource()`, `deleteResource()`
81+
- Uses Jsona for JSON:API deserialization
82+
- Works with App Router and Pages Router
83+
84+
3. **NextDrupalPages** (`src/next-drupal-pages.ts`) extends `NextDrupal`
85+
- Specialized for Next.js Pages Router
86+
- Provides: `getStaticPathsFromContext()`, `getStaticPropsFromContext()`, `translatePath()`
87+
- Includes draft mode helpers via `next-drupal/draft`
88+
89+
**Key exports**:
90+
91+
- Main: `NextDrupal`, `NextDrupalPages`
92+
- Draft mode: `next-drupal/draft` (for API routes)
93+
- Navigation: `next-drupal/navigation` (menu helpers)
94+
95+
### Drupal Module (`modules/next`)
96+
97+
Core entities and plugins:
98+
99+
- **NextSite** entity: Configures Next.js site endpoints (base URL, preview secret)
100+
- **NextEntityTypeConfig**: Per-entity-type revalidation configuration
101+
- **Plugin system**:
102+
- SiteResolver plugins: Determine which NextSite handles entity revalidation
103+
- Revalidator plugins: Send revalidation requests to Next.js
104+
- **Event subscribers**: Trigger revalidation on entity CRUD operations
105+
106+
Dependencies: `decoupled_router`, `simple_oauth`, `subrequests`, `pathauto`
107+
108+
### JSON:API Integration
109+
110+
The package interacts with Drupal's JSON:API using:
111+
112+
- Resource types format: `{entity_type}--{bundle}` (e.g., `node--article`)
113+
- Jsona library for deserialization
114+
- Query params via `qs` library (filters, includes, sorts)
115+
116+
## Commit Conventions
117+
118+
This project uses [Conventional Commits](https://www.conventionalcommits.org/):
119+
120+
```
121+
<type>(<scope>)<!>: <subject>
122+
123+
<body>
124+
125+
<footer>
126+
```
127+
128+
**Types**: `feat`, `fix`, `docs`, `style`, `refactor`, `perf`, `test`, `build`, `ci`, `chore`, `revert`
129+
130+
**Scopes**: Package/module names (`next-drupal`, `next`, `basic-starter`, `example-auth`, etc.)
131+
132+
**Breaking changes**: Add `!` after scope and include `BREAKING CHANGE:` in footer
133+
134+
**Examples**:
135+
136+
```
137+
feat(next-drupal): add support for Next.js 15
138+
139+
fix(next): correct revalidation URL generation
140+
141+
docs(basic-starter): update environment variables
142+
```
143+
144+
## Testing Strategy
145+
146+
### next-drupal Package
147+
148+
- Jest unit tests in `packages/next-drupal/__tests__`
149+
- Tests run against live Drupal instance (requires environment variables)
150+
- Mock Next.js context objects for Pages Router tests
151+
152+
### Drupal Module
153+
154+
- PHPUnit tests in `modules/next/tests`
155+
- Uses `SIMPLETEST_DB=sqlite://localhost/:memory:`
156+
157+
### E2E Tests
158+
159+
- Cypress tests for examples
160+
- Require local Drupal instance with demo content
161+
162+
## Workspace-Specific Notes
163+
164+
### Examples vs Starters
165+
166+
- **Examples** (`examples/*`): Demonstrate specific features (auth, custom cache, GraphQL, etc.)
167+
- **Starters** (`starters/*`): Production-ready templates for new projects
168+
- Each has separate git repos synced via `scripts/sync-repo.sh`
169+
170+
### Documentation Site (`www`)
171+
172+
- Built with Next.js
173+
- Deployed to Vercel
174+
- Separate branches for version docs: `v1.6`, `v1`, `v0`
175+
176+
## Common Patterns
177+
178+
### Fetching Drupal Content
179+
180+
```typescript
181+
import { NextDrupal } from "next-drupal"
182+
183+
const drupal = new NextDrupal(process.env.NEXT_PUBLIC_DRUPAL_BASE_URL)
184+
185+
// Fetch single resource
186+
const node = await drupal.getResource("node--article", uuid)
187+
188+
// Fetch collection with params
189+
const articles = await drupal.getResourceCollection("node--article", {
190+
params: {
191+
"filter[status]": 1,
192+
"fields[node--article]": "title,body",
193+
include: "field_image",
194+
sort: "-created",
195+
},
196+
})
197+
```
198+
199+
### Pages Router Integration
200+
201+
```typescript
202+
import { NextDrupalPages } from "next-drupal"
203+
204+
const drupal = new NextDrupalPages(...)
205+
206+
export async function getStaticPaths() {
207+
return await drupal.getStaticPathsFromContext("node--article", context)
208+
}
209+
210+
export async function getStaticProps(context) {
211+
const resource = await drupal.getResourceFromContext("node--article", context)
212+
return { props: { resource } }
213+
}
214+
```
215+
216+
## Release Process
217+
218+
Managed via Lerna and semantic versioning. Maintainers use:
219+
220+
- `npx lerna version --no-push` to tag releases
221+
- `npx lerna publish from-git` to publish to npm
222+
- `yarn sync:modules` to sync Drupal module to drupal.org
223+
- `yarn sync:starters:release` to sync starters to separate repos
224+
225+
Alpha/beta releases use `--conventional-prerelease` and publish with `--dist-tag canary`.

www/components/layout.tsx

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -63,10 +63,10 @@ export function Layout({
6363
fill="none"
6464
xmlns="http://www.w3.org/2000/svg"
6565
>
66-
<g clip-path="url(#a)" fill="#fff">
66+
<g clipPath="url(#a)" fill="#fff">
6767
<path
68-
fill-rule="evenodd"
69-
clip-rule="evenodd"
68+
fillRule="evenodd"
69+
clipRule="evenodd"
7070
d="M33 19.362c-1.633-1.494-3.776-2.316-6.175-2.316-5.364 0-9.566 4.231-9.566 9.632s4.202 9.632 9.566 9.632c2.398 0 4.541-.821 6.175-2.316v1.95h3.624V17.41H33zm0 7.317c0 3.425-2.654 6.108-6.042 6.108-3.406 0-6.075-2.683-6.075-6.108s2.668-6.108 6.075-6.108c3.388 0 6.042 2.683 6.042 6.108m16.376-9.632c-1.988 0-3.67.578-4.979 1.694v-1.329h-3.591v18.534h3.591v-9.732c0-3.586 1.766-5.643 4.846-5.643 2.489 0 3.916 1.488 3.916 4.083v11.292h3.624V24.654c0-4.55-2.977-7.607-7.407-7.607m20.056 0c-5.438 0-9.699 4.231-9.699 9.632s4.26 9.632 9.699 9.632 9.665-4.231 9.665-9.632-4.246-9.632-9.665-9.632m0 3.524c3.388 0 6.041 2.683 6.041 6.108s-2.654 6.108-6.041 6.108c-3.406 0-6.075-2.683-6.075-6.108s2.668-6.108 6.075-6.108m22.17-3.524c-2.378 0-4.544.851-6.174 2.361v-1.996h-3.591v27.191l3.591-2.269v-8.385c1.63 1.51 3.796 2.361 6.174 2.361 5.364 0 9.566-4.231 9.566-9.632s-4.202-9.632-9.566-9.632m5.975 9.632c0 3.425-2.668 6.108-6.075 6.108s-6.075-2.683-6.075-6.108 2.668-6.108 6.075-6.108 6.075 2.683 6.075 6.108m6.45 9.267h3.59V18.241l-3.59 2.27zm6.035-27.203-4.446 2.794s-1.448.753-1.656 2.212l-.004-.003a2.5 2.5 0 0 0-.026.347v4.61q.001.18.026.347l3.448-2.208-.001-.001 3.752-2.413s.975-.614.975-2.018v-5.5s-.703.858-2.068 1.833"
7171
/>
7272
<path d="m8.049 26.363 9.675-8.993H12.67l-8.879 8.11V13.307A3.61 3.61 0 0 0 .183 9.699V36h3.608l-.144-8.92L12.88 36h5.087zM-.002 50.926l.657-1.386c.924.835 2.506 1.439 4.105 1.439 2.15 0 3.074-.835 3.074-1.919C7.834 46.021.3 47.94.3 43.321c0-1.919 1.492-3.554 4.762-3.554 1.457 0 2.968.391 3.998 1.102l-.586 1.422a6.4 6.4 0 0 0-3.412-1.013c-2.114 0-3.021.889-3.021 1.972 0 3.039 7.534 1.137 7.534 5.704 0 1.902-1.528 3.536-4.816 3.536-1.901 0-3.767-.64-4.762-1.564zm19.41.871c-.515.444-1.297.657-2.061.657-1.901 0-2.985-1.048-2.985-2.95v-5.171h-1.6v-1.404h1.599v-2.061h1.706v2.061h2.701v1.404h-2.701v5.1c0 1.013.533 1.581 1.475 1.581.498 0 .977-.16 1.333-.444zm12.858-8.867v9.418h-1.617v-1.422c-.693.978-1.866 1.528-3.199 1.528-2.435 0-4.051-1.333-4.051-4.105v-5.42h1.706v5.224c0 1.848.924 2.772 2.541 2.772 1.777 0 2.914-1.102 2.914-3.127v-4.869zm13.562-3.928v13.346h-1.635v-1.492c-.764 1.066-1.972 1.599-3.359 1.599-2.754 0-4.762-1.937-4.762-4.816s2.008-4.798 4.762-4.798c1.333 0 2.506.498 3.287 1.511v-4.279l1.706-1.07zm-1.688 8.637c0-2.008-1.368-3.305-3.163-3.305-1.813 0-3.181 1.297-3.181 3.305s1.368 3.323 3.181 3.323c1.795 0 3.163-1.315 3.163-3.323m6.755-7.623c0-.622.498-1.12 1.155-1.12s1.155.48 1.155 1.084c0 .64-.48 1.137-1.155 1.137-.657 0-1.155-.48-1.155-1.102m.302 2.914h1.706v9.418h-1.706zm5.851 4.709c0-2.808 2.079-4.798 4.905-4.798s4.887 1.99 4.887 4.798-2.061 4.816-4.887 4.816-4.905-2.008-4.905-4.816m8.067 0c0-2.008-1.351-3.305-3.163-3.305s-3.181 1.297-3.181 3.305 1.368 3.323 3.181 3.323 3.163-1.315 3.163-3.323m5.031 3.714.711-1.351c.8.569 2.079.978 3.305.978 1.581 0 2.239-.48 2.239-1.28 0-2.114-5.953-.284-5.953-4.034 0-1.688 1.511-2.825 3.927-2.825 1.226 0 2.612.32 3.43.853l-.729 1.351c-.853-.551-1.795-.746-2.719-.746-1.493 0-2.221.551-2.221 1.297 0 2.221 5.971.409 5.971 4.069 0 1.706-1.564 2.79-4.069 2.79-1.564 0-3.11-.48-3.892-1.102m45.341-41.405h-.502V7.308h-.903v-.43h2.307v.43h-.903zm2.699 0-.89-2.563h-.017q.036.571.036 1.071v1.493h-.456V6.877h.708l.852 2.441h.013l.877-2.441h.71v3.069h-.483V8.428q0-.229.011-.596.012-.367.02-.445h-.017l-.922 2.559z" />
@@ -335,10 +335,10 @@ export function Layout({
335335
fill="none"
336336
xmlns="http://www.w3.org/2000/svg"
337337
>
338-
<g clip-path="url(#a)" fill="#000">
338+
<g clipPath="url(#a)" fill="#000">
339339
<path
340-
fill-rule="evenodd"
341-
clip-rule="evenodd"
340+
fillRule="evenodd"
341+
clipRule="evenodd"
342342
d="M32.997 19.301c-1.633-1.494-3.776-2.315-6.174-2.315-5.363 0-9.565 4.23-9.565 9.631s4.201 9.631 9.565 9.631c2.398 0 4.541-.821 6.174-2.315v1.95h3.623V17.351h-3.623zm0 7.316c0 3.425-2.653 6.108-6.041 6.108-3.406 0-6.074-2.683-6.074-6.108s2.668-6.107 6.074-6.107c3.388 0 6.041 2.683 6.041 6.107m16.374-9.631c-1.988 0-3.67.578-4.978 1.694v-1.329h-3.59v18.532h3.59v-9.731c0-3.586 1.766-5.642 4.846-5.642 2.489 0 3.916 1.488 3.916 4.082v11.291h3.623V24.592c0-4.549-2.976-7.606-7.407-7.606m20.054 0c-5.438 0-9.698 4.23-9.698 9.631s4.26 9.631 9.698 9.631 9.664-4.231 9.664-9.631-4.245-9.631-9.664-9.631m0 3.524c3.387 0 6.041 2.683 6.041 6.107s-2.653 6.108-6.041 6.108c-3.406 0-6.074-2.683-6.074-6.108s2.668-6.107 6.074-6.107m22.168-3.524c-2.378 0-4.544.851-6.174 2.361v-1.996h-3.59V44.54l3.59-2.269v-8.384c1.63 1.51 3.796 2.361 6.174 2.361 5.363 0 9.565-4.231 9.565-9.631s-4.201-9.631-9.565-9.631m5.975 9.631c0 3.425-2.668 6.108-6.074 6.108s-6.074-2.683-6.074-6.108 2.668-6.107 6.074-6.107 6.074 2.683 6.074 6.107m6.449 9.266h3.59V18.18l-3.59 2.27zm6.034-27.202-4.446 2.794s-1.448.753-1.656 2.212l-.004-.003a2.5 2.5 0 0 0-.026.347v4.609q.001.18.026.347l3.448-2.208-.001-.001 3.752-2.413s.975-.614.975-2.018V6.849s-.702.858-2.067 1.833"
343343
/>
344344
<path d="m8.048 26.302 9.674-8.993h-5.053l-8.879 8.11V13.246A3.607 3.607 0 0 0 .183 9.639v26.298H3.79l-.144-8.919 9.232 8.919h5.086zm-8.05 24.559.657-1.386c.924.835 2.506 1.439 4.105 1.439 2.15 0 3.074-.835 3.074-1.919C7.834 45.957.3 47.876.3 43.256c0-1.919 1.492-3.554 4.762-3.554 1.457 0 2.967.391 3.998 1.102l-.586 1.421a6.4 6.4 0 0 0-3.412-1.013c-2.114 0-3.021.889-3.021 1.972 0 3.038 7.534 1.137 7.534 5.704 0 1.901-1.528 3.536-4.815 3.536-1.901 0-3.767-.64-4.762-1.564zm19.409.871c-.515.444-1.297.657-2.061.657-1.901 0-2.985-1.048-2.985-2.949v-5.171h-1.6v-1.403h1.599v-2.061h1.706v2.061h2.701v1.403h-2.701v5.1c0 1.013.533 1.581 1.475 1.581.498 0 .977-.16 1.333-.444zm12.857-8.866v9.417h-1.617v-1.421c-.693.977-1.866 1.528-3.198 1.528-2.434 0-4.051-1.333-4.051-4.105v-5.419h1.706v5.224c0 1.848.924 2.772 2.541 2.772 1.777 0 2.914-1.101 2.914-3.127v-4.868zm13.561-3.928v13.345H44.19v-1.492c-.764 1.066-1.972 1.599-3.358 1.599-2.754 0-4.762-1.937-4.762-4.815s2.008-4.797 4.762-4.797c1.333 0 2.506.498 3.287 1.51v-4.279zm-1.688 8.636c0-2.008-1.368-3.305-3.163-3.305-1.812 0-3.181 1.297-3.181 3.305s1.368 3.323 3.181 3.323c1.794 0 3.163-1.315 3.163-3.323m6.755-7.622c0-.622.498-1.119 1.155-1.119s1.155.48 1.155 1.084c0 .64-.48 1.137-1.155 1.137-.657 0-1.155-.48-1.155-1.101m.302 2.914H52.9v9.417h-1.706zm5.851 4.708c0-2.807 2.079-4.797 4.904-4.797s4.886 1.99 4.886 4.797-2.061 4.815-4.886 4.815-4.904-2.008-4.904-4.815m8.067 0c0-2.008-1.35-3.305-3.163-3.305s-3.181 1.297-3.181 3.305 1.368 3.323 3.181 3.323 3.163-1.315 3.163-3.323m5.03 3.714.711-1.35c.8.569 2.079.977 3.305.977 1.581 0 2.239-.48 2.239-1.28 0-2.114-5.952-.284-5.952-4.033 0-1.688 1.51-2.825 3.927-2.825 1.226 0 2.612.32 3.429.853l-.728 1.35c-.853-.551-1.794-.746-2.718-.746-1.493 0-2.221.551-2.221 1.297 0 2.221 5.97.409 5.97 4.069 0 1.706-1.564 2.79-4.069 2.79-1.564 0-3.109-.48-3.891-1.102zm45.337-41.402h-.502V7.248h-.903v-.431h2.307v.43h-.903zm2.699 0-.89-2.563h-.017q.036.571.036 1.07v1.492h-.455V6.817h.708l.852 2.441h.013l.877-2.441h.71v3.069h-.483V8.368q0-.229.011-.596.012-.367.02-.445h-.017l-.921 2.559z" />

0 commit comments

Comments
 (0)