Skip to content

Commit 4790f3f

Browse files
committed
chore: Switch to Angular commit convention 🦆
Fixes #1673
1 parent be90f3a commit 4790f3f

File tree

3 files changed

+106
-40
lines changed

3 files changed

+106
-40
lines changed

.travis.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,5 +65,4 @@ jobs:
6565

6666
- stage: release
6767
script:
68-
- npm install --no-save conventional-changelog-eslint
6968
- npx semantic-release

docs/Maintenance.md

Lines changed: 106 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -15,35 +15,119 @@ Help us develop and maintain Styleguidist:
1515

1616
## Commit message conventions
1717

18-
We use [ESLint commit message conventions](https://github.com/conventional-changelog/conventional-changelog/tree/master/packages/conventional-changelog-eslint).
18+
We use a simplified [Angular commit message conventions](https://github.com/angular/angular/blob/master/CONTRIBUTING.md#commit). This makes automated releases with [semantic-release](https://github.com/semantic-release/semantic-release) possible.
1919

20-
Each commit looks like this:
20+
\*\*The main differences with the Angular convention is that all messages are capitalized. Commit messages are written for humans to read, so we should use text convention for humans, not for machines.
21+
22+
Hovewer, we commit messages should follow a ceratain structure, so they semantic-release could generate nice human-readalbe changelogs.
23+
24+
**The commit message** consists of a `header`, a `body`, and a `footer`:
2125

2226
```
23-
Tag: Short description (fixes #1234)
27+
<header>
28+
<BLANK LINE>
29+
<body>
30+
<BLANK LINE>
31+
<footer>
32+
```
33+
34+
The `header` is mandatory and must conform to the commit message header format described below.
2435

25-
Longer description here if necessary
36+
The `body` optional but higly recommended for most commits, except very simple ones.
37+
38+
The `footer` is optional.
39+
40+
**The commit message header** looks like this:
41+
42+
```
43+
<type>: <Short summary>
44+
│ │
45+
│ └─⫸ Summary in present tense. Capitalized. No period at the end.
46+
47+
└─⫸ Commit type: chore|docs|feat|fix|refactor|test
2648
```
2749

28-
The `Tag` is one of the following:
50+
The `<type>` and `<Short summary>` fields are mandatory.
51+
52+
### Type
53+
54+
Must be one of the following:
55+
56+
- `chore` — configuration change, dependencies upgrade, and so on.
57+
- `docs` — changes to documentation only.
58+
- `feat` — a new feature.
59+
- `fix` — a bug fix.
60+
- `refactor` — a code change that neither fixes a bug nor adds a feature.
61+
- `test` — adding missing tests or correcting existing tests.
62+
63+
### Short summary
64+
65+
Use the summary field to provide a short description of the change.
66+
67+
- use the imperative, present tense: “change” not “changed” nor “changes”;
68+
- always capitalize the first letter;
69+
- no dot (.) at the end.
70+
71+
### Commit message body
72+
73+
As in the summary, use the imperative, present tense: “fix” not “fixed” nor “fixes”, but put a dot (.) at the end of each sentence.
2974

30-
- `Fix` — for a bug fix.
31-
- `Update` — for a backwards-compatible enhancement.
32-
- `New` — implemented a new feature.
33-
- `Breaking` — for a backwards—incompatible enhancement or feature.
34-
- `Docs` — changes to documentation only.
35-
- `Build` — changes to build process only.
36-
- `Upgrade` — for a dependency upgrade.
37-
- `Chore` — for refactoring, adding tests and so on (anything that isn’t user-facing).
75+
Explain the motivation for the change: why you are making it. You could include a comparison of the previous behavior with the new behavior to illustrate the impact of the change.
3876

39-
If the commit doesn’t completely fix the issue, then use (`refs #1234`) instead of (`fixes #1234`).
77+
### Commit message footer
4078

41-
Here are some good commit message summary examples:
79+
The footer could contain information about breaking changes, and is also the place to reference GitHub issues, and other pull requests that this commit closes or is related to.
4280

4381
```
44-
Build: Update Travis to only test Node 0.10 (refs #734)
45-
Fix: Semi rule incorrectly flagging extra semicolon (fixes #840)
46-
Upgrade: Esprima to 1.2, switch to using comment attachment (fixes #730)
82+
BREAKING CHANGE: <breaking change summary>
83+
<BLANK LINE>
84+
<breaking change description + migration instructions>
85+
<BLANK LINE>
86+
<BLANK LINE>
87+
Fixes #<issue number>
88+
```
89+
90+
Breaking change section should start with the phrase `BREAKING CHANGE:` (with a `:` and a space at the end, you must use ALL CAPS — _sorry but life is full of pain_) followed by a summary of the breaking change, a blank line, and a detailed description of the breaking change that also includes migration instructions.
91+
92+
If the commit doesn’t completely fix the issue, then use (`Refs #1234`) instead of (`Fixes #1234`).
93+
94+
### Commit messsage example
95+
96+
````
97+
Fix: Fix missing FlowType enum values in prop description
98+
99+
In ef4c109b, the file `PropsRenderer.js` (located at
100+
`src/client/rsg-components/Props/PropsRenderer.js`) was removed. In
101+
`PropsRenderer.js`, the `renderExtra` method checked whether `getType`
102+
for the argument to `renderExtra` was present:
103+
104+
```es6
105+
function renderExtra(prop) {
106+
const type = getType(prop);
107+
if (!type) {
108+
return null;
109+
}
110+
...
111+
}
112+
```
113+
114+
However, in ef4c109b, this method was replaced with `renderExtra.tsx`
115+
and the condition was changed to:
116+
117+
```typescript
118+
export default function renderExtra(prop: PropDescriptorWithFlow): React.ReactNode {
119+
const type = getType(prop);
120+
if (!prop.type || !type) {
121+
return null;
122+
}
123+
````
124+
125+
Unfortunately, this extra condition has resulted in this method always returning `null` for a Flow typed prop as `prop.type` is always `null` as `prop.type` is never set.
126+
127+
This commit reverts the condition to what it was before the migration to TypeScript.
128+
129+
Fixes #1234
130+
47131
```
48132
49133
## Pull requests
@@ -58,17 +142,17 @@ We’re doing automated releases with semantic-release. We’re using [milestone
58142
59143
### Patch releases
60144
61-
Any commit of a `Fix` or `Update` types merged into the master branch, is published as a _patch_ release as soon as CI passes.
145+
Any commit of a `fix` type merged into the master branch, is published as a _patch_ release as soon as CI passes.
62146
63147
![](https://d3vv6lp55qjaqc.cloudfront.net/items/1T3v1z0c3f1I1E3l0B3s/patch-commit.png)
64148
65149
### Minor releases
66150
67-
Any commit of a `New` type merged into the master branch, is published as a _minor_ release as soon as CI passes.
151+
Any commit of a `feat` type merged into the master branch, is published as a _minor_ release as soon as CI passes.
68152
69153
### Major releases
70154
71-
Any commit of a `Breaking` type merged into the master branch, is published as a _major_ release as soon as CI passes.
155+
Any commit of a `feat` type with a breaking change section merged into the master branch, is published as a _major_ release as soon as CI passes.
72156
73157
1. Merge all pull requests from a milestone. If a milestone has more than one pull request, they should be merged and released together:
74158
1. Create a new branch.
@@ -94,3 +178,4 @@ Here’s a [good example of a changelog](https://github.com/styleguidist/react-s
94178
95179
- Information about pull request authors:<br> `(#1040 by @rafaesc)`
96180
- Open Collective link at the very top:<br> `👋 **[Support Styleguidist](https://opencollective.com/styleguidist) on Open Collective** 👋`
181+
```

release.config.js

Lines changed: 0 additions & 18 deletions
This file was deleted.

0 commit comments

Comments
 (0)