|
1 | | -# Contributing: Adding New Exercises |
| 1 | +# Contributing |
| 2 | + |
| 3 | +## Development Setup |
| 4 | + |
| 5 | +### Prerequisites |
| 6 | + |
| 7 | +- Node.js 22 or higher |
| 8 | +- npm (included with Node.js) |
| 9 | +- Git |
| 10 | + |
| 11 | +### Getting Started |
| 12 | + |
| 13 | +1. Clone the repository: |
| 14 | + ```bash |
| 15 | + git clone https://github.com/devops-ia/self-learning-platform.git |
| 16 | + cd self-learning-platform |
| 17 | + ``` |
| 18 | + |
| 19 | +2. Install dependencies: |
| 20 | + ```bash |
| 21 | + npm install |
| 22 | + ``` |
| 23 | + |
| 24 | +3. Create and seed the database: |
| 25 | + ```bash |
| 26 | + npm run db:seed |
| 27 | + ``` |
| 28 | + |
| 29 | +4. Import exercise definitions: |
| 30 | + ```bash |
| 31 | + npm run exercises:import |
| 32 | + ``` |
| 33 | + |
| 34 | +5. Start the development server: |
| 35 | + ```bash |
| 36 | + npm run dev |
| 37 | + ``` |
| 38 | + |
| 39 | +The application will be available at http://localhost:3000 |
| 40 | + |
| 41 | +## Available Commands |
| 42 | + |
| 43 | +### npm Scripts |
| 44 | + |
| 45 | +- `npm run dev` - Start development server on localhost:3000 |
| 46 | +- `npm run build` - Production build |
| 47 | +- `npm run lint` - Run ESLint |
| 48 | +- `npm run db:seed` - Create or reset SQLite database tables |
| 49 | +- `npm run exercises:import` - Import YAML exercises into database |
| 50 | + |
| 51 | +### Makefile Targets |
| 52 | + |
| 53 | +For convenience, the project includes a Makefile with common tasks: |
| 54 | + |
| 55 | +- `make install` - Install npm dependencies |
| 56 | +- `make dev` - Start development server |
| 57 | +- `make build` - Full production build (seed + import + build) |
| 58 | +- `make lint` - Run ESLint |
| 59 | +- `make seed` - Create or reset database tables |
| 60 | +- `make import` - Import YAML exercises into database |
| 61 | +- `make test` - Run tests |
| 62 | + |
| 63 | +See `make help` for the complete list of available commands. |
| 64 | + |
| 65 | +## Coding Standards |
| 66 | + |
| 67 | +- **TypeScript**: All code must use TypeScript in strict mode |
| 68 | +- **Styling**: Use Tailwind CSS 4 for all styles. Do not use custom CSS unless absolutely necessary |
| 69 | +- **Database**: Use Drizzle ORM for all database operations |
| 70 | +- **Validation**: Use Zod schemas for input validation |
| 71 | +- **Internationalization**: Use the `useT()` hook for all UI strings. Add translations to `src/lib/i18n/locales/` |
| 72 | +- **Code formatting**: No emojis in code, comments, or commit messages |
| 73 | +- **File organization**: Follow the existing directory structure. Prefer editing existing files over creating new ones |
| 74 | + |
| 75 | +## Pull Request Workflow |
| 76 | + |
| 77 | +1. Create a new branch from `main`: |
| 78 | + ```bash |
| 79 | + git checkout -b feat/your-feature-name |
| 80 | + ``` |
| 81 | + |
| 82 | +2. Make your changes following the coding standards |
| 83 | + |
| 84 | +3. Verify your changes: |
| 85 | + ```bash |
| 86 | + npm run lint |
| 87 | + npm run build |
| 88 | + ``` |
| 89 | + |
| 90 | +4. Commit your changes using conventional commits: |
| 91 | + - `feat:` for new features |
| 92 | + - `fix:` for bug fixes |
| 93 | + - `docs:` for documentation changes |
| 94 | + - `refactor:` for code refactoring |
| 95 | + - `test:` for test additions or changes |
| 96 | + - `chore:` for maintenance tasks |
| 97 | + |
| 98 | + Example: |
| 99 | + ```bash |
| 100 | + git add . |
| 101 | + git commit -m "feat: add Ansible module support" |
| 102 | + ``` |
| 103 | + |
| 104 | +5. Push your branch and open a pull request: |
| 105 | + ```bash |
| 106 | + git push origin feat/your-feature-name |
| 107 | + ``` |
| 108 | + |
| 109 | +6. CI will run automatically to verify linting and build. Address any issues before requesting review. |
| 110 | + |
| 111 | +## Adding New Exercises |
2 | 112 |
|
3 | 113 | Exercises are stored in the database and loaded at runtime. There are two ways to add them: **YAML import** (recommended) or **admin panel**. |
4 | 114 |
|
|
0 commit comments