|
| 1 | +# Contribution Guidelines |
| 2 | + |
| 3 | +**Note:** If these contribution guidelines are not followed your issue or PR might be closed, so |
| 4 | +please read these instructions carefully. |
| 5 | + |
| 6 | +## Contribution types |
| 7 | + |
| 8 | +### Bug Reports |
| 9 | + - If you find a bug, please first report it using [Github issues]. |
| 10 | + - First check if there is not already an issue for it; duplicated issues will be closed. |
| 11 | + |
| 12 | +### Bug Fix |
| 13 | + - If you'd like to submit a fix for a bug, please read the [How To](#how-to-contribute) for how to |
| 14 | + send a Pull Request. |
| 15 | + - Indicate on the open issue that you are working on fixing the bug and the issue will be assigned |
| 16 | + to you. |
| 17 | + - Write `Fixes #xxxx` in your PR text, where xxxx is the issue number (if there is one). |
| 18 | + - Include a test that isolates the bug and verifies that it was fixed. |
| 19 | + |
| 20 | +### New Features |
| 21 | + - If you'd like to add a feature to the library that doesn't already exist, feel free to describe |
| 22 | + the feature in a new [GitHub issue]. |
| 23 | + - You can also join us on [Discord] to discuss some initials |
| 24 | + thoughts. |
| 25 | + - If you'd like to implement the new feature, please wait for feedback from the project maintainers |
| 26 | + before spending too much time writing the code. In some cases, enhancements may not align well |
| 27 | + with the project objectives at the time. |
| 28 | + - Implement the code for the new feature and please read the [How To](#how-to-contribute). |
| 29 | + |
| 30 | +### Documentation & Miscellaneous |
| 31 | + - If you have suggestions for improvements to the documentation, tutorial or examples (or something |
| 32 | + else), we would love to hear about it. |
| 33 | + - As always first file a [Github issue]. |
| 34 | + - Implement the changes to the documentation, please read the [How To](#how-to-contribute). |
| 35 | + |
| 36 | +## How To Contribute |
| 37 | + |
| 38 | +### Requirements |
| 39 | +For a contribution to be accepted: |
| 40 | + |
| 41 | +- Documentation should always be updated or added.* |
| 42 | +- Examples should always be updated or added.* |
| 43 | +- Tests should always be updated or added.* |
| 44 | +- Format the Dart code accordingly with `flutter format`. |
| 45 | +- Your code should pass the analyzer checks `melos run analyze`. |
| 46 | +- Your code should pass all tests `melos run test`. |
| 47 | +- Start your PR title with a [conventional commit] type |
| 48 | + (`feat:`, `fix:` etc). |
| 49 | + |
| 50 | +*When applicable. |
| 51 | + |
| 52 | +If the contribution doesn't meet these criteria, a maintainer will discuss it with you on the issue |
| 53 | +or PR. You can still continue to add more commits to the branch you have sent the Pull Request from |
| 54 | +and it will be automatically reflected in the PR. |
| 55 | + |
| 56 | +## Open an issue and fork the repository |
| 57 | + - If it is a bigger change or a new feature, first of all |
| 58 | + [file a bug or feature report][GitHub issues], so that we can discuss what direction to follow. |
| 59 | + - [Fork the project][fork guide] on GitHub. |
| 60 | + - Clone the forked repository to your local development machine |
| 61 | + (e.g. `git clone [email protected]:<YOUR_GITHUB_USER>/modular.git`). |
| 62 | + |
| 63 | +### Environment Setup |
| 64 | +Modular uses [Melos] to manage the project and dependencies. |
| 65 | + |
| 66 | +To install Melos, run the following command from your terminal: |
| 67 | + |
| 68 | +```bash |
| 69 | +flutter pub global activate melos |
| 70 | +``` |
| 71 | + |
| 72 | +Next, at the root of your locally cloned repository bootstrap the projects dependencies: |
| 73 | + |
| 74 | +```bash |
| 75 | +melos bootstrap |
| 76 | +``` |
| 77 | + |
| 78 | +The bootstrap command locally links all dependencies within the project without having to |
| 79 | +provide manual [`dependency_overrides`][pubspec doc]. This allows all |
| 80 | +plugins, examples and tests to build from the local clone project. You should only need to run this |
| 81 | +command once. |
| 82 | + |
| 83 | +> You do not need to run `flutter pub get` once bootstrap has been completed. |
| 84 | +
|
| 85 | +### Performing changes |
| 86 | + - Create a new local branch from `main` (e.g. `git checkout -b my-new-feature`) |
| 87 | + - Make your changes. |
| 88 | + - When committing your changes, make sure that each commit message is clear |
| 89 | + (e.g. `git commit -m '[modular_interface] Added BindContract.onDispose.'`). |
| 90 | + - Push your new branch to your own fork into the same remote branch |
| 91 | + (e.g. `git push origin my-username.my-new-feature`, replace `origin` if you use another remote.) |
| 92 | + |
| 93 | +### Open a pull request |
| 94 | +Go to the [pull request page of modular][PRs] and in the top |
| 95 | +of the page it will ask you if you want to open a pull request from your newly created branch. |
| 96 | + |
| 97 | +The title of the pull request should start with a [conventional commit] type. |
| 98 | + |
| 99 | +Examples of such types: |
| 100 | + - `fix:` - patches a bug and is not a new feature. |
| 101 | + - `feat:` - introduces a new feature. |
| 102 | + - `docs:` - updates or adds documentation or examples. |
| 103 | + - `test:` - updates or adds tests. |
| 104 | + - `refactor:` - refactors code but doesn't introduce any changes or additions to the public API. |
| 105 | + |
| 106 | +If you introduce a **breaking change** the conventional commit type MUST end with an exclamation |
| 107 | +mark (e.g. `feat!: The Bind.onDispose property for calls to destroy, close or dispose methods.`). |
| 108 | + |
| 109 | +Examples of PR titles: |
| 110 | + - feat!: New auto-dispose configuration. |
| 111 | + - feat: Added Modular.setArguments. |
| 112 | + - docs: Add Contribution Guidelines. |
| 113 | + - test: Add Export bind test. |
| 114 | + - chore: Removed triple dependency. |
| 115 | + - refactor: Now the main constructor of Bind is @Protected. |
| 116 | + |
| 117 | +[GitHub issue]: https://github.com/Flutterando/modular/issues/new |
| 118 | +[GitHub issues]: https://github.com/Flutterando/modular/issues/new |
| 119 | +[PRs]: https://github.com/Flutterando/modular/pulls |
| 120 | +[fork guide]: https://guides.github.com/activities/forking/#fork |
| 121 | +[Discord]: https://discord.gg/7qvSXRMMYw |
| 122 | +[Melos]: https://github.com/invertase/melos |
| 123 | +[pubspec doc]: https://dart.dev/tools/pub/pubspec |
| 124 | +[conventional commit]: https://www.conventionalcommits.org |
0 commit comments