|
| 1 | +# Vue.js Contributing Guide |
| 2 | + |
| 3 | +Hi! I'm really excited that you are interested in contributing to Vue.js. Before submitting a pull request though, please make sure to take a moment and read through the following guidelines. |
| 4 | + |
| 5 | +## Pull Request Checklist |
| 6 | + |
| 7 | +- Work in a topic branch and merge against `dev`. |
| 8 | +- Squash the commit if there are too many small ones. |
| 9 | +- Follow the [code style](#code-style). |
| 10 | +- Make sure the default grunt task passes. (see [development setup](#development-setup)) |
| 11 | +- If adding new feature: |
| 12 | + - Add accompanying test case. |
| 13 | + - Provide convincing reason to add this feature. Ideally you should open a suggestion issue first and have it greenlighted before working on it. |
| 14 | +- If fixing a bug: |
| 15 | + - Provide detailed description of the bug in the PR. Live demo preferred. |
| 16 | + - Add appropriate test coverage if applicable. |
| 17 | + |
| 18 | +## Code Style |
| 19 | + |
| 20 | +- [No semicolons unless necessary](http://inimino.org/~inimino/blog/javascript_semicolons). |
| 21 | +- 4 spaces indentation. |
| 22 | +- Single var definition, align equal signs where possible. |
| 23 | +- Return early in one line if possible. |
| 24 | +- When in doubt, read the source code. |
| 25 | +- Break long ternary conditionals: |
| 26 | + |
| 27 | +``` js |
| 28 | +var a = superLongConditionalStatement |
| 29 | + ? 'yep' |
| 30 | + : 'nope' |
| 31 | +``` |
| 32 | + |
| 33 | +## Development Setup |
| 34 | + |
| 35 | +You will need [Node](http://nodejs.org), [Grunt](http://gruntjs.com), [Component](https://github.com/component/component), [PhantomJS](http://phantomjs.org) and [CasperJS](http://casperjs.org). |
| 36 | + |
| 37 | +``` bash |
| 38 | +# in case you don't already have them: |
| 39 | +# npm install -g grunt-cli component |
| 40 | +$ npm install && component install |
| 41 | +``` |
| 42 | + |
| 43 | +To watch and auto-build `dist/vue.js` during development: |
| 44 | + |
| 45 | +``` bash |
| 46 | +$ grunt watch |
| 47 | +``` |
| 48 | + |
| 49 | +To lint: |
| 50 | + |
| 51 | +``` bash |
| 52 | +grunt jshint |
| 53 | +``` |
| 54 | + |
| 55 | +To build: |
| 56 | + |
| 57 | +``` bash |
| 58 | +$ grunt build |
| 59 | +``` |
| 60 | + |
| 61 | +To test: |
| 62 | + |
| 63 | +``` bash |
| 64 | +# if you don't have these yet: |
| 65 | +# npm install -g phantomjs casperjs |
| 66 | +$ grunt test |
| 67 | +``` |
| 68 | + |
| 69 | +The unit tests are written with Mocha + Chai and run with Karma. The functional tests are written and run with CasperJS. |
| 70 | + |
| 71 | +**If you are not using a Mac** |
| 72 | + |
| 73 | +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