Skip to content

Commit 6cfba89

Browse files
committed
Resolve package-lock.json merge conflict from upstream sync
2 parents f9461db + eac0c7c commit 6cfba89

29 files changed

+1582
-371
lines changed

.github/workflows/claude.yml

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,12 +38,28 @@ jobs:
3838

3939
# Direct prompt for automated review
4040
direct_prompt: |
41+
You are reviewing a PR for Pilot, a Shopify Hydrogen theme powered by Weaverse. This project uses:
42+
- React Router 7, TypeScript, and Tailwind CSS v4
43+
- Weaverse for visual page building
44+
- Biome for linting/formatting (not ESLint/Prettier)
45+
- GraphQL with code generation
46+
- Parallel data loading patterns
47+
4148
Please review this pull request and provide feedback on:
42-
- Code quality and best practices
43-
- Potential bugs or issues
44-
- Performance considerations
49+
- Code quality and adherence to project conventions (check CLAUDE.md for guidelines)
50+
- Weaverse section implementation (must use forwardRef and export schema)
51+
- GraphQL usage and type safety
52+
- Performance considerations (especially parallel data loading)
53+
- Biome linting compliance
54+
- Test coverage (Playwright E2E tests)
4555
- Security concerns
46-
- Test coverage
56+
- Proper TypeScript typing (avoid `any`)
57+
58+
Key areas to check:
59+
- Routes should follow `($locale).{route}.tsx` pattern
60+
- Weaverse sections must be registered in `/app/weaverse/components.ts`
61+
- Use `Promise.all()` for parallel data fetching
62+
- Follow the project's code conventions (camelCase, double quotes, semicolons)
4763
4864
Be constructive and helpful in your feedback.
4965

CLAUDE.md

Lines changed: 115 additions & 69 deletions
Original file line numberDiff line numberDiff line change
@@ -4,23 +4,25 @@ This file provides guidance to Claude Code (claude.ai/code) when working with co
44

55
## Project Overview
66

7-
This is **Pilot**, a Shopify Hydrogen theme powered by Weaverse - a visual page builder for Hydrogen storefronts. The project is built with React, TypeScript, Remix, and Tailwind CSS.
7+
This is **Pilot**, a Shopify Hydrogen theme powered by Weaverse - a visual page builder for Hydrogen storefronts. The project is built with React, TypeScript, React Router 7, and Tailwind CSS v4. It runs on Node.js 20+ and uses Biome for linting/formatting.
88

99
## Essential Commands
1010

1111
### Development
1212
```bash
1313
npm run dev # Start development server on port 3456
14+
npm run dev:ca # Start with customer account push (unstable)
1415
npm run build # Production build with GraphQL codegen
1516
npm run preview # Preview production build
1617
npm start # Start production server
18+
npm run clean # Clean all build artifacts and dependencies
1719
```
1820

19-
### Code Quality
21+
### Code Quality (Always run before committing)
2022
```bash
2123
npm run biome # Check for linting/formatting errors
2224
npm run biome:fix # Fix linting/formatting errors
23-
npm run format # Format code
25+
npm run format # Format code with Biome
2426
npm run typecheck # Run TypeScript type checking
2527
```
2628

@@ -44,112 +46,156 @@ All routes follow the pattern `($locale).{route}.tsx` to support internationaliz
4446
- Collections: `($locale).collections.$collectionHandle.tsx`
4547
- Account: `($locale).account.*`
4648
- API routes: `($locale).api.*`
49+
- Cart operations: `($locale).cart.*`
50+
- Policies & Pages: `($locale).pages.$pageHandle.tsx`, `($locale).policies.$policyHandle.tsx`
4751

4852
### Key Architectural Patterns
4953

50-
1. **Weaverse Integration**: Every page route loads Weaverse data alongside GraphQL queries using parallel data loading:
54+
1. **Parallel Data Loading**: Every page route loads Weaverse data alongside GraphQL queries using `Promise.all()`:
5155
```typescript
52-
const [weaverseData, collections] = await Promise.all([
53-
context.weaverse.loadPage(),
54-
storefront.query(COLLECTIONS_QUERY)
56+
const [{ shop, product }, weaverseData, productReviews] = await Promise.all([
57+
storefront.query(PRODUCT_QUERY, { variables }),
58+
weaverse.loadPage({ type: "PRODUCT", handle }),
59+
getJudgeMeProductReviews({ context, handle }),
5560
]);
5661
```
5762

5863
2. **Component Structure**:
59-
- `/app/sections/` - Weaverse visual builder sections with schema exports
60-
- `/app/components/` - Reusable UI components organized by feature
61-
- Each Weaverse section exports both the component and a schema for visual editing
64+
- `/app/sections/` - Weaverse visual builder sections with schema exports and optional loaders
65+
- `/app/components/` - Reusable UI components organized by feature (cart/, product/, layout/, customer/)
66+
- Each Weaverse section must export: default component + schema + optional loader
6267

6368
3. **Data Fetching**:
6469
- GraphQL fragments in `/app/graphql/fragments.ts`
6570
- Complete queries in `/app/graphql/queries.ts`
6671
- Route loaders handle all data fetching server-side
72+
- Use `routeHeaders` for consistent cache control
6773

6874
4. **Styling**:
69-
- Tailwind CSS with custom utilities
75+
- Tailwind CSS v4 with custom utilities
7076
- class-variance-authority (cva) for component variants
7177
- Use the `cn()` utility from `/app/utils/cn.ts` for class merging
78+
- Biome's `useSortedClasses` enabled for `clsx`, `cva`, and `cn` functions
7279

7380
5. **Type Safety**:
7481
- GraphQL types are auto-generated via codegen
7582
- Path alias `~/` maps to `/app/` directory
7683
- Strict TypeScript configuration
84+
- Two separate codegen outputs:
85+
- `storefront-api.generated.d.ts` - For all storefront queries (excludes account routes)
86+
- `customer-account-api.generated.d.ts` - For customer account queries (only in `*.account*.{ts,tsx,js,jsx}` files)
7787

7888
### Important Integrations
7989

8090
- **Weaverse**: Visual page builder - sections must be registered in `/app/weaverse/components.ts`
8191
- **Judge.me**: Product reviews integration via utilities in `/app/utils/judgeme.ts`
8292
- **Analytics**: Shopify Analytics integrated throughout components
83-
- **Customer Accounts**: New Shopify Customer Account API support
84-
85-
### Development Guidelines
93+
- **Customer Accounts**: New Shopify Customer Account API support (OAuth-based)
94+
- **Radix UI**: For accessible UI primitives (accordion, dialog, dropdown, etc.)
95+
- **Swiper**: For carousel/slideshow functionality
8696

87-
1. **Adding New Sections**:
88-
- Create folder in `/app/sections/`
89-
- Export component and schema
90-
- Register in `/app/weaverse/components.ts`
97+
### Weaverse Section Development
9198

92-
2. **Route Data Loading**:
93-
- Always load Weaverse data in route loaders
94-
- Use parallel loading with `Promise.all()`
95-
- Set appropriate cache headers
99+
1. **Creating a New Section**:
100+
```typescript
101+
// app/sections/my-section/index.tsx
102+
import { createSchema, type HydrogenComponentProps } from '@weaverse/hydrogen';
103+
import { forwardRef } from 'react';
104+
105+
interface MyProps extends HydrogenComponentProps {
106+
heading: string;
107+
}
108+
109+
const MySection = forwardRef<HTMLElement, MyProps>((props, ref) => {
110+
// Component implementation
111+
});
112+
113+
export default MySection;
114+
115+
export const schema = createSchema({
116+
type: 'my-section',
117+
title: 'My Section',
118+
settings: [/* ... */]
119+
});
120+
121+
// Optional loader for server-side data fetching
122+
export const loader = async ({ weaverse, data }) => {
123+
// Fetch data
124+
};
125+
```
96126

97-
3. **Component Patterns**:
98-
- Use TypeScript for all new components
99-
- Follow existing schema patterns for Weaverse sections
100-
- Implement proper loading states with Suspense
127+
2. **Register in `/app/weaverse/components.ts`**:
128+
```typescript
129+
import * as MySection from "~/sections/my-section";
130+
export const components = [
131+
// ... existing components
132+
MySection,
133+
];
134+
```
101135

102-
4. **GraphQL Usage**:
103-
- Add fragments to `/app/graphql/fragments.ts`
104-
- Run `npm run codegen` after GraphQL changes
105-
- Two separate codegen outputs:
106-
- `storefront-api.generated.d.ts` - For all storefront queries (excludes account routes)
107-
- `customer-account-api.generated.d.ts` - For customer account queries (only in `*.account*.{ts,tsx,js,jsx}` files)
108-
- Place customer account queries ONLY in account-related route files
136+
### Route Data Loading Pattern
137+
138+
```typescript
139+
export async function loader({ params, request, context }: LoaderFunctionArgs) {
140+
const { handle } = params;
141+
invariant(handle, "Missing handle param");
142+
143+
const { storefront, weaverse } = context;
144+
145+
// Parallel data loading
146+
const [shopifyData, weaverseData, thirdPartyData] = await Promise.all([
147+
storefront.query(QUERY, { variables }),
148+
weaverse.loadPage({ type: "PAGE_TYPE", handle }),
149+
fetchThirdPartyData(),
150+
]);
151+
152+
// Handle errors
153+
if (!shopifyData.resource) {
154+
throw new Response("Not found", { status: 404 });
155+
}
156+
157+
return data({
158+
shopifyData,
159+
weaverseData,
160+
thirdPartyData,
161+
});
162+
}
163+
```
109164

110165
### Environment Configuration
111166

112-
The project uses environment variables for Shopify integration. Required variables are defined in `env.d.ts`.
113-
114-
### Testing Approach
115-
116-
E2E tests use Playwright and are located in `/tests/`. Tests run against `localhost:3000` and focus on critical user flows like cart operations.
167+
Required environment variables are defined in `env.d.ts`. The project uses `@shopify/hydrogen` and `@shopify/remix-oxygen` for environment handling.
117168

118-
## Coding Standards
169+
### Testing Strategy
119170

120-
- Use camelCase for variable and function names.
121-
- Use PascalCase for component names.
122-
- Use kebab-case for file names.
123-
- Use ALL_CAPS for constants
124-
- Use double quotes for strings.
125-
- Use 2 spaces for indentation.
126-
- Use arrow functions for callbacks.
127-
- Prefix private class members with underscore (\_)
128-
- Use async/await for asynchronous code.
129-
- Use const for constants only (variable named with all camel-cased letters) and prefer let for others.
130-
- Use destructuring for objects and arrays.
131-
- Use template literals for strings that contain variables.
132-
- Use the latest JavaScript features (ES6+) where possible.
171+
- E2E tests use Playwright and are located in `/tests/`
172+
- Tests run against `localhost:3456` (same as dev server)
173+
- Focus on critical user flows: cart operations, checkout process
174+
- Run individual tests: `npx playwright test tests/cart.test.ts`
133175

134-
## TypeScript Guidelines
176+
### Biome Configuration
135177

136-
- Always define types for function parameters and return values, try to avoid using `any`
137-
- Use TypeScript for all new code
138-
- Follow functional programming principles where possible
139-
- Use interfaces for data structures and type definitions
140-
- Prefer immutable data (readonly)
141-
- Use optional chaining (?.) and nullish coalescing (??) operators for safe property access
178+
The project extends from `ultracite` and `@weaverse/biome` configurations with these customizations:
179+
- Double quotes for strings
180+
- Semicolons always
181+
- Trailing commas
182+
- Max cognitive complexity: 50
183+
- Sorted Tailwind classes in `clsx`, `cva`, and `cn` functions
142184

143-
## React Guidelines
185+
## Code Conventions
144186

145-
- Use functional components with hooks
146-
- Follow the React hooks rules (no conditional hooks)
147-
- Use React.FC type for components with children
148-
- Keep components small and focused
149-
- Use CSS modules for component styling
187+
- **Naming**: camelCase for variables/functions, PascalCase for components, kebab-case for files, ALL_CAPS for constants
188+
- **Formatting**: 2 spaces indentation, double quotes, semicolons, trailing commas
189+
- **TypeScript**: Always type function parameters and returns, avoid `any`, use interfaces for data structures
190+
- **React**: Functional components with hooks only, small focused components, forwardRef for Weaverse sections
191+
- **Async**: Use async/await, proper error handling with try/catch
192+
- **Imports**: Use `~/` path alias for app directory imports
150193

151-
## Error Handling
194+
## Common Pitfalls to Avoid
152195

153-
- Use try/catch blocks for async operations
154-
- Implement proper error boundaries in React components
155-
- Always log errors with contextual information
196+
1. **GraphQL Codegen**: Always run `npm run codegen` after modifying GraphQL queries/fragments
197+
2. **Weaverse Registration**: New sections must be registered in `/app/weaverse/components.ts`
198+
3. **Route Caching**: Use `routeHeaders` export for consistent cache control
199+
4. **Customer Account Queries**: Only use in `*.account*.{ts,tsx}` files
200+
5. **Parallel Loading**: Always use `Promise.all()` for multiple data fetches in loaders
201+
6. **Type Safety**: Never use `any` type, properly type all Weaverse section props

0 commit comments

Comments
 (0)