Du kannst nicht mehr als 25 Themen auswählen Themen müssen entweder mit einem Buchstaben oder einer Ziffer beginnen. Sie können Bindestriche („-“) enthalten und bis zu 35 Zeichen lang sein.

CONTRIBUTING.md 7.1KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155
  1. Contributing to Leaflet
  2. =======================
  3. 1. [Getting Involved](#getting-involved)
  4. 2. [Reporting Bugs](#reporting-bugs)
  5. 3. [Contributing Code](#contributing-code)
  6. 4. [Improving Documentation](#improving-documentation)
  7. ## Getting Involved
  8. Third-party patches are absolutely essential on our quest to create the best mapping library that will ever exist.
  9. However, they're not the only way to get involved with the development of Leaflet.
  10. You can help the project tremendously by discovering and [reporting bugs](#reporting-bugs),
  11. [improving documentation](#improving-documentation),
  12. helping others on the [Leaflet forum](https://groups.google.com/forum/#!forum/leaflet-js)
  13. and [GitHub issues](https://github.com/Leaflet/Leaflet/issues),
  14. showing your support for your favorite feature suggestions on [Leaflet UserVoice page](http://leaflet.uservoice.com),
  15. tweeting to [@LeafletJS](http://twitter.com/LeafletJS)
  16. and spreading the word about Leaflet among your colleagues and friends.
  17. ## Reporting Bugs
  18. Before reporting a bug on the project's [issues page](https://github.com/Leaflet/Leaflet/issues),
  19. first make sure that your issue is caused by Leaflet, not your application code
  20. (e.g. passing incorrect arguments to methods, etc.).
  21. Second, search the already reported issues for similar cases,
  22. and if it's already reported, just add any additional details in the comments.
  23. After you made sure that you've found a new Leaflet bug,
  24. here are some tips for creating a helpful report that will make fixing it much easier and quicker:
  25. * Write a **descriptive, specific title**. Bad: *Problem with polylines*. Good: *Doing X in IE9 causes Z*.
  26. * Include **browser, OS and Leaflet version** info in the description.
  27. * Create a **simple test case** that demonstrates the bug (e.g. using [JSFiddle](http://jsfiddle.net/)).
  28. * Check whether the bug can be reproduced in **other browsers**.
  29. * Check if the bug occurs in the stable version, master, or both.
  30. * *Bonus tip:* if the bug only appears in the master version but the stable version is fine,
  31. use `git bisect` to find the exact commit that introduced the bug.
  32. If you just want some help with your project,
  33. try asking [on the Leaflet forum](https://groups.google.com/forum/#!forum/leaflet-js) instead.
  34. ## Contributing Code
  35. ### Considerations for Accepting Patches
  36. While we happily accept patches, we're also commited to keeping Leaflet simple, lightweight and blazingly fast.
  37. So bugfixes, performance optimizations and small improvements that don't add a lot of code
  38. are much more likely to get accepted quickly.
  39. Before sending a pull request with a new feature, first check if it's been discussed before already
  40. (either on [GitHub issues](https://github.com/Leaflet/Leaflet/issues)
  41. or [Leaflet UserVoice](http://leaflet.uservoice.com/)),
  42. and then ask yourself two questions:
  43. 1. Are you sure that this new feature is important enough to justify its presense in the Leaflet core?
  44. Or will it look better as a plugin in a separate repository?
  45. 2. Is it written in a simple, concise way that doesn't add bulk to the codebase?
  46. If your feature or API improvement did get merged into master,
  47. please consider submitting another pull request with the corresponding [documentation update](#improving-documentation).
  48. ### Setting up the Build System
  49. To set up the Leaflet build system, install [Node](http://nodejs.org/),
  50. then run the following commands in the project root:
  51. ```
  52. npm install -g jake
  53. npm install
  54. ```
  55. You can build minified Leaflet by running `jake` (it will be built from source in the `dist` folder).
  56. For a custom build with selected components, open `build/build.html` in the browser and follow the instructions from there.
  57. ### Making Changes to Leaflet Source
  58. If you're not yet familiar with the way GitHub works (forking, pull requests, etc.),
  59. be sure to check out the awesome [article about forking](https://help.github.com/articles/fork-a-repo)
  60. on the GitHub Help website — it will get you started quickly.
  61. You should always write each batch of changes (feature, bugfix, etc.) in **its own topic branch**.
  62. Please do not commit to the `master` branch, or your unrelated changes will go into the same pull request.
  63. You should also follow the code style and whitespace conventions of the original codebase.
  64. In particular, use tabs for indentation and spaces for alignment.
  65. Before commiting your changes, run `jake lint` to catch any JS errors in the code and fix them.
  66. If you add any new files to the Leaflet source, make sure to also add them to `build/deps.js`
  67. so that the build system knows about them.
  68. Also, please make sure that you have [line endings configured properly](https://help.github.com/articles/dealing-with-line-endings) in Git! Otherwise the diff will show that all lines of a file were changed even if you touched only one.
  69. Happy coding!
  70. ## Running the Tests
  71. To run the tests from the command line,
  72. install [PhantomJS](http://phantomjs.org/) (and make sure it's in your `PATH`),
  73. then run:
  74. ```
  75. jake test
  76. ```
  77. To run all the tests in actual browsers at the same time, you can do:
  78. ```
  79. jake test --ff --chrome --safari --ie
  80. ```
  81. To run the tests in a browser manually, open `spec/index.html`.
  82. ## Code Coverage
  83. To generate a detailed report about test coverage (which helps tremendously when working on test improvements), run:
  84. ```
  85. jake test --cov
  86. ```
  87. After that, open `spec/coverage/<environment>/index.html` in a browser to see the report.
  88. From there you can click through folders/files to get details on their individual coverage.
  89. ## Improving Documentation
  90. The code of the live Leaflet website that contains all documentation and examples is located in the `gh-pages` branch
  91. and is automatically generated from a set of HTML and Markdown files by [Jekyll](https://github.com/mojombo/jekyll).
  92. The easiest way to make little improvements such as fixing typos without even leaving the browser
  93. is by editing one of the files with the online GitHub editor:
  94. browse the [gh-pages branch](https://github.com/Leaflet/Leaflet/tree/gh-pages),
  95. choose a certain file for editing (e.g. `reference.html` for API reference),
  96. click the Edit button, make changes and follow instructions from there.
  97. Once it gets merged, the changes will immediately appear on the website.
  98. If you need to make edits in a local repository to see how it looks in the process, do the following:
  99. 1. [Install Ruby](http://www.ruby-lang.org/en/) if don't have it yet.
  100. 2. Run `gem install jekyll`.
  101. 3. Run `jekyll serve --watch` in the root `Leaflet` folder.
  102. 4. Open `localhost:4000` in your browser.
  103. Now any file changes will be updated when you reload pages automatically.
  104. After commiting the changes, just send a pull request.
  105. If you need to update documentation according to a new feature that only appeared in the master version (not stable one),
  106. you need to make changes to `gh-pages-master` branch instead of `gh-pages`.
  107. It will get merged into the latter when released as stable.
  108. ## Thank You
  109. Not only are we grateful for any contributions, &mdash; helping Leaflet and its community actually makes you AWESOME.
  110. Join [this approved list of awesome people](https://github.com/Leaflet/Leaflet/graphs/contributors)
  111. and help us push the limits of what's possible with online maps!