|
| 1 | +# Contributing to SpringUserFramework |
| 2 | + |
| 3 | +Thank you for considering contributing to SpringUserFramework! We appreciate your time and effort in improving our project. The following guidelines will help you navigate the contribution process. |
| 4 | + |
| 5 | +## Table of Contents |
| 6 | + |
| 7 | +- [Code of Conduct](#code-of-conduct) |
| 8 | +- [Getting Started](#getting-started) |
| 9 | + - [Forking the Repository](#forking-the-repository) |
| 10 | + - [Cloning Your Fork](#cloning-your-fork) |
| 11 | + - [Setting Up the Upstream Remote](#setting-up-the-upstream-remote) |
| 12 | +- [Working on Issues](#working-on-issues) |
| 13 | + - [Creating a Feature Branch](#creating-a-feature-branch) |
| 14 | + - [Making Changes](#making-changes) |
| 15 | + - [Committing Changes](#committing-changes) |
| 16 | + - [Pushing Changes](#pushing-changes) |
| 17 | +- [Submitting a Pull Request](#submitting-a-pull-request) |
| 18 | +- [Code Style and Standards](#code-style-and-standards) |
| 19 | +- [Testing](#testing) |
| 20 | +- [Documentation](#documentation) |
| 21 | +- [Community Support](#community-support) |
| 22 | + |
| 23 | +## Code of Conduct |
| 24 | + |
| 25 | +Please note that this project is released with a [Contributor Code of Conduct](CODE_OF_CONDUCT.md). By participating in this project, you agree to abide by its terms. |
| 26 | + |
| 27 | +## Getting Started |
| 28 | + |
| 29 | +### Forking the Repository |
| 30 | + |
| 31 | +To contribute to SpringUserFramework, begin by forking the repository to your GitHub account. This creates a personal copy of the project where you can make changes without affecting the original repository. |
| 32 | + |
| 33 | +1. Navigate to the [SpringUserFramework repository](https://github.com/devondragon/SpringUserFramework/). |
| 34 | +2. Click the "Fork" button in the upper right corner. |
| 35 | + |
| 36 | +### Cloning Your Fork |
| 37 | + |
| 38 | +Next, clone your fork to your local machine to start making changes. |
| 39 | + |
| 40 | +```bash |
| 41 | +git clone https://github.com/your-username/SpringUserFramework.git |
| 42 | +cd SpringUserFramework |
| 43 | +``` |
| 44 | + |
| 45 | + |
| 46 | +### Setting Up the Upstream Remote |
| 47 | + |
| 48 | +To keep your fork synchronized with the original repository, add it as an upstream remote: |
| 49 | + |
| 50 | +```bash |
| 51 | +git remote add upstream https://github.com/devondragon/SpringUserFramework.git |
| 52 | +``` |
| 53 | + |
| 54 | + |
| 55 | +This setup allows you to fetch updates from the main repository and incorporate them into your fork. |
| 56 | + |
| 57 | +## Working on Issues |
| 58 | + |
| 59 | +We use GitHub Issues to track bugs and feature requests. Before starting work, please check existing issues to avoid duplication. |
| 60 | + |
| 61 | +1. Browse the [Issues](https://github.com/devondragon/SpringUserFramework/issues) to find something you'd like to work on. |
| 62 | +2. Comment on the issue to let others know you're working on it. |
| 63 | + |
| 64 | +### Creating a Feature Branch |
| 65 | + |
| 66 | +For each issue, create a new branch in your local repository. This keeps your changes organized and makes it easier to manage multiple contributions. |
| 67 | + |
| 68 | +1. Fetch the latest changes from the upstream repository: |
| 69 | + |
| 70 | + ```bash |
| 71 | + git fetch upstream |
| 72 | + ``` |
| 73 | + |
| 74 | + |
| 75 | +2. Check out the branch associated with the issue: |
| 76 | + |
| 77 | + ```bash |
| 78 | + git checkout upstream/branch-name |
| 79 | + ``` |
| 80 | + |
| 81 | + |
| 82 | +3. Create a new branch off of the issue branch: |
| 83 | + |
| 84 | + ```bash |
| 85 | + git checkout -b your-feature-branch |
| 86 | + ``` |
| 87 | + |
| 88 | + |
| 89 | +### Making Changes |
| 90 | + |
| 91 | +Make your desired changes in your local repository. Ensure that your code adheres to the project's coding standards and includes appropriate documentation. |
| 92 | + |
| 93 | +### Committing Changes |
| 94 | + |
| 95 | +Commit your changes with clear and descriptive messages. |
| 96 | + |
| 97 | +```bash |
| 98 | +git add . |
| 99 | +git commit -m "Brief description of your changes" |
| 100 | +``` |
| 101 | + |
| 102 | + |
| 103 | +Follow the [Conventional Commits](https://www.conventionalcommits.org/) specification for commit messages. |
| 104 | + |
| 105 | +### Pushing Changes |
| 106 | + |
| 107 | +Push your feature branch to your fork on GitHub: |
| 108 | + |
| 109 | +```bash |
| 110 | +git push origin your-feature-branch |
| 111 | +``` |
| 112 | + |
| 113 | + |
| 114 | + |
| 115 | +## Unit Tests and Test Coverage |
| 116 | + |
| 117 | +All contributions to `SpringUserFramework` **must include appropriate unit tests**. This ensures that the library remains stable, reliable, and maintainable as it grows. |
| 118 | + |
| 119 | +### Requirements |
| 120 | + |
| 121 | +- **All new features** must include unit tests that thoroughly cover the new functionality. |
| 122 | +- **Bug fixes** should include tests that demonstrate the issue and confirm the fix. |
| 123 | +- If you are **modifying existing code**, you should update or expand the relevant tests to reflect those changes. |
| 124 | +- **All tests must pass** before a pull request will be considered for merging. |
| 125 | + |
| 126 | +### Running Tests Locally |
| 127 | + |
| 128 | +Before submitting a PR, run the full test suite to ensure your changes do not introduce regressions: |
| 129 | + |
| 130 | +```bash |
| 131 | +./gradlew test |
| 132 | +``` |
| 133 | + |
| 134 | +If you are using an IDE like VSCode or IntelliJ, you can also run the tests from the IDE directly. |
| 135 | + |
| 136 | +We may add code coverage reporting tools in the future to help enforce this, but for now, maintainers will review tests as part of the code review process. |
| 137 | + |
| 138 | + |
| 139 | +## Submitting a Pull Request |
| 140 | + |
| 141 | +Once your changes are pushed to your fork, submit a pull request (PR) to the original repository: |
| 142 | + |
| 143 | +1. Navigate to your fork on GitHub. |
| 144 | +2. Click the "Compare & pull request" button next to your feature branch. |
| 145 | +3. Ensure the base fork is `devondragon/SpringUserFramework` and the base branch is the issue branch you're addressing. |
| 146 | +4. Provide a clear title and description for your PR, referencing the issue number it addresses. |
| 147 | +5. Click "Create pull request." |
| 148 | + |
| 149 | +Your PR will be reviewed by the maintainers. Please be responsive to feedback and willing to make adjustments as needed. |
| 150 | + |
| 151 | + |
| 152 | +## Contributing to the Demo Frontend |
| 153 | + |
| 154 | +If your change involves a **frontend component**, or if it requires a user interface to **showcase or test the functionality** (such as login flows, authentication UIs, or session behavior), you'll also need to contribute to the companion frontend project: |
| 155 | +👉 [**SpringUserFrameworkDemoApp**](https://github.com/devondragon/SpringUserFrameworkDemoApp) |
| 156 | + |
| 157 | +This project is a lightweight web application used to **demonstrate and test** features of the `SpringUserFramework` library. |
| 158 | + |
| 159 | +### What You Need to Do |
| 160 | + |
| 161 | +1. **Fork the `SpringUserFrameworkDemoApp` repository** as well. |
| 162 | +2. Make changes or add test pages in the demo app to support or demonstrate your backend work. |
| 163 | +3. Submit a separate pull request to the `SpringUserFrameworkDemoApp` repository. |
| 164 | +4. Reference your demo app PR in your main `SpringUserFramework` pull request description, so reviewers can test your changes end-to-end. |
| 165 | + |
| 166 | +Keeping the demo app up to date with relevant examples helps others understand how to use the library and ensures that all features are properly tested in a real-world scenario. |
| 167 | + |
| 168 | + |
| 169 | + |
| 170 | +## Testing Local Changes with the Demo App |
| 171 | + |
| 172 | +Since `SpringUserFramework` is a **library**, the best way to test your changes is by using the companion project: |
| 173 | +👉 [**SpringUserFrameworkDemoApp**](https://github.com/devondragon/SpringUserFrameworkDemoApp) |
| 174 | + |
| 175 | +This demo app allows you to see how the library behaves in a real application context. |
| 176 | + |
| 177 | +### How to Test Your Changes Locally |
| 178 | + |
| 179 | +To test updates to the library before submitting a pull request, follow these steps: |
| 180 | + |
| 181 | +1. **Install Maven (if not already installed)** |
| 182 | + You'll need Maven installed locally because Gradle publishes the library into your **local Maven cache**. |
| 183 | + |
| 184 | +2. **Build and publish the library locally** |
| 185 | + In your fork of `SpringUserFramework`, run: |
| 186 | + |
| 187 | + ```bash |
| 188 | + ./gradlew publishToMavenLocal |
| 189 | + ``` |
| 190 | + |
| 191 | + This will compile the project and publish it as a `.jar` file with a `-SNAPSHOT` version into your local Maven cache (usually located at `~/.m2/repository`). |
| 192 | + |
| 193 | +3. **Update the demo app to use your local library** |
| 194 | + In your fork of [`SpringUserFrameworkDemoApp`](https://github.com/devondragon/SpringUserFrameworkDemoApp): |
| 195 | + |
| 196 | + - Open `build.gradle`. |
| 197 | + - Update the library dependency to match the `SNAPSHOT` version defined in the `gradle.properties` file from your local library project. |
| 198 | + |
| 199 | + Example: |
| 200 | + ```groovy |
| 201 | + implementation 'com.yourgroupid:spring-user-framework:1.2.3-SNAPSHOT' |
| 202 | + ``` |
| 203 | + |
| 204 | +4. **Build and run the demo app** |
| 205 | + Use your IDE or run from the command line: |
| 206 | + |
| 207 | + ```bash |
| 208 | + ./gradlew bootRun |
| 209 | + ``` |
| 210 | + |
| 211 | + The demo app should now load and use your locally built version of the library. This allows you to interactively test your changes before pushing them upstream. |
| 212 | + |
| 213 | +> 💡 Make sure not to commit any version changes to `build.gradle` or `gradle.properties` as the project maintainer is the only one to update versions. |
| 214 | +
|
| 215 | + |
| 216 | +## Code Style and Standards |
| 217 | + |
| 218 | +Please adhere to the following coding standards: |
| 219 | + |
| 220 | +- Follow the [Google Java Style Guide](https://google.github.io/styleguide/javaguide.html) for Java code. |
| 221 | +- Use meaningful variable and method names. |
| 222 | +- Write concise and clear comments where necessary. |
| 223 | + |
| 224 | +Consistent code style helps maintain readability and ease of maintenance. |
| 225 | + |
| 226 | +## Testing |
| 227 | + |
| 228 | +Ensure that your changes do not break existing tests and include new tests as appropriate. Run all tests before submitting a PR: |
| 229 | + |
| 230 | +```bash |
| 231 | +./gradlew test |
| 232 | +``` |
0 commit comments