|
| 1 | +# Contributing to Meteor Roles |
| 2 | + |
| 3 | +Any contribution to this repository is highly appreciated! |
| 4 | + |
| 5 | +## Setup development env |
| 6 | + |
| 7 | +### Clone project and create a new branch to work on |
| 8 | + |
| 9 | +First, clone this repository and create a new branch to work on. |
| 10 | +Branch names should follow the GitFlow standard and start with a descriptive prefix of their intended outcome, for example: |
| 11 | + |
| 12 | +- `feature/` for features |
| 13 | +- `fix/` for general fixes |
| 14 | + |
| 15 | +Then the name of the branch should describe the purpose of the branch and potentially reference the issue number it is solving. |
| 16 | + |
| 17 | +```shell |
| 18 | +$ git clone git@github.com:Meteor-Community-Packages/meteor-roles.git |
| 19 | +$ cd meteor-roles |
| 20 | +$ git checkout -b fix/some-issue |
| 21 | +``` |
| 22 | + |
| 23 | +### Initialize test app |
| 24 | + |
| 25 | +We use a proxy Meteor application to run our tests and handle coverage etc. |
| 26 | +This app contains several npm scripts to provide the complete toolchain that is required |
| 27 | +for your development and testing needs. |
| 28 | + |
| 29 | +The setup is very easy. Go into the `testapp` directory, install dependencies and link |
| 30 | +the package: |
| 31 | + |
| 32 | +```shell |
| 33 | +$ cd testapp |
| 34 | +$ meteor npm install |
| 35 | +$ meteor npm run setup # this is important for the tools to work! |
| 36 | +``` |
| 37 | + |
| 38 | +## Development toolchain |
| 39 | + |
| 40 | +The `testapp` comes with some builtin scripts you can utilize during your development. |
| 41 | +They will also be picked up by our CI during pull requests. |
| 42 | +Therefore, it's a good call for you, that if they pass or fail, the CI will do so, too. |
| 43 | + |
| 44 | +**Note: all tools require the npm `setup` script has been executed at least once!** |
| 45 | + |
| 46 | +### Linter |
| 47 | + |
| 48 | +We use `standard` as our linter. You can run either the linter or use it's autofix feature for |
| 49 | +the most common issues: |
| 50 | + |
| 51 | +```shell |
| 52 | +# in testapp |
| 53 | +$ meteor npm run lint # show only outputs |
| 54 | +$ meteor npm run lint:fix # with fixes + outputs |
| 55 | +``` |
| 56 | + |
| 57 | +### Tests |
| 58 | + |
| 59 | +We provide three forms of tests: once, watch, coverage |
| 60 | + |
| 61 | +#### Once |
| 62 | + |
| 63 | +Simply runs the test suite once, without coverage collection: |
| 64 | + |
| 65 | +```shell |
| 66 | +$ meteor npm run test |
| 67 | +``` |
| 68 | + |
| 69 | +#### Watch |
| 70 | + |
| 71 | +Runs the test suite in watch mode, good to use during active development, where your changes |
| 72 | +are picked up automatically to re-run the tests: |
| 73 | + |
| 74 | +```shell |
| 75 | +$ meteor npm run test:watch |
| 76 | +``` |
| 77 | + |
| 78 | +#### Coverage |
| 79 | + |
| 80 | +Runs the test suite once, including coverage report generation. |
| 81 | +Generates an html and json report output. |
| 82 | + |
| 83 | +```shell |
| 84 | +$ meteor npm run test:coverage |
| 85 | +$ meteor npm run report # summary output in console |
| 86 | +``` |
| 87 | + |
| 88 | +If you want to watch the HTML output to find (un)covered lines, open |
| 89 | +the file at `testapp/.coverage/index.html` in your browser. |
| 90 | + |
| 91 | +## Open a pull request |
| 92 | + |
| 93 | +If you open a pull request, please make sure the following requirements are met: |
| 94 | + |
| 95 | +- the `lint` script is passing |
| 96 | +- the `test` script is passing |
| 97 | +- your contribution is on point and solves one issue (not multiple) |
| 98 | +- your commit messages are descriptive and informative |
| 99 | +- complex changes are documented in the code with comments or jsDoc-compatible documentation |
| 100 | + |
| 101 | +Please understand, that there will be a review process and your contribution |
| 102 | +might require changes before being merged. This is entirely to ensure quality and is |
| 103 | +never used as a personal offense. |
0 commit comments