|
| 1 | +# Vue.js Contributing Guide |
| 2 | + |
| 3 | +Hi! I’m really excited that you are interested in contributing to Vue.js. Before submitting your contribution though, please make sure to take a moment and read through the following guidelines. |
| 4 | + |
| 5 | +## Issue Reporting Checklist |
| 6 | + |
| 7 | +- Make sure that you are using the latest version of Vue. |
| 8 | +- Try to search for your issue, it may have already been answered or even fixed in the development branch. |
| 9 | +- It is recommended that you make a JSFiddle to reproduce your issue. You could start with [this template](http://jsfiddle.net/5sH6A/) that already includes the latest version of Vue. |
| 10 | +- If your issue is resolved but still open, don’t hesitate to close it. In case you found a solution by yourself, it could be helpful to explain how you fixed it. |
| 11 | + |
| 12 | +## Pull Request Checklist |
| 13 | + |
| 14 | +- Checkout a topic branch from `dev` and merge back against `dev`. |
| 15 | +- Work in the `src` folder and **DO NOT** checkin `dist` in the commits. |
| 16 | +- Squash the commit if there are too many small ones. |
| 17 | +- Follow the [code style](#code-style). |
| 18 | +- Make sure the default grunt task passes. (see [development setup](#development-setup)) |
| 19 | +- If adding new feature: |
| 20 | + - Add accompanying test case. |
| 21 | + - Provide convincing reason to add this feature. Ideally you should open a suggestion issue first and have it greenlighted before working on it. |
| 22 | +- If fixing a bug: |
| 23 | + - Provide detailed description of the bug in the PR. Live demo preferred. |
| 24 | + - Add appropriate test coverage if applicable. |
| 25 | + |
| 26 | +## Code Style |
| 27 | + |
| 28 | +- [No semicolons unless necessary](http://inimino.org/~inimino/blog/javascript_semicolons). |
| 29 | +- 2 spaces indentation. |
| 30 | +- multiple var declarations. |
| 31 | +- align equal signs where possible. |
| 32 | +- Return early in one line if possible. |
| 33 | +- When in doubt, read the source code. |
| 34 | +- Break long ternary conditionals like this: |
| 35 | + |
| 36 | +``` js |
| 37 | +var a = superLongConditionalStatement |
| 38 | + ? 'yep' |
| 39 | + : 'nope' |
| 40 | +``` |
| 41 | + |
| 42 | +## Development Setup |
| 43 | + |
| 44 | +You will need [Node](http://nodejs.org), [Grunt](http://gruntjs.com), [PhantomJS](http://phantomjs.org) and [CasperJS](http://casperjs.org). |
| 45 | + |
| 46 | +``` bash |
| 47 | +# in case you don’t already these: |
| 48 | +# npm install -g grunt-cli phantomjs casperjs |
| 49 | +$ npm install |
| 50 | +``` |
| 51 | + |
| 52 | +To watch and auto-build `dist/vue.js` during development: |
| 53 | + |
| 54 | +``` bash |
| 55 | +$ grunt watch |
| 56 | +``` |
| 57 | + |
| 58 | +To lint: |
| 59 | + |
| 60 | +``` bash |
| 61 | +grunt jshint |
| 62 | +``` |
| 63 | + |
| 64 | +To build: |
| 65 | + |
| 66 | +``` bash |
| 67 | +$ grunt build |
| 68 | +``` |
| 69 | + |
| 70 | +To test: |
| 71 | + |
| 72 | +``` bash |
| 73 | +# if you don’t have these yet: |
| 74 | +# npm install -g phantomjs casperjs |
| 75 | +$ grunt test |
| 76 | +``` |
| 77 | + |
| 78 | +The unit tests are written with Jasmine and run with Karma. The functional tests are written for and run with CasperJS. |
| 79 | + |
| 80 | +**If you are not using a Mac** |
| 81 | + |
| 82 | +You can modify the Gruntfile to only run Karma tests in browsers that are available on your system. Just make sure don’t check in the Gruntfile for the commit. |
0 commit comments