UNPKG

11.7 kBMarkdownView Raw
1# Contributing to Angular CLI
2
3We would love for you to contribute to Angular CLI and help make it even better
4than it is today! As a contributor, here are the guidelines we would like you
5to follow:
6
7 - [Code of Conduct](#coc)
8 - [Question or Problem?](#question)
9 - [Issues and Bugs](#issue)
10 - [Feature Requests](#feature)
11 - [Submission Guidelines](#submit)
12 - [Coding Rules](#rules)
13 - [Commit Message Guidelines](#commit)
14 - [Signing the CLA](#cla)
15
16## <a name="coc"></a> Code of Conduct
17Help us keep Angular open and inclusive. Please read and follow our [Code of Conduct][coc].
18
19## <a name="question"></a> Got a Question or Problem?
20
21Please, do not open issues for the 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 [StackOverflow](https://stackoverflow.com/questions/tagged/angular-cli) where the questions should be tagged with tag `angular-cli`.
22
23StackOverflow is a much better place to ask questions since:
24
25- there are thousands of people willing to help on StackOverflow
26- questions and answers stay available for public viewing so your question / answer might help someone else
27- StackOverflow's voting system assures that the best answers are prominently visible.
28
29To save your and our time we will be systematically closing all the issues that are requests for general support and redirecting people to StackOverflow.
30
31If you would like to chat about the question in real-time, you can reach out via [our gitter channel][gitter].
32
33## <a name="issue"></a> Found an Issue?
34If you find a bug in the source code or a mistake in the documentation, you can help us by
35[submitting an issue](#submit-issue) to our [GitHub Repository][github]. Even better, you can
36[submit a Pull Request](#submit-pr) with a fix.
37
38## <a name="feature"></a> Want a Feature?
39You can *request* a new feature by [submitting an issue](#submit-issue) to our [GitHub
40Repository][github]. If you would like to *implement* a new feature, please submit an issue with
41a proposal for your work first, to be sure that we can use it. Angular CLI is in developer preview
42and we are not ready to accept major contributions ahead of the full release.
43
44First open an issue and outline your proposal so that it can be
45discussed. This will also allow us to better coordinate our efforts, prevent duplication of work,
46and help you to craft the change so that it is successfully accepted into the project.
47
48**All features require a proper design and review by team members.** Before starting work, you might want to
49discuss with us to figure out:
50
51* Is this something we want? Sometimes people make feature requests that make sense for them, but aren't valuable
52 to the rest of the CLI users, or impede on other people's workflow. We try to always put the greater community
53 first.
54* Is the API valid? Does it change currently existing flags, or add new ones?
55* What's the impact on the rest of the CLI? Does it affect other commands/flags?
56
57Answering those questions first in the request might help us make a decision.
58
59## <a name="submit"></a> Submission Guidelines
60
61### <a name="submit-issue"></a> Submitting an Issue
62
63Before 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.
64
65We 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 `ng new repro-app`. Having a reproducible scenario gives us wealth of important information without going back & forth to you with additional questions like:
66
67- version of Angular CLI used
68- `.angular-cli.json` configuration
69- 3rd-party libraries and their versions
70- and most importantly - a use-case that fails
71
72A minimal reproduce scenario using allows us to quickly confirm a bug (or point out coding problem) as well as confirm that we are fixing the right problem.
73
74We 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 repository. 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.
75
76Unfortunately 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.
77
78You can file new issues by filling out our [new issue form](https://github.com/angular/angular-cli/issues/new).
79
80
81### <a name="submit-pr"></a> Submitting a Pull Request (PR)
82Before you submit your Pull Request (PR) consider the following guidelines:
83
84* Search [GitHub](https://github.com/angular/angular-cli/pulls) for an open or closed PR
85 that relates to your submission. You don't want to duplicate effort.
86* Please sign our [Contributor License Agreement (CLA)](#cla) before sending PRs.
87 We cannot accept code without this.
88* Make your changes in a new git branch:
89
90 ```shell
91 git checkout -b my-fix-branch master
92 ```
93
94* Create your patch, **including appropriate test cases**.
95* Follow our [Coding Rules](#rules).
96* Run the full Angular CLI test suite, as described in the [developer documentation][dev-doc],
97 and ensure that all tests pass (coming soon).
98* Commit your changes using a descriptive commit message that follows our
99 [commit message conventions](#commit). Adherence to these conventions
100 is necessary because release notes are automatically generated from these messages.
101
102 ```shell
103 git commit -a
104 ```
105 Note: the optional commit `-a` command line option will automatically "add" and "rm" edited files.
106
107* Push your branch to GitHub:
108
109 ```shell
110 git push origin my-fix-branch
111 ```
112
113* In GitHub, send a pull request to `angular-cli:master`.
114* If we suggest changes then:
115 * Make the required updates.
116 * Re-run the Angular CLI test suites to ensure tests are still passing.
117 * Rebase your branch and force push to your GitHub repository (this will update your Pull Request):
118
119 ```shell
120 git rebase master -i
121 git push -f
122 ```
123
124That's it! Thank you for your contribution!
125
126#### After your pull request is merged
127
128After your pull request is merged, you can safely delete your branch and pull the changes
129from the main (upstream) repository:
130
131* Delete the remote branch on GitHub either through the GitHub web UI or your local shell as follows:
132
133 ```shell
134 git push origin --delete my-fix-branch
135 ```
136
137* Check out the master branch:
138
139 ```shell
140 git checkout master -f
141 ```
142
143* Delete the local branch:
144
145 ```shell
146 git branch -D my-fix-branch
147 ```
148
149* Update your master with the latest upstream version:
150
151 ```shell
152 git pull --ff upstream master
153 ```
154
155## <a name="rules"></a> Coding Rules
156To ensure consistency throughout the source code, keep these rules in mind as you are working:
157
158* All features or bug fixes **must be tested** by one or more specs (unit-tests or e2e-tests).
159* All public API methods **must be documented**. (Details TBC).
160* We follow [Google's JavaScript Style Guide][js-style-guide], but wrap all code at
161 **100 characters**.
162
163## <a name="commit"></a> Commit Message Guidelines
164
165We have very precise rules over how our git commit messages can be formatted. This leads to **more
166readable messages** that are easy to follow when looking through the **project history**. But also,
167we use the git commit messages to **generate the Angular CLI change log**.
168
169### Commit Message Format
170Each commit message consists of a **header**, a **body** and a **footer**. The header has a special
171format that includes a **type**, a **scope** and a **subject**:
172
173```
174<type>(<scope>): <subject>
175<BLANK LINE>
176<body>
177<BLANK LINE>
178<footer>
179```
180
181The **header** is mandatory and the **scope** of the header is optional.
182
183Any line of the commit message cannot be longer 100 characters! This allows the message to be easier
184to read on GitHub as well as in various git tools.
185
186### Revert
187If 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.
188
189### Type
190Must be one of the following:
191
192* **build**: Changes that affect the build system or external dependencies
193* **ci**: Changes to our CI configuration files and scripts
194* **docs**: Documentation only changes
195* **feat**: A new feature
196* **fix**: A bug fix
197* **perf**: A code change that improves performance
198* **refactor**: A code change that neither fixes a bug nor adds a feature
199* **style**: Changes that do not affect the meaning of the code (white-space, formatting, missing
200 semi-colons, etc)
201* **test**: Adding missing tests or correcting existing tests
202
203### Scope
204The scope should be the name of the npm package affected as perceived by the person reading changelog generated from the commit messages.
205
206The following is the list of supported scopes:
207
208* **@angular/cli**
209* **@ngtools/json-schema**
210* **@ngtools/logger**
211* **@ngtools/webpack**
212
213There are currently a few exceptions to the "use package name" rule:
214
215* **packaging**: used for changes that change the npm package layout in all of our packages, e.g. public path changes, package.json changes done to all packages, d.ts file/format changes, changes to bundles, etc.
216* **changelog**: used for updating the release notes in CHANGELOG.md
217* none/empty string: useful for `style`, `test` and `refactor` changes that are done across all packages (e.g. `style: add missing semicolons`)
218
219### Subject
220The subject contains succinct description of the change:
221
222* use the imperative, present tense: "change" not "changed" nor "changes"
223* don't capitalize first letter
224* no dot (.) at the end
225
226### Body
227Just as in the **subject**, use the imperative, present tense: "change" not "changed" nor "changes".
228The body should include the motivation for the change and contrast this with previous behavior.
229
230### Footer
231The footer should contain any information about **Breaking Changes** and is also the place to
232reference GitHub issues that this commit **Closes**.
233
234**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.
235
236A detailed explanation can be found in this [document][commit-message-format].
237
238## <a name="cla"></a> Signing the CLA
239
240Please sign our Contributor License Agreement (CLA) before sending pull requests. For any code
241changes to be accepted, the CLA must be signed. It's a quick process, we promise!
242
243* For individuals we have a [simple click-through form][individual-cla].
244* For corporations we'll need you to
245 [print, sign and one of scan+email, fax or mail the form][corporate-cla].
246
247
248[coc]: https://github.com/angular/code-of-conduct/blob/master/CODE_OF_CONDUCT.md
249[commit-message-format]: https://docs.google.com/document/d/1QrDFcIiPjSLDn3EL15IJygNPiHORgU1_OOAqWjiDU5Y/edit#
250[corporate-cla]: http://code.google.com/legal/corporate-cla-v1.0.html
251[dev-doc]: https://github.com/angular/angular-cli#development-hints-for-working-on-angular-cli
252[GitHub]: https://github.com/angular/angular-cli
253[gitter]: https://gitter.im/angular/angular-cli
254[individual-cla]: http://code.google.com/legal/individual-cla-v1.0.html
255[js-style-guide]: https://google.github.io/styleguide/jsguide.html
256[stackoverflow]: http://stackoverflow.com/questions/tagged/angular-cli