# Contributing to TresJS Thank you for your interest in contributing to TresJS! We welcome contributions from everyone. This guide will help you get started with contributing to our NX monorepo. ## πŸ“¦ Monorepo Structure This monorepo contains the following packages and apps: ### Packages - **[@tresjs/core](./packages/core)** - Core Vue custom renderer for Three.js - **[@tresjs/cientos](./packages/cientos)** - Collection of helpers and abstractions - **[@tresjs/post-processing](./packages/postprocessing)** - Post-processing effects library - **[@tresjs/leches](./packages/leches)** - Tasty GUI for Vue controls - **[@tresjs/nuxt](./packages/nuxt)** - Nuxt module integration - **[@tresjs/eslint-config](./packages/eslint-config)** - Shared ESLint configuration ### Apps - **[docs](./apps/docs)** - Main documentation site (Nuxt + Nuxt UI Pro) - **[Vue playground](./apps/playground)** - Development testing sandbox for Vue - **[Nuxt playground](./apps/playgroud-nuxt)** - Development testing sandbox for Nuxt - **[lab](./apps/lab)** - Experimental features and testing environment ## πŸš€ Getting Started ### Prerequisites - [Node.js](https://nodejs.org/) v24 (or what is written in .nmvrc) - [pnpm](https://pnpm.io/) v8 or higher (we use pnpm workspaces) - [NX](https://nx.dev/) is included as a dev dependency (no global install needed) - Git ### Development Setup 1. Fork and clone the repository: ```bash git clone https://github.com//tres.git cd tres ``` 2. Install dependencies: ```bash pnpm install ``` 3. Build all packages: ```bash pnpm build ``` 4. Start development mode for a specific package: ```bash # For core package (runs playground) pnpm --filter playground dev # For cientos package pnpm --filter @tresjs/cientos dev ``` ## πŸ—οΈ Monorepo Workflow This project uses **NX** for intelligent build caching and affected package detection. For more advanced NX usage, we recommend exploring: - [NX Documentation](https://nx.dev/docs) - [NX Cache](https://nx.dev/concepts/how-caching-works) - [NX Affected](https://nx.dev/concepts/affected) - [NX Project Configuration](https://nx.dev/concepts/project-configuration) ### Repository Administration For repository administrators, we provide the `monocubo` tool to help manage the monorepo. This tool assists with: - Package migration - Dependency management - Repository maintenance - Release coordination See the [monocubo package](tools/monocubo) for detailed documentation and usage instructions. ### Building Packages ```bash # Build all packages pnpm build # Build specific package pnpm build @tresjs/core # Build only affected packages pnpm nx affected --target=build ``` ### Running Tests ```bash # Run all tests pnpm test # Test specific package pnpm --filter @tresjs/core test pnpm --filter @tresjs/core test:ui # with UI and coverage # Test only affected packages pnpm nx affected --target=test ``` ### Code Quality ```bash # Lint all files pnpm lint # Auto-fix lint issues pnpm lint:fix # Format all packages pnpm format # Type check all packages pnpm typecheck ``` ## πŸ“ Commit Convention We follow the [Conventional Commits](https://www.conventionalcommits.org/) specification. This enables automatic version bumping and changelog generation. ### Commit Message Format ``` (): [optional body] [optional footer] ``` ### Types - `feat`: A new feature - `fix`: A bug fix - `docs`: Documentation changes - `style`: Code style changes (formatting, missing semicolons, etc.) - `refactor`: Code changes that neither fix a bug nor add a feature - `perf`: Performance improvements - `test`: Adding or updating tests - `chore`: Changes to build process, dependencies, or tooling ### Scope The scope should be the package or app name: **Packages:** - `core` - `cientos` - `postprocessing` - `leches` - `nuxt` - `eslint-config` **Apps:** - `docs` - `playground` - `lab` ### Examples ```bash feat(core): add useRaycaster composable fix(cientos): correct OrbitControls damping behavior docs(core): update useTresContext documentation chore(nuxt): upgrade dependencies ``` ### Breaking Changes For breaking changes, add `!` after the type/scope or add `BREAKING CHANGE:` in the footer: ```bash feat(core)!: change camera management API BREAKING CHANGE: useCameraManager now requires sizes parameter ``` ## 🎨 Code Style Guidelines ### TypeScript - **Always use TypeScript** for all code - **Avoid using `any`** - find a good type if possible - Use `type` for unions, `interface` for object shapes - Document public APIs with JSDoc comments ### Vue Components - Use `