UNPKG

9.79 kBMarkdownView Raw
1# Contributing to Nest CLI
2
3We would love for you to contribute to Nest and help make it even better than it is today! As a contributor, here are the guidelines we would like you to follow :
4
5- [Question or Problem?](#question)
6- [Issues and Bugs](#issue)
7- [Feature Requests](#feature)
8- [Submission Guidelines](#submit)
9
10## <a name="question"></a> Got a Question or Problem ?
11
12**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 where the questions should be tagged with tag nestjs.
13
14[Stack Overflow](https://stackoverflow.com/questions/tagged/nestjs) is a much better place to ask questions since:
15
16- questions and answers stay available for public viewing so your question / answer might help someone else
17- Stack Overflow's voting system assures that the best answers are prominently visible.
18
19To save your and our time, we will systematically close all issues that are requests for general support and redirect people to Stack Overflow.
20
21If you would like to chat about the question in real-time, you can reach out via [our discord channel][discord].
22
23## <a name="issue"></a> Found a Bug?
24
25If you find a bug in the source code, you can help us by
26[submitting an issue](#submit-issue). Even better, you can [submit a Pull Request](#submit-pr) with a fix.
27
28## <a name="feature"></a> Missing a Feature?
29
30You can _request_ a new feature by [submitting an issue](#submit-issue) to our GitHub
31Repository. If you would like to _implement_ a new feature, please submit an issue with
32a proposal for your work first, to be sure that we can use it.
33Please consider what kind of change it is:
34
35- For a **Major Feature**, first open an issue and outline your proposal so that it can be
36 discussed. This will also allow us to better coordinate our efforts, prevent duplication of work,
37 and 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".
38- **Small Features** can be crafted and directly [submitted as a Pull Request](#submit-pr).
39
40## <a name="submit"></a> Submission Guidelines
41
42### <a name="submit-issue"></a> Submitting an Issue
43
44Before 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.
45
46We 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:
47
48- version of NestJS-CLI used (`nest info`)
49- and most importantly - a use-case that fails
50
51Unfortunately, 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 doesn't have enough info to be reproduced.
52
53You can file new issues by filling out our [new issue form](https://github.com/nestjs/nest/issues/new).
54
55### <a name="submit-pr"></a> Submitting a Pull Request (PR)
56
57Before you submit your Pull Request (PR) consider the following guidelines:
58
591. Search [GitHub](https://github.com/nestjs/nest/pulls) for an open or closed PR that relates to your submission. You don't want to duplicate effort.
601. Fork the nestjs/nest-cli repo.
611. Get a gpg key to sign your commits, see [help](https://help.github.com/articles/about-gpg/).
621. Create your patch, **including appropriate test cases**.
631. Commit your changes using a descriptive commit message
64
65 ```shell
66 git commit -am "<message>"
67 ```
68
69 Note: the optional commit `-a` command line option will automatically "add" and "rm" edited files.
70
711. Push your branch to GitHub:
72
73 ```shell
74 git push origin my-fix-branch
75 ```
76
77 Note: you can use -u to set your branch in upstream and just push for the next times.
78
791. In GitHub, send a pull request to `nestjs/nest-cli:master`.
80
81- If we suggest changes then:
82
83 - Make the required updates.
84 - Rebase your branch and force push to your GitHub repository (this will update your Pull Request):
85
86 ```shell
87 git rebase master -i
88 git push -f
89 ```
90
91That's it! Thank you for your contribution!
92
93#### After your pull request is merged
94
95After your pull request is merged, you can safely delete your branch and pull the changes
96from the main (upstream) repository:
97
98- Delete the remote branch on GitHub either through the GitHub web UI or your local shell as follows:
99
100 ```shell
101 git push origin --delete my-fix-branch
102 ```
103
104- Check out the master branch:
105
106 ```shell
107 git checkout master -f
108 ```
109
110- Delete the local branch:
111
112 ```shell
113 git branch -D my-fix-branch
114 ```
115
116- Update your master with the latest upstream version:
117
118 ```shell
119 git pull --ff upstream master
120 ```
121
122 ## <a name="rules"></a> Coding Rules
123To ensure consistency throughout the source code, keep these rules in mind as you are working:
124
125* All features or bug fixes **must be tested** by one or more specs (unit-tests).
126<!--
127// We're working on auto-documentation.
128* All public API methods **must be documented**. (Details TBC). -->
129* We follow [Google's JavaScript Style Guide][js-style-guide], but wrap all code at
130 **100 characters**. An automated formatter is available ( `npm run format` ).
131
132## <a name="commit"></a> Commit Message Guidelines
133
134We have very precise rules over how our git commit messages can be formatted. This leads to **more
135readable messages** that are easy to follow when looking through the **project history**. But also,
136we use the git commit messages to **generate the Nest change log**.
137
138### Commit Message Format
139Each commit message consists of a **header**, a **body** and a **footer**. The header has a special
140format that includes a **type**, a **scope** and a **subject**:
141
142```
143<type>(<scope>): <subject>
144<BLANK LINE>
145<body>
146<BLANK LINE>
147<footer>
148```
149
150The **header** is mandatory and the **scope** of the header is optional.
151
152Any line of the commit message cannot be longer than 100 characters! This allows the message to be easier
153to read on GitHub as well as in various git tools.
154
155Footer should contain a [closing reference to an issue](https://help.github.com/articles/closing-issues-via-commit-messages/) if any.
156
157Samples: (even more [samples](https://github.com/nestjs/nest/commits/master))
158
159```
160docs(changelog) update change log to beta.5
161```
162```
163fix(@nestjs/core) need to depend on latest rxjs and zone.js
164
165The version in our package.json gets copied to the one we publish, and users need the latest of these.
166```
167
168### Revert
169If 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.
170
171### Type
172Must be one of the following:
173
174* **build**: Changes that affect the build system or external dependencies (example scopes: gulp, broccoli, npm)
175* **chore**: Updating tasks etc; no production code change
176* **ci**: Changes to our CI configuration files and scripts (example scopes: Travis, Circle, BrowserStack, SauceLabs)
177* **docs**: Documentation only changes
178* **feat**: A new feature
179* **fix**: A bug fix
180* **perf**: A code change that improves performance
181* **refactor**: A code change that neither fixes a bug nor adds a feature
182* **style**: Changes that do not affect the meaning of the code (white-space, formatting, missing semi-colons, etc)
183* **test**: Adding missing tests or correcting existing tests
184
185
186### Subject
187The subject contains succinct description of the change:
188
189* use the imperative, present tense: "change" not "changed" nor "changes"
190* don't capitalize first letter
191* no dot (.) at the end
192
193### Body
194Just as in the **subject**, use the imperative, present tense: "change" not "changed" nor "changes".
195The body should include the motivation for the change and contrast this with previous behavior.
196
197### Footer
198The footer should contain any information about **Breaking Changes** and is also the place to
199reference GitHub issues that this commit **Closes**.
200
201**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.
202
203A detailed explanation can be found in this [document][commit-message-format].
204
205<!-- ## <a name="cla"></a> Signing the CLA
206
207Please sign our Contributor License Agreement (CLA) before sending pull requests. For any code
208changes to be accepted, the CLA must be signed. It's a quick process, we promise!
209
210* For individuals we have a [simple click-through form][individual-cla].
211* For corporations we'll need you to
212 [print, sign and one of scan+email, fax or mail the form][corporate-cla]. -->
213
214
215<!-- [angular-group]: https://groups.google.com/forum/#!forum/angular -->
216<!-- [coc]: https://github.com/angular/code-of-conduct/blob/master/CODE_OF_CONDUCT.md -->
217[commit-message-format]: https://docs.google.com/document/d/1QrDFcIiPjSLDn3EL15IJygNPiHORgU1_OOAqWjiDU5Y/edit#
218[corporate-cla]: http://code.google.com/legal/corporate-cla-v1.0.html
219[github]: https://github.com/nestjs/nest
220[discord]: https://discord.gg/nestjs
221[individual-cla]: http://code.google.com/legal/individual-cla-v1.0.html
222[js-style-guide]: https://google.github.io/styleguide/jsguide.html
223[jsfiddle]: http://jsfiddle.net
224[plunker]: http://plnkr.co/edit
225[runnable]: http://runnable.com
226<!-- [stackoverflow]: http://stackoverflow.com/questions/tagged/angular -->
227
\No newline at end of file