|
| 1 | +# Contributing to Metis Admin Template |
| 2 | + |
| 3 | +Thank you for your interest in contributing to the Metis Admin Template! This document provides guidelines and instructions for contributing. |
| 4 | + |
| 5 | +## Table of Contents |
| 6 | + |
| 7 | +- [Code of Conduct](#code-of-conduct) |
| 8 | +- [Getting Started](#getting-started) |
| 9 | +- [Development Setup](#development-setup) |
| 10 | +- [Making Changes](#making-changes) |
| 11 | +- [Submitting Changes](#submitting-changes) |
| 12 | +- [Style Guidelines](#style-guidelines) |
| 13 | +- [Reporting Issues](#reporting-issues) |
| 14 | + |
| 15 | +--- |
| 16 | + |
| 17 | +## Code of Conduct |
| 18 | + |
| 19 | +By participating in this project, you agree to maintain a respectful and inclusive environment. Please: |
| 20 | + |
| 21 | +- Be respectful and considerate in all interactions |
| 22 | +- Welcome newcomers and help them get started |
| 23 | +- Focus on constructive feedback |
| 24 | +- Accept differing viewpoints gracefully |
| 25 | + |
| 26 | +--- |
| 27 | + |
| 28 | +## Getting Started |
| 29 | + |
| 30 | +### Prerequisites |
| 31 | + |
| 32 | +- **Node.js 18+** - [Download](https://nodejs.org/) |
| 33 | +- **Git** - [Download](https://git-scm.com/) |
| 34 | +- **Code editor** - We recommend [VS Code](https://code.visualstudio.com/) |
| 35 | + |
| 36 | +### Fork and Clone |
| 37 | + |
| 38 | +1. **Fork** the repository on GitHub |
| 39 | +2. **Clone** your fork locally: |
| 40 | + |
| 41 | +```bash |
| 42 | +git clone https://github.com/YOUR_USERNAME/Bootstrap-Admin-Template-3.git |
| 43 | +cd Bootstrap-Admin-Template-3 |
| 44 | +``` |
| 45 | + |
| 46 | +3. **Add upstream remote**: |
| 47 | + |
| 48 | +```bash |
| 49 | +git remote add upstream https://github.com/puikinsh/Bootstrap-Admin-Template-3.git |
| 50 | +``` |
| 51 | + |
| 52 | +--- |
| 53 | + |
| 54 | +## Development Setup |
| 55 | + |
| 56 | +### Install Dependencies |
| 57 | + |
| 58 | +```bash |
| 59 | +npm install |
| 60 | +``` |
| 61 | + |
| 62 | +### Start Development Server |
| 63 | + |
| 64 | +```bash |
| 65 | +npm run dev |
| 66 | +``` |
| 67 | + |
| 68 | +The development server will start at `http://localhost:3000` with hot module replacement enabled. |
| 69 | + |
| 70 | +### Useful Commands |
| 71 | + |
| 72 | +```bash |
| 73 | +npm run dev # Start dev server |
| 74 | +npm run build # Build for production |
| 75 | +npm run preview # Preview production build |
| 76 | +npm run lint # Check for linting errors |
| 77 | +npm run lint:fix # Auto-fix linting errors |
| 78 | +npm run format # Format code with Prettier |
| 79 | +npm run format:check # Check code formatting |
| 80 | +npm run check # Run lint + format check |
| 81 | +``` |
| 82 | + |
| 83 | +--- |
| 84 | + |
| 85 | +## Making Changes |
| 86 | + |
| 87 | +### Branch Naming |
| 88 | + |
| 89 | +Create a descriptive branch name: |
| 90 | + |
| 91 | +```bash |
| 92 | +# Features |
| 93 | +git checkout -b feature/add-dark-mode-toggle |
| 94 | + |
| 95 | +# Bug fixes |
| 96 | +git checkout -b fix/sidebar-collapse-issue |
| 97 | + |
| 98 | +# Documentation |
| 99 | +git checkout -b docs/update-readme |
| 100 | + |
| 101 | +# Refactoring |
| 102 | +git checkout -b refactor/improve-chart-performance |
| 103 | +``` |
| 104 | + |
| 105 | +### Commit Messages |
| 106 | + |
| 107 | +Follow conventional commit format: |
| 108 | + |
| 109 | +``` |
| 110 | +type(scope): description |
| 111 | +
|
| 112 | +[optional body] |
| 113 | +
|
| 114 | +[optional footer] |
| 115 | +``` |
| 116 | + |
| 117 | +**Types:** |
| 118 | +- `feat` - New feature |
| 119 | +- `fix` - Bug fix |
| 120 | +- `docs` - Documentation changes |
| 121 | +- `style` - Code style changes (formatting, etc.) |
| 122 | +- `refactor` - Code refactoring |
| 123 | +- `perf` - Performance improvements |
| 124 | +- `test` - Adding or updating tests |
| 125 | +- `chore` - Maintenance tasks |
| 126 | + |
| 127 | +**Examples:** |
| 128 | + |
| 129 | +```bash |
| 130 | +feat(sidebar): add collapsible menu sections |
| 131 | + |
| 132 | +fix(charts): resolve memory leak on page navigation |
| 133 | + |
| 134 | +docs(readme): update installation instructions |
| 135 | + |
| 136 | +style(forms): improve input field spacing |
| 137 | +``` |
| 138 | + |
| 139 | +### Keep Commits Atomic |
| 140 | + |
| 141 | +- Each commit should represent a single logical change |
| 142 | +- Avoid mixing unrelated changes in one commit |
| 143 | +- Keep commits small and focused |
| 144 | + |
| 145 | +--- |
| 146 | + |
| 147 | +## Submitting Changes |
| 148 | + |
| 149 | +### Before Submitting |
| 150 | + |
| 151 | +1. **Sync with upstream**: |
| 152 | + |
| 153 | +```bash |
| 154 | +git fetch upstream |
| 155 | +git rebase upstream/main |
| 156 | +``` |
| 157 | + |
| 158 | +2. **Run checks**: |
| 159 | + |
| 160 | +```bash |
| 161 | +npm run check |
| 162 | +npm run build |
| 163 | +``` |
| 164 | + |
| 165 | +3. **Test your changes**: |
| 166 | + - Test in multiple browsers (Chrome, Firefox, Safari) |
| 167 | + - Test responsive layouts |
| 168 | + - Test dark/light mode |
| 169 | + |
| 170 | +### Pull Request Process |
| 171 | + |
| 172 | +1. **Push your branch**: |
| 173 | + |
| 174 | +```bash |
| 175 | +git push origin feature/your-feature-name |
| 176 | +``` |
| 177 | + |
| 178 | +2. **Create Pull Request** on GitHub |
| 179 | + |
| 180 | +3. **Fill out the PR template**: |
| 181 | + - Describe what changes you made |
| 182 | + - Reference any related issues |
| 183 | + - Include screenshots for UI changes |
| 184 | + |
| 185 | +4. **Address review feedback** if requested |
| 186 | + |
| 187 | +### PR Title Format |
| 188 | + |
| 189 | +``` |
| 190 | +type(scope): description |
| 191 | +``` |
| 192 | + |
| 193 | +Examples: |
| 194 | +- `feat(dashboard): add real-time notifications` |
| 195 | +- `fix(forms): resolve validation error display` |
| 196 | +- `docs: add deployment guide` |
| 197 | + |
| 198 | +--- |
| 199 | + |
| 200 | +## Style Guidelines |
| 201 | + |
| 202 | +### JavaScript |
| 203 | + |
| 204 | +- Use ES6+ features (arrow functions, destructuring, etc.) |
| 205 | +- Use meaningful variable and function names |
| 206 | +- Keep functions small and focused |
| 207 | +- Add comments for complex logic |
| 208 | + |
| 209 | +```javascript |
| 210 | +// Good |
| 211 | +const calculateTotal = (items) => { |
| 212 | + return items.reduce((sum, item) => sum + item.price, 0); |
| 213 | +}; |
| 214 | + |
| 215 | +// Avoid |
| 216 | +const calc = (i) => i.reduce((s, x) => s + x.p, 0); |
| 217 | +``` |
| 218 | + |
| 219 | +### SCSS |
| 220 | + |
| 221 | +- Follow BEM naming convention |
| 222 | +- Use variables for colors, spacing, etc. |
| 223 | +- Keep selectors specific but not overly nested |
| 224 | + |
| 225 | +```scss |
| 226 | +// Good |
| 227 | +.card { |
| 228 | + &__header { |
| 229 | + padding: $spacer; |
| 230 | + } |
| 231 | + |
| 232 | + &__title { |
| 233 | + font-weight: $font-weight-semibold; |
| 234 | + } |
| 235 | + |
| 236 | + &--primary { |
| 237 | + border-color: $primary; |
| 238 | + } |
| 239 | +} |
| 240 | + |
| 241 | +// Avoid deep nesting |
| 242 | +.card { |
| 243 | + .header { |
| 244 | + .title { |
| 245 | + .text { |
| 246 | + // Too deep! |
| 247 | + } |
| 248 | + } |
| 249 | + } |
| 250 | +} |
| 251 | +``` |
| 252 | + |
| 253 | +### HTML |
| 254 | + |
| 255 | +- Use semantic HTML elements |
| 256 | +- Include ARIA labels for accessibility |
| 257 | +- Keep indentation consistent (2 spaces) |
| 258 | + |
| 259 | +```html |
| 260 | +<!-- Good --> |
| 261 | +<nav aria-label="Main navigation"> |
| 262 | + <ul class="nav-list"> |
| 263 | + <li class="nav-item"> |
| 264 | + <a href="#" class="nav-link">Home</a> |
| 265 | + </li> |
| 266 | + </ul> |
| 267 | +</nav> |
| 268 | + |
| 269 | +<!-- Avoid --> |
| 270 | +<div onclick="navigate()"> |
| 271 | + <div> |
| 272 | + <div>Home</div> |
| 273 | + </div> |
| 274 | +</div> |
| 275 | +``` |
| 276 | + |
| 277 | +### Alpine.js Components |
| 278 | + |
| 279 | +- Keep components focused and reusable |
| 280 | +- Use descriptive data property names |
| 281 | +- Document complex logic |
| 282 | + |
| 283 | +```javascript |
| 284 | +Alpine.data('searchComponent', () => ({ |
| 285 | + query: '', |
| 286 | + results: [], |
| 287 | + isLoading: false, |
| 288 | + |
| 289 | + async search() { |
| 290 | + if (!this.query.trim()) return; |
| 291 | + |
| 292 | + this.isLoading = true; |
| 293 | + try { |
| 294 | + this.results = await this.fetchResults(this.query); |
| 295 | + } finally { |
| 296 | + this.isLoading = false; |
| 297 | + } |
| 298 | + }, |
| 299 | + |
| 300 | + async fetchResults(query) { |
| 301 | + // Implementation |
| 302 | + } |
| 303 | +})); |
| 304 | +``` |
| 305 | + |
| 306 | +--- |
| 307 | + |
| 308 | +## Reporting Issues |
| 309 | + |
| 310 | +### Before Reporting |
| 311 | + |
| 312 | +1. Search existing issues to avoid duplicates |
| 313 | +2. Try the latest version to see if it's already fixed |
| 314 | +3. Gather relevant information |
| 315 | + |
| 316 | +### Issue Template |
| 317 | + |
| 318 | +**Bug Report:** |
| 319 | + |
| 320 | +```markdown |
| 321 | +## Description |
| 322 | +A clear description of the bug. |
| 323 | + |
| 324 | +## Steps to Reproduce |
| 325 | +1. Go to '...' |
| 326 | +2. Click on '...' |
| 327 | +3. See error |
| 328 | + |
| 329 | +## Expected Behavior |
| 330 | +What should happen. |
| 331 | + |
| 332 | +## Actual Behavior |
| 333 | +What actually happens. |
| 334 | + |
| 335 | +## Environment |
| 336 | +- Browser: Chrome 120 |
| 337 | +- OS: macOS 14 |
| 338 | +- Node.js: 20.10.0 |
| 339 | + |
| 340 | +## Screenshots |
| 341 | +If applicable, add screenshots. |
| 342 | +``` |
| 343 | + |
| 344 | +**Feature Request:** |
| 345 | + |
| 346 | +```markdown |
| 347 | +## Description |
| 348 | +A clear description of the feature. |
| 349 | + |
| 350 | +## Use Case |
| 351 | +Why this feature would be useful. |
| 352 | + |
| 353 | +## Proposed Solution |
| 354 | +How you think it could be implemented. |
| 355 | + |
| 356 | +## Alternatives Considered |
| 357 | +Other approaches you've considered. |
| 358 | +``` |
| 359 | + |
| 360 | +--- |
| 361 | + |
| 362 | +## Questions? |
| 363 | + |
| 364 | +If you have questions about contributing: |
| 365 | + |
| 366 | +1. Check existing [GitHub Discussions](https://github.com/puikinsh/Bootstrap-Admin-Template-3/discussions) |
| 367 | +2. Open a new discussion for general questions |
| 368 | +3. Open an issue for bugs or feature requests |
| 369 | + |
| 370 | +--- |
| 371 | + |
| 372 | +Thank you for contributing to Metis Admin Template! |
0 commit comments