Skip to content

Commit c7ccadb

Browse files
committed
feat(conventional-changelog-standard):
BREAKING CHANGE: Move to conventional-changelog-standard style. This style lifts the character limit on commit messages, and puts us in a position to make more opinionated decisions in the future.
1 parent c3c90ef commit c7ccadb

File tree

4 files changed

+55
-16
lines changed

4 files changed

+55
-16
lines changed

README.md

+35-6
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,15 @@
55
[![Coverage Status](https://coveralls.io/repos/conventional-changelog/standard-version/badge.svg?branch=)](https://coveralls.io/r/conventional-changelog/standard-version?branch=master)
66
[![Standard Version](https://img.shields.io/badge/standard-version-brightgreen.svg)](https://github.com/conventional-changelog/standard-version)
77

8-
> stop using `npm version`, use `standard-version` it does so much more:
8+
> stop using `npm version`, use `standard-version` it makes your life way easier.
99
1010
Automatic release and CHANGELOG management, using GitHub's new squash button and
11-
the workflow outlined in [conventional-changelog-cli](https://github.com/stevemao/conventional-changelog-cli).
11+
the workflow outlined in [conventional-changelog-standard](https://github.com/bcoe/conventional-changelog-standard/blob/master/convention.md).
1212

13-
**how it works:**
13+
_how it works:_
1414

1515
1. when you land commits on your `master` branch, select the _Squash and Merge_ option.
16-
2. add a title and body that follows the [conventional-changelog conventions](https://github.com/stevemao/conventional-changelog-angular/blob/master/convention.md).
16+
2. add a title and body that follows the [conventional-changelog-standard conventions](https://github.com/bcoe/conventional-changelog-standard/blob/master/convention.md).
1717
3. when you're ready to release to npm:
1818
1. checkout `master`.
1919
2. run `standard-version`.
@@ -22,7 +22,7 @@ the workflow outlined in [conventional-changelog-cli](https://github.com/stevema
2222
`standard-version` does the following:
2323

2424
1. bumps the version in package.json (based on your commit history).
25-
2. runs `conventional-changelog` and updates CHANGELOG.md.
25+
2. runs `conventional-changelog` and updates _CHANGELOG.md._
2626
3. commits _package.json_ and _CHANGELOG.md_.
2727
4. tags a new release.
2828

@@ -34,7 +34,7 @@ When you're generating your changelog for the first time, simply do:
3434

3535
## Installation
3636

37-
`npm i standard-version`
37+
`npm i standard-version -g`
3838

3939
## Automating
4040

@@ -52,6 +52,35 @@ Add this to your _package.json_
5252
}
5353
```
5454

55+
## Commit Message Convention, at a Glance
56+
57+
_patches:_
58+
59+
```sh
60+
-m "fix(parsing): fixed a bug in our parser"
61+
```
62+
63+
_features:_
64+
65+
```sh
66+
git commit -a -m "feat(parser): we now have a parser \o/"
67+
```
68+
69+
_breaking changes:_
70+
71+
```sh
72+
git commit -a -m "feat(new-parser):
73+
BREAKING CHANGE: swapping out our old parser for a new one"
74+
```
75+
76+
_other changes:_
77+
78+
You decide, e.g., docs, chore, etc.
79+
80+
```sh
81+
git commit -a -m "docs: fixed up the docs a bit"
82+
```
83+
5584
## Badges!
5685

5786
Tell your users that you adhere to the `standard-version` commit guidelines:

index.js

+3-9
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/usr/bin/env node
2-
var conventionalChangelog = require('conventional-changelog')
32
var conventionalRecommendedBump = require('conventional-recommended-bump')
3+
var conventionalChangelog = require('conventional-changelog')
44
var path = require('path')
55
var argv = require('yargs')
66
.usage('Usage: $0 [options]')
@@ -10,12 +10,6 @@ var argv = require('yargs')
1010
default: 'CHANGELOG.md',
1111
global: true
1212
})
13-
.option('preset', {
14-
alias: 'p',
15-
describe: 'Name of the preset you want to use. Must be one of the following:\nangular, atom, codemirror, ember, eslint, express, jquery, jscs, or jshint',
16-
default: 'angular',
17-
global: true
18-
})
1913
.option('message', {
2014
alias: 'm',
2115
describe: 'Commit message, replaces %s with new version',
@@ -48,7 +42,7 @@ var semver = require('semver')
4842
var util = require('util')
4943

5044
conventionalRecommendedBump({
51-
preset: argv.preset
45+
preset: 'angular'
5246
}, function (err, release) {
5347
if (err) {
5448
console.error(chalk.red(err.message))
@@ -82,7 +76,7 @@ function outputChangelog (argv, cb) {
8276
}
8377
var content = ''
8478
var changelogStream = conventionalChangelog({
85-
preset: argv.preset,
79+
preset: 'standard',
8680
outputUnreleased: true,
8781
pkg: {
8882
path: path.resolve(process.cwd(), './package.json')

package.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
"dependencies": {
3131
"chalk": "^1.1.3",
3232
"conventional-changelog": "^1.1.0",
33+
"conventional-changelog-standard": "^1.1.0",
3334
"conventional-recommended-bump": "^0.2.0",
3435
"figures": "^1.5.0",
3536
"fs-access": "^1.0.0",
@@ -44,4 +45,4 @@
4445
"shelljs": "^0.6.0",
4546
"standard": "^6.0.8"
4647
}
47-
}
48+
}

test.js

+15
Original file line numberDiff line numberDiff line change
@@ -78,4 +78,19 @@ describe('cli', function () {
7878
content.should.not.match(/legacy header format/)
7979
})
8080
})
81+
82+
it('handles commit messages longer than 80 characters', function () {
83+
fs.writeFileSync('package.json', JSON.stringify({
84+
version: '1.0.0'
85+
}), 'utf-8')
86+
87+
commit('feat: first commit')
88+
shell.exec('git tag -a v1.0.0 -m "my awesome first release"')
89+
commit('fix: this is my fairly long commit message which is testing whether or not we allow for long commit messages')
90+
91+
shell.exec(cliPath).code.should.equal(0)
92+
93+
var content = fs.readFileSync('CHANGELOG.md', 'utf-8')
94+
content.should.match(/this is my fairly long commit message which is testing whether or not we allow for long commit messages/)
95+
})
8196
})

0 commit comments

Comments
 (0)