|
| 1 | +# Flowforge Development Guide |
| 2 | + |
| 3 | +This document provides guidance for contributors looking to enhance or modify the Flowforge package. |
| 4 | + |
| 5 | +## 🏗️ Architecture Overview |
| 6 | + |
| 7 | +Flowforge follows a clean, modular architecture: |
| 8 | + |
| 9 | +### Core Components |
| 10 | + |
| 11 | +- **KanbanBoardPage**: Abstract Filament page class that serves as the foundation for boards |
| 12 | +- **KanbanBoard**: Livewire component that handles the UI and interactions |
| 13 | +- **KanbanConfig**: Immutable configuration class for board settings |
| 14 | +- **KanbanAdapterInterface**: Contract for data operations between models and the board |
| 15 | + |
| 16 | +### Adapters |
| 17 | + |
| 18 | +- **DefaultKanbanAdapter**: Standard implementation for Eloquent models |
| 19 | +- Custom adapters can be created for complex scenarios (e.g., custom fields, relationships) |
| 20 | + |
| 21 | +### Traits |
| 22 | + |
| 23 | +- **CardFormattingTrait**: Handles card display formatting |
| 24 | +- **CrudOperationsTrait**: Manages create, read, update, and delete operations |
| 25 | +- **QueryHandlingTrait**: Handles database queries and search functionality |
| 26 | + |
| 27 | +## 🧩 Directory Structure |
| 28 | + |
| 29 | +``` |
| 30 | +src/ |
| 31 | +├── Adapters/ # Data adapters for models/queries |
| 32 | +├── Commands/ # Artisan commands (MakeKanbanBoardCommand) |
| 33 | +├── Config/ # Configuration classes |
| 34 | +├── Concerns/ # Trait implementations |
| 35 | +├── Contracts/ # Interfaces (KanbanAdapterInterface) |
| 36 | +├── Enums/ # Enum classes |
| 37 | +├── Facades/ # Laravel facades |
| 38 | +├── Filament/ # Filament integration |
| 39 | +│ ├── Pages/ # KanbanBoardPage base class |
| 40 | +│ └── Resources/ # Filament resource integration |
| 41 | +├── Livewire/ # Livewire components |
| 42 | +│ └── Components/ # KanbanBoard component |
| 43 | +├── Providers/ # Service providers |
| 44 | +├── Support/ # Helper classes |
| 45 | +└── Testing/ # Testing utilities |
| 46 | +``` |
| 47 | + |
| 48 | +## 🚀 Development Environment Setup |
| 49 | + |
| 50 | +1. Clone the repository: |
| 51 | + ```bash |
| 52 | + git clone https://github.com/relaticle/flowforge.git |
| 53 | + cd flowforge |
| 54 | + ``` |
| 55 | + |
| 56 | +2. Install dependencies: |
| 57 | + ```bash |
| 58 | + composer install |
| 59 | + npm install |
| 60 | + ``` |
| 61 | + |
| 62 | +3. Set up a Laravel test application (recommended): |
| 63 | + ```bash |
| 64 | + composer create-project laravel/laravel:^11.0 flowforge-test |
| 65 | + cd flowforge-test |
| 66 | + composer require filament/filament:^3.0 |
| 67 | + ``` |
| 68 | + |
| 69 | +4. Link your local Flowforge development version: |
| 70 | + ```bash |
| 71 | + # In your flowforge-test composer.json, add: |
| 72 | + "repositories": [ |
| 73 | + { |
| 74 | + "type": "path", |
| 75 | + "url": "../flowforge" |
| 76 | + } |
| 77 | + ] |
| 78 | + ``` |
| 79 | + |
| 80 | +5. Require the local package: |
| 81 | + ```bash |
| 82 | + composer require relaticle/flowforge:@dev |
| 83 | + ``` |
| 84 | + |
| 85 | +## 🧪 Testing |
| 86 | + |
| 87 | +Run the test suite: |
| 88 | + |
| 89 | +```bash |
| 90 | +composer test |
| 91 | +``` |
| 92 | + |
| 93 | +Run specific test files: |
| 94 | + |
| 95 | +```bash |
| 96 | +composer test -- --filter=KanbanBoardTest |
| 97 | +``` |
| 98 | + |
| 99 | +## 🔄 Development Workflow |
| 100 | + |
| 101 | +1. Create a new branch for your feature or fix: |
| 102 | + ```bash |
| 103 | + git checkout -b feature/your-feature-name |
| 104 | + ``` |
| 105 | + |
| 106 | +2. Make your changes, following the coding standards (PSR-12) |
| 107 | + |
| 108 | +3. Write or update tests to cover your changes |
| 109 | + |
| 110 | +4. Run the test suite to ensure all tests pass: |
| 111 | + ```bash |
| 112 | + composer test |
| 113 | + ``` |
| 114 | + |
| 115 | +5. Submit a pull request with a clear description of your changes |
| 116 | + |
| 117 | +## 📝 Coding Standards |
| 118 | + |
| 119 | +This package follows PSR-12 coding standards. You can check your code with: |
| 120 | + |
| 121 | +```bash |
| 122 | +composer lint |
| 123 | +``` |
| 124 | + |
| 125 | +And automatically fix most issues with: |
| 126 | + |
| 127 | +```bash |
| 128 | +composer format |
| 129 | +``` |
| 130 | + |
| 131 | +## 🔧 Common Development Tasks |
| 132 | + |
| 133 | +### Adding a New Configuration Option |
| 134 | + |
| 135 | +1. Add the property to `KanbanConfig` class |
| 136 | +2. Add a setter method in the `KanbanBoardPage` class |
| 137 | +3. Update the Livewire component to use the new configuration |
| 138 | +4. Add tests for the new feature |
| 139 | +5. Document the new option in README.md |
| 140 | + |
| 141 | +### Creating a New Command |
| 142 | + |
| 143 | +1. Create a new class in `src/Commands/` directory |
| 144 | +2. Register the command in `FlowforgeServiceProvider` |
| 145 | +3. Add tests for the command |
| 146 | +4. Document the command in README.md |
| 147 | + |
| 148 | +### Modifying the Kanban UI |
| 149 | + |
| 150 | +1. Locate the appropriate Livewire component in `src/Livewire/Components/` |
| 151 | +2. Make your changes to the component class or view |
| 152 | +3. Rebuild assets if necessary |
| 153 | +4. Test your changes in a real Laravel application |
| 154 | +5. Update documentation if the change affects user experience |
| 155 | + |
| 156 | +## 📚 Documentation Guidelines |
| 157 | + |
| 158 | +When updating or adding features, please also update: |
| 159 | + |
| 160 | +1. The main README.md file with usage examples |
| 161 | +2. PHPDoc comments in relevant classes |
| 162 | +3. This DEVELOPMENT.md file if architecture changes |
| 163 | + |
| 164 | +## 🤝 Getting Help |
| 165 | + |
| 166 | +If you have questions about development: |
| 167 | + |
| 168 | +1. Open an issue on GitHub |
| 169 | +2. Check existing issues and discussions |
| 170 | +3. Refer to the Filament documentation for UI component guidelines |
| 171 | + |
| 172 | +## 📋 Release Process |
| 173 | + |
| 174 | +1. Update the version number in `composer.json` |
| 175 | +2. Update CHANGELOG.md with the changes in the new version |
| 176 | +3. Create a new release on GitHub with release notes |
| 177 | +4. Tag the release with the appropriate version number |
0 commit comments