|
| 1 | +# Contributing |
| 2 | + |
| 3 | +## Setup |
| 4 | + |
| 5 | +You'll need macOS 14.0+, Xcode 15+, and [Git LFS](https://git-lfs.github.com/) (static libs in `Libs/` are LFS-tracked). Install [SwiftLint](https://github.com/realm/SwiftLint) and [SwiftFormat](https://github.com/nicklockwood/SwiftFormat) too. |
| 6 | + |
| 7 | +```bash |
| 8 | +git clone https://github.com/<your-username>/TablePro.git |
| 9 | +cd TablePro |
| 10 | +git lfs pull |
| 11 | +``` |
| 12 | + |
| 13 | +Build with the `-skipPackagePluginValidation` flag (needed for the SwiftLint plugin in CodeEditSourceEditor): |
| 14 | + |
| 15 | +```bash |
| 16 | +xcodebuild -project TablePro.xcodeproj -scheme TablePro -configuration Debug build -skipPackagePluginValidation |
| 17 | +``` |
| 18 | + |
| 19 | +Run tests: |
| 20 | + |
| 21 | +```bash |
| 22 | +xcodebuild -project TablePro.xcodeproj -scheme TablePro test -skipPackagePluginValidation |
| 23 | +``` |
| 24 | + |
| 25 | +## Code Style |
| 26 | + |
| 27 | +`.swiftlint.yml` and `.swiftformat` are the source of truth. The short version: |
| 28 | + |
| 29 | +- 4-space indentation, 120-char line length target |
| 30 | +- Explicit access control (`private`, `internal`, `public`) |
| 31 | +- No force unwraps or force casts. Use `guard let`, `if let`, `as?` |
| 32 | +- `String(localized:)` for user-facing strings. SwiftUI view literals auto-localize |
| 33 | +- OSLog only, no `print()` |
| 34 | + |
| 35 | +Run both before committing: |
| 36 | + |
| 37 | +```bash |
| 38 | +swiftlint lint --strict |
| 39 | +swiftformat . |
| 40 | +``` |
| 41 | + |
| 42 | +## Commits |
| 43 | + |
| 44 | +[Conventional Commits](https://www.conventionalcommits.org/), single line, no body. |
| 45 | + |
| 46 | +``` |
| 47 | +feat: add CSV export for query results |
| 48 | +fix: prevent crash on empty query result |
| 49 | +docs: update keyboard shortcuts page |
| 50 | +``` |
| 51 | + |
| 52 | +## Branch Naming |
| 53 | + |
| 54 | +Branch off `main`: |
| 55 | + |
| 56 | +- `feat/add-cassandra-support` |
| 57 | +- `fix/query-editor-crash` |
| 58 | +- `docs/update-keyboard-shortcuts` |
| 59 | + |
| 60 | +## Pull Requests |
| 61 | + |
| 62 | +One change per PR. Make sure tests pass and lint is clean. Link related issues. |
| 63 | + |
| 64 | +Before opening, check: |
| 65 | + |
| 66 | +- [ ] Tests added or updated |
| 67 | +- [ ] `CHANGELOG.md` updated under `[Unreleased]` (skip for unreleased-only fixes) |
| 68 | +- [ ] Docs updated in `docs/` and `docs/vi/` if the change affects user-facing behavior |
| 69 | +- [ ] User-facing strings localized |
| 70 | +- [ ] No SwiftLint/SwiftFormat violations |
| 71 | + |
| 72 | +## Project Layout |
| 73 | + |
| 74 | +``` |
| 75 | +TablePro/ # App source (Core/, Views/, Models/, ViewModels/, etc.) |
| 76 | +Plugins/ # Database driver .tableplugin bundles |
| 77 | + TableProPluginKit/ # Shared plugin framework |
| 78 | + MySQLDriverPlugin/ # MySQL/MariaDB |
| 79 | + PostgreSQLDriverPlugin/ |
| 80 | + SQLiteDriverPlugin/ |
| 81 | + ... |
| 82 | +Libs/ # Pre-built static libraries (Git LFS) |
| 83 | +TableProTests/ # Tests |
| 84 | +docs/ # Mintlify docs site |
| 85 | +scripts/ # Build and release scripts |
| 86 | +``` |
| 87 | + |
| 88 | +## Adding a Database Driver |
| 89 | + |
| 90 | +Drivers are `.tableplugin` bundles loaded at runtime. Create a new bundle under `Plugins/`, implement `DriverPlugin` + `PluginDatabaseDriver` from `TableProPluginKit`, and add the target to the Xcode project. Details in `docs/development/plugin-system/`. |
| 91 | + |
| 92 | +## Reporting Bugs |
| 93 | + |
| 94 | +Open a [GitHub issue](https://github.com/datlechin/TablePro/issues) with your macOS version, TablePro version, and reproduction steps. For database-specific bugs, include the database type and version. |
| 95 | + |
| 96 | +## CLA |
| 97 | + |
| 98 | +You'll need to sign the Contributor License Agreement on your first PR. The CLA bot will walk you through it. One-time thing. |
| 99 | + |
| 100 | +## License |
| 101 | + |
| 102 | +Contributions are licensed under [AGPLv3](LICENSE). |
0 commit comments