You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

56 lines
4.6 KiB

  1. ## Contributing to Mongoose
  2. If you have a question about Mongoose (not a bug report) please post it to either [StackOverflow](http://stackoverflow.com/questions/tagged/mongoose), or on [Gitter](https://gitter.im/Automattic/mongoose?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
  3. ### Reporting bugs
  4. - Before opening a new issue, look for existing [issues](https://github.com/Automattic/mongoose/issues) to avoid duplication. If the issue does not yet exist, [create one](https://github.com/Automattic/mongoose/issues/new).
  5. - Please post any relevant code samples, preferably a standalone script that
  6. reproduces your issue. Do **not** describe your issue in prose, show your
  7. code.
  8. - If the bug involves an error, please post the stack trace.
  9. - Please post the version of mongoose and mongodb that you're using.
  10. - Please write bug reports in JavaScript (ES5 or ES2015), not coffeescript, typescript, etc.
  11. ### Requesting new features
  12. - Before opening a new issue, look for existing [issues](https://github.com/learnboost/mongoose/issues) to avoid duplication. If the issue does not yet exist, [create one](https://github.com/learnboost/mongoose/issues/new).
  13. - Please describe a use case for it
  14. - it would be ideal to include test cases as well
  15. ### Fixing bugs / Adding features
  16. - Before starting to write code, look for existing [issues](https://github.com/learnboost/mongoose/issues). That way you avoid working on something that might not be of interest or that has been addressed already in a different branch. You can create a new issue [here](https://github.com/learnboost/mongoose/issues/new).
  17. - _The source of this project is written in javascript, not coffeescript, therefore your bug reports should be written in javascript_.
  18. - Fork the [repo](https://github.com/Automattic/mongoose) _or_ for small documentation changes, navigate to the source on github and click the [Edit](https://github.com/blog/844-forking-with-the-edit-button) button.
  19. - Follow the general coding style of the rest of the project:
  20. - 2 space tabs
  21. - no trailing whitespace
  22. - inline documentation for new methods, class members, etc.
  23. - 1 space between conditionals, no space before function parenthesis
  24. - `if (..) {`
  25. - `for (..) {`
  26. - `while (..) {`
  27. - `function(err) {`
  28. - Write tests and make sure they pass (tests are in the [test](https://github.com/Automattic/mongoose/tree/master/test) directory).
  29. ### Running the tests
  30. - Open a terminal and navigate to the root of the project
  31. - execute `npm install` to install the necessary dependencies
  32. - start a mongodb instance on port 27017 if one isn't running already. `mongod --dbpath <path to store data> --port 27017`
  33. - execute `npm test` to run the tests (we're using [mocha](http://mochajs.org/))
  34. - or to execute a single test `npm test -- -g 'some regexp that matches the test description'`
  35. - any mocha flags can be specified with `-- <mocha flags here>`
  36. - For example, you can use `npm test -- -R spec` to use the spec reporter, rather than the dot reporter (by default, the test output looks like a bunch of dots)
  37. ### Documentation
  38. To contribute to the [API documentation](http://mongoosejs.com/docs/api.html) just make your changes to the inline documentation of the appropriate [source code](https://github.com/Automattic/mongoose/tree/master/lib) in the master branch and submit a [pull request](https://help.github.com/articles/using-pull-requests/). You might also use the github [Edit](https://github.com/blog/844-forking-with-the-edit-button) button.
  39. To contribute to the [guide](http://mongoosejs.com/docs/guide.html) or [quick start](http://mongoosejs.com/docs/index.html) docs, make your changes to the appropriate `.jade` files in the [docs](https://github.com/Automattic/mongoose/tree/master/docs) directory of the master branch and submit a pull request. Again, the [Edit](https://github.com/blog/844-forking-with-the-edit-button) button might work for you here.
  40. If you'd like to preview your documentation changes, first commit your changes to your local master branch, then execute `make docs` from the project root, which switches to the gh-pages branch, merges from the master branch and builds all the static pages for you. Now execute `node static.js` from the project root which will launch a local webserver where you can browse the documentation site locally. If all looks good, submit a [pull request](https://help.github.com/articles/using-pull-requests/) to the master branch with your changes.
  41. ### Plugins website
  42. The [plugins](http://plugins.mongoosejs.io/) site is also an [open source project](https://github.com/vkarpov15/mongooseplugins) that you can get involved with. Feel free to fork and improve it as well!