|
| 1 | +# Contributing to Design Tokens Format Module |
| 2 | + |
| 3 | +Thank you for your interest in contributing to the Design Tokens Format Module! This document provides guidelines and instructions to help you get started. |
| 4 | + |
| 5 | +## Getting Started |
| 6 | + |
| 7 | +### Prerequisites |
| 8 | + |
| 9 | +- Node.js (preferably the latest LTS version) |
| 10 | +- npm |
| 11 | + |
| 12 | +### Setup |
| 13 | + |
| 14 | +1. Fork the repository on GitHub |
| 15 | +2. Clone your fork locally |
| 16 | + ```bash |
| 17 | + git clone https://github.com/YOUR-USERNAME/design-tokens-format-module.git |
| 18 | + cd design-tokens-format-module |
| 19 | + ``` |
| 20 | +3. Add the original repository as an upstream remote |
| 21 | + ```bash |
| 22 | + git remote add upstream https://github.com/nclsndr/design-tokens-format-module.git |
| 23 | + ``` |
| 24 | +4. Install dependencies |
| 25 | + ```bash |
| 26 | + npm install |
| 27 | + ``` |
| 28 | + |
| 29 | +## Development Workflow |
| 30 | + |
| 31 | +1. Create a new branch for your feature or bugfix |
| 32 | + ```bash |
| 33 | + git checkout -b feature/your-feature-name |
| 34 | + ``` |
| 35 | + or |
| 36 | + ```bash |
| 37 | + git checkout -b fix/issue-you-are-fixing |
| 38 | + ``` |
| 39 | + |
| 40 | +2. Make your changes and commit them using [Conventional Commits](https://www.conventionalcommits.org/en/v1.0.0/) |
| 41 | + |
| 42 | + We follow the Conventional Commits specification which provides a standardized format for commit messages: |
| 43 | + ``` |
| 44 | + <type>([optional scope]): <description> |
| 45 | + |
| 46 | + [optional body] |
| 47 | + |
| 48 | + [optional footer(s)] |
| 49 | + ``` |
| 50 | + |
| 51 | + Common types include: |
| 52 | + - `feat`: A new feature |
| 53 | + - `fix`: A bug fix |
| 54 | + - `docs`: Documentation changes |
| 55 | + - `style`: Changes that don't affect the code's meaning (formatting, etc.) |
| 56 | + - `refactor`: Code changes that neither fix a bug nor add a feature |
| 57 | + - `test`: Adding or correcting tests |
| 58 | + - `chore`: Changes to the build process or auxiliary tools |
| 59 | + |
| 60 | +3. Keep your branch updated with the upstream main branch |
| 61 | + ```bash |
| 62 | + git pull upstream main |
| 63 | + ``` |
| 64 | + |
| 65 | +## Code Style and Formatting |
| 66 | + |
| 67 | +This project uses Prettier for code formatting. The configuration is defined in `.prettierrc.json`. |
| 68 | + |
| 69 | +### Formatting Your Code |
| 70 | + |
| 71 | +Before submitting a pull request, make sure your code is properly formatted: |
| 72 | + |
| 73 | +```bash |
| 74 | +# Format all files |
| 75 | +npm run format |
| 76 | + |
| 77 | +# Check formatting without modifying files |
| 78 | +npx prettier --check . |
| 79 | +``` |
| 80 | + |
| 81 | +## Testing |
| 82 | + |
| 83 | +The project uses Vitest for testing. Make sure to add tests for any new features or bug fixes. |
| 84 | + |
| 85 | +### Running Tests |
| 86 | + |
| 87 | +```bash |
| 88 | +# Run tests in watch mode during development |
| 89 | +npm run test |
| 90 | + |
| 91 | +# Run tests once (e.g., before submitting a PR) |
| 92 | +npm run test -- --run |
| 93 | +``` |
| 94 | + |
| 95 | +### Test Coverage |
| 96 | + |
| 97 | +To generate a test coverage report: |
| 98 | + |
| 99 | +```bash |
| 100 | +npm run test -- --coverage |
| 101 | +``` |
| 102 | + |
| 103 | +## Building |
| 104 | + |
| 105 | +The project uses TypeScript for type safety and transpilation. |
| 106 | + |
| 107 | +### Building the Project |
| 108 | + |
| 109 | +```bash |
| 110 | +npm run build |
| 111 | +``` |
| 112 | + |
| 113 | +This command cleans the `dist` directory and rebuilds the project according to the TypeScript configuration. |
| 114 | + |
| 115 | +### Type Checking |
| 116 | + |
| 117 | +To run the TypeScript compiler without emitting files (useful for checking types): |
| 118 | + |
| 119 | +```bash |
| 120 | +npm run tsc |
| 121 | +``` |
| 122 | + |
| 123 | +## Pull Requests |
| 124 | + |
| 125 | +1. Push your changes to your fork |
| 126 | + ```bash |
| 127 | + git push origin your-branch-name |
| 128 | + ``` |
| 129 | + |
| 130 | +2. Open a pull request against the main repository's `main` branch |
| 131 | + |
| 132 | +3. Ensure your PR includes: |
| 133 | + - A clear description of the changes |
| 134 | + - Any relevant issue numbers (use "#123" to link to issue 123) |
| 135 | + - Updated or new tests covering your changes |
| 136 | + - Documentation updates if needed |
| 137 | + |
| 138 | +4. Before opening a PR, make sure: |
| 139 | + - Tests pass: `npm run test -- --run` |
| 140 | + - The build succeeds: `npm run build` |
| 141 | + - Code is properly formatted: `npm run format` |
| 142 | + |
| 143 | +## Code of Conduct |
| 144 | + |
| 145 | +Please be respectful and considerate of others when contributing to this project. We strive to maintain a welcoming and inclusive environment for everyone. |
| 146 | + |
| 147 | +## Questions? |
| 148 | + |
| 149 | +If you have any questions or need help, feel free to open an issue or reach out to @nclsndr. |
| 150 | + |
| 151 | +Thank you for contributing to the Design Tokens Format Module! |
0 commit comments