UNPKG

11.6 kBMarkdownView Raw
1# Contributing to Nest
2
3We would love for you to contribute to Nest and help make it even better than it is
4today! As a contributor, here are the guidelines we would like you to follow:
5
6 - [Code of Conduct](#coc)
7 - [Question or Problem?](#question)
8 - [Issues and Bugs](#issue)
9 - [Feature Requests](#feature)
10 - [Submission Guidelines](#submit)
11 - [Coding Rules](#rules)
12 - [Commit Message Guidelines](#commit)
13 <!-- - [Signing the CLA](#cla) -->
14
15<!-- ## <a name="coc"></a> Code of Conduct
16Help us keep Nest open and inclusive. Please read and follow our [Code of Conduct][coc]. -->
17
18## <a name="question"></a> Got a Question or Problem?
19
20**Do not open issues for general support questions as we want to keep GitHub issues for bug reports and feature requests.** You've got much better chances of getting your question answered on [Stack Overflow](https://stackoverflow.com/questions/tagged/nestjs) where the questions should be tagged with tag `nestjs`.
21
22Stack Overflow is a much better place to ask questions since:
23
24<!-- - there are thousands of people willing to help on Stack Overflow [maybe one day] -->
25- questions and answers stay available for public viewing so your question / answer might help someone else
26- Stack Overflow's voting system assures that the best answers are prominently visible.
27
28To save your and our time, we will systematically close all issues that are requests for general support and redirect people to Stack Overflow.
29
30If you would like to chat about the question in real-time, you can reach out via [our gitter channel][gitter].
31
32## <a name="issue"></a> Found a Bug?
33If you find a bug in the source code, you can help us by
34[submitting an issue](#submit-issue) to our [GitHub Repository][github]. Even better, you can
35[submit a Pull Request](#submit-pr) with a fix.
36
37## <a name="feature"></a> Missing a Feature?
38You can *request* a new feature by [submitting an issue](#submit-issue) to our GitHub
39Repository. If you would like to *implement* a new feature, please submit an issue with
40a proposal for your work first, to be sure that we can use it.
41Please consider what kind of change it is:
42
43* For a **Major Feature**, first open an issue and outline your proposal so that it can be
44discussed. This will also allow us to better coordinate our efforts, prevent duplication of work,
45and help you to craft the change so that it is successfully accepted into the project. For your issue name, please prefix your proposal with `[discussion]`, for example "[discussion]: your feature idea".
46* **Small Features** can be crafted and directly [submitted as a Pull Request](#submit-pr).
47
48## <a name="submit"></a> Submission Guidelines
49
50### <a name="submit-issue"></a> Submitting an Issue
51
52Before you submit an issue, please search the issue tracker, maybe an issue for your problem already exists and the discussion might inform you of workarounds readily available.
53
54We want to fix all the issues as soon as possible, but before fixing a bug we need to reproduce and confirm it. In order to reproduce bugs we will systematically ask you to provide a minimal reproduction scenario using a repository or [Gist](https://gist.github.com/). Having a live, reproducible scenario gives us wealth of important information without going back & forth to you with additional questions like:
55
56- version of NestJS used
57- 3rd-party libraries and their versions
58- and most importantly - a use-case that fails
59
60<!--
61// TODO we need to create a playground, similar to plunkr
62
63A minimal reproduce scenario using a repository or Gist allows us to quickly confirm a bug (or point out coding problem) as well as confirm that we are fixing the right problem. If neither of these are not a suitable way to demonstrate the problem (for example for issues related to our npm packaging), please create a standalone git repository demonstrating the problem. -->
64
65<!-- We will be insisting on a minimal reproduce scenario in order to save maintainers time and ultimately be able to fix more bugs. Interestingly, from our experience users often find coding problems themselves while preparing a minimal plunk. We understand that sometimes it might be hard to extract essentials bits of code from a larger code-base but we really need to isolate the problem before we can fix it. -->
66
67Unfortunately, we are not able to investigate / fix bugs without a minimal reproduction, so if we don't hear back from you we are going to close an issue that don't have enough info to be reproduced.
68
69You can file new issues by filling out our [new issue form](https://github.com/nestjs/nest/issues/new).
70
71
72### <a name="submit-pr"></a> Submitting a Pull Request (PR)
73Before you submit your Pull Request (PR) consider the following guidelines:
74
751. Search [GitHub](https://github.com/nestjs/nest/pulls) for an open or closed PR
76 that relates to your submission. You don't want to duplicate effort.
77<!-- 1. Please sign our [Contributor License Agreement (CLA)](#cla) before sending PRs.
78 We cannot accept code without this. -->
791. Fork the nestjs/nest repo.
801. Make your changes in a new git branch:
81
82 ```shell
83 git checkout -b my-fix-branch master
84 ```
85
861. Create your patch, **including appropriate test cases**.
871. Follow our [Coding Rules](#rules).
881. Run the full Nest test suite, as described in the [developer documentation][dev-doc],
89 and ensure that all tests pass.
901. Commit your changes using a descriptive commit message that follows our
91 [commit message conventions](#commit). Adherence to these conventions
92 is necessary because release notes are automatically generated from these messages.
93
94 ```shell
95 git commit -a
96 ```
97 Note: the optional commit `-a` command line option will automatically "add" and "rm" edited files.
98
991. Push your branch to GitHub:
100
101 ```shell
102 git push origin my-fix-branch
103 ```
104
1051. In GitHub, send a pull request to `nestjs:master`.
106* If we suggest changes then:
107 * Make the required updates.
108 * Re-run the Nest test suites to ensure tests are still passing.
109 * Rebase your branch and force push to your GitHub repository (this will update your Pull Request):
110
111 ```shell
112 git rebase master -i
113 git push -f
114 ```
115
116That's it! Thank you for your contribution!
117
118#### After your pull request is merged
119
120After your pull request is merged, you can safely delete your branch and pull the changes
121from the main (upstream) repository:
122
123* Delete the remote branch on GitHub either through the GitHub web UI or your local shell as follows:
124
125 ```shell
126 git push origin --delete my-fix-branch
127 ```
128
129* Check out the master branch:
130
131 ```shell
132 git checkout master -f
133 ```
134
135* Delete the local branch:
136
137 ```shell
138 git branch -D my-fix-branch
139 ```
140
141* Update your master with the latest upstream version:
142
143 ```shell
144 git pull --ff upstream master
145 ```
146
147## <a name="rules"></a> Coding Rules
148To ensure consistency throughout the source code, keep these rules in mind as you are working:
149
150* All features or bug fixes **must be tested** by one or more specs (unit-tests).
151<!--
152// We're working on auto-documentation.
153* All public API methods **must be documented**. (Details TBC). -->
154* We follow [Google's JavaScript Style Guide][js-style-guide], but wrap all code at
155 **100 characters**. An automated formatter is available, see
156 [DEVELOPER.md](docs/DEVELOPER.md#clang-format).
157
158## <a name="commit"></a> Commit Message Guidelines
159
160We have very precise rules over how our git commit messages can be formatted. This leads to **more
161readable messages** that are easy to follow when looking through the **project history**. But also,
162we use the git commit messages to **generate the Nest change log**.
163
164### Commit Message Format
165Each commit message consists of a **header**, a **body** and a **footer**. The header has a special
166format that includes a **type**, a **scope** and a **subject**:
167
168```
169<type>(<scope>): <subject>
170<BLANK LINE>
171<body>
172<BLANK LINE>
173<footer>
174```
175
176The **header** is mandatory and the **scope** of the header is optional.
177
178Any line of the commit message cannot be longer 100 characters! This allows the message to be easier
179to read on GitHub as well as in various git tools.
180
181Footer should contain a [closing reference to an issue](https://help.github.com/articles/closing-issues-via-commit-messages/) if any.
182
183Samples: (even more [samples](https://github.com/nestjs/nest/commits/master))
184
185```
186docs(changelog) update change log to beta.5
187```
188```
189fix(@nestjs/core) need to depend on latest rxjs and zone.js
190
191The version in our package.json gets copied to the one we publish, and users need the latest of these.
192```
193
194### Revert
195If the commit reverts a previous commit, it should begin with `revert: `, followed by the header of the reverted commit. In the body it should say: `This reverts commit <hash>.`, where the hash is the SHA of the commit being reverted.
196
197### Type
198Must be one of the following:
199
200* **build**: Changes that affect the build system or external dependencies (example scopes: gulp, broccoli, npm)
201* **chroe**: Updating tasks etc; no production code change
202* **ci**: Changes to our CI configuration files and scripts (example scopes: Travis, Circle, BrowserStack, SauceLabs)
203* **docs**: Documentation only changes
204* **feat**: A new feature
205* **fix**: A bug fix
206* **perf**: A code change that improves performance
207* **refactor**: A code change that neither fixes a bug nor adds a feature
208* **style**: Changes that do not affect the meaning of the code (white-space, formatting, missing semi-colons, etc)
209* **test**: Adding missing tests or correcting existing tests
210
211
212### Subject
213The subject contains succinct description of the change:
214
215* use the imperative, present tense: "change" not "changed" nor "changes"
216* don't capitalize first letter
217* no dot (.) at the end
218
219### Body
220Just as in the **subject**, use the imperative, present tense: "change" not "changed" nor "changes".
221The body should include the motivation for the change and contrast this with previous behavior.
222
223### Footer
224The footer should contain any information about **Breaking Changes** and is also the place to
225reference GitHub issues that this commit **Closes**.
226
227**Breaking Changes** should start with the word `BREAKING CHANGE:` with a space or two newlines. The rest of the commit message is then used for this.
228
229A detailed explanation can be found in this [document][commit-message-format].
230
231<!-- ## <a name="cla"></a> Signing the CLA
232
233Please sign our Contributor License Agreement (CLA) before sending pull requests. For any code
234changes to be accepted, the CLA must be signed. It's a quick process, we promise!
235
236* For individuals we have a [simple click-through form][individual-cla].
237* For corporations we'll need you to
238 [print, sign and one of scan+email, fax or mail the form][corporate-cla]. -->
239
240
241<!-- [angular-group]: https://groups.google.com/forum/#!forum/angular -->
242<!-- [coc]: https://github.com/angular/code-of-conduct/blob/master/CODE_OF_CONDUCT.md -->
243[commit-message-format]: https://docs.google.com/document/d/1QrDFcIiPjSLDn3EL15IJygNPiHORgU1_OOAqWjiDU5Y/edit#
244[corporate-cla]: http://code.google.com/legal/corporate-cla-v1.0.html
245[dev-doc]: https://github.com/nestjs/nest/blob/master/docs/DEVELOPER.md
246[github]: https://github.com/nestjs/nest
247[gitter]: https://gitter.im/nestjs/nest
248[individual-cla]: http://code.google.com/legal/individual-cla-v1.0.html
249[js-style-guide]: https://google.github.io/styleguide/jsguide.html
250[jsfiddle]: http://jsfiddle.net
251[plunker]: http://plnkr.co/edit
252[runnable]: http://runnable.com
253<!-- [stackoverflow]: http://stackoverflow.com/questions/tagged/angular -->