Files
v10/CLAUDE.md
T
2025-10-30 03:46:01 +00:00

131 lines
4.3 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# CLAUDE.md
Guidance for **Claude Code** (claude.ai/code) and other AI agents working with this repository.
## Overview
**Video.js 10** is a **Turborepomanaged monorepo**, organized by runtime and platform.
Refer to **[`CONTRIBUTING.md`](./CONTRIBUTING.md)** for setup, development, and lint/test instructions.
## Package Layout
| Package Path | Purpose |
| ----------------------- | ---------------------------------------------------- |
| `packages/core` | Core runtimeagnostic logic and state. |
| `packages/html` | DOM/Browserspecific implementations. |
| `packages/react` | React package—adapts core state to React components. |
| `packages/react-native` | React Native integration layer. |
| `packages/utils` | Shared utilities. |
| `examples/*` | Demo apps for various runtimes. |
| `site/` | Astrobased docs and website. |
### Dependency Hierarchy
- Core → (no internal deps)
- HTML / React / ReactNative → depend only on Core
- Prevents circular dependencies and maximizes reusability.
## Workspace
Uses **PNPM workspaces** + **Turbo** for task orchestration.
Internal deps are linked with `workspace:*`.
### Common Root Commands
```bash
pnpm install # Install workspace deps
pnpm build # Build all packages/apps
pnpm build:packages # Build library packages (no app)
pnpm dev # Run all demos/sites in parallel
pnpm test # Run tests across all packages
pnpm lint # Lint all workspace packages
pnpm clean # Remove all dist outputs
```
To build or test a specific package:
```bash
pnpm -F core build
pnpm -F react test
```
## TypeScript
- Uses **project references** for incremental builds.
- Strict mode enabled (`noUncheckedIndexedAccess`, `exactOptionalPropertyTypes`).
- Common base config: `tsconfig.base.json`.
- `@videojs/*` path mappings resolve to each packages `src` directory.
## Git & Commits
Follow **Conventional Commits** for automation compatibility:
```bash
<type>(<scope>): <description>
```
Examples:
- `chore(root): update typescript to 5.9.2`
- `feat(core): add pause state management`
- `fix(html): correct fullscreen API handling`
Breaking changes use `!`:
```
feat(core)!: remove deprecated playback API
```
## Guidelines
When generating or editing code in this repository, follow these rules to ensure safe, highquality contributions:
1. **Edit Precisely**
- Modify only the relevant lines or files.
- Never overwrite large sections or regenerate entire files.
- Preserve comments, type signatures, and existing code style.
2. **Match Existing Conventions**
- Follow the repos Prettier, ESLint, and TypeScript settings automatically.
- Use consistent naming (camelCase for variables, PascalCase for components).
- Prefer imports ordered and sorted as per `@antfu/eslint-config`.
3. **Type Safety First**
- Never remove or bypass TypeScript types.
- Avoid `any`; use `unknown` and proper narrowing if needed.
- Always ensure edits pass `pnpm typecheck`.
4. **FrameworkAgnostic Mindset**
- Core modules must remain DOM and frameworkindependent.
- Place platformspecific logic in the appropriate adapter (HTML, React, RN).
5. **A11y, Styling & Performance**
- Maintain accessibility: ARIA roles, keyboard interactions, focus management.
- Use dataattributes and CSS variables for style hooks—no inline animation JS.
- Ensure logic runs at 60 FPS; prefer CSS transitions over manual DOM mutations.
6. **Testing Discipline**
- Write or update matching tests for each new or modified behavior.
- Follow the pattern: `act → assert`.
- Use Vitest and Testing Library idioms.
7. **Commit Scope**
- Use semantic commit messages (enforced by `commitlint`).
- One focused change per commit—no mixed updates.
8. **Before You Push**
```bash
pnpm lint
pnpm test
pnpm typecheck
pnpm build:packages
```
All must pass cleanly before creating a PR.
## Notes
- The Astrobased docs site is standalone but integrated via Turborepo pipelines.
- For contribution, testing, and PR flow details, see [`CONTRIBUTING.md`](./CONTRIBUTING.md).