Skip to content

Commit

Permalink
feat(conventional-changelog-standard):
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
bcoe committed Apr 9, 2016
1 parent c3c90ef commit c7ccadb
Show file tree
Hide file tree
Showing 4 changed files with 55 additions and 16 deletions.
41 changes: 35 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,15 @@
[![Coverage Status](https://coveralls.io/repos/conventional-changelog/standard-version/badge.svg?branch=)](https://coveralls.io/r/conventional-changelog/standard-version?branch=master)
[![Standard Version](https://img.shields.io/badge/standard-version-brightgreen.svg)](https://github.com/conventional-changelog/standard-version)

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

**how it works:**
_how it works:_

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

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

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

## Installation

`npm i standard-version`
`npm i standard-version -g`

## Automating

Expand All @@ -52,6 +52,35 @@ Add this to your _package.json_
}
```

## Commit Message Convention, at a Glance

_patches:_

```sh
-m "fix(parsing): fixed a bug in our parser"
```

_features:_

```sh
git commit -a -m "feat(parser): we now have a parser \o/"
```

_breaking changes:_

```sh
git commit -a -m "feat(new-parser):
BREAKING CHANGE: swapping out our old parser for a new one"
```

_other changes:_

You decide, e.g., docs, chore, etc.

```sh
git commit -a -m "docs: fixed up the docs a bit"
```

## Badges!

Tell your users that you adhere to the `standard-version` commit guidelines:
Expand Down
12 changes: 3 additions & 9 deletions index.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env node
var conventionalChangelog = require('conventional-changelog')
var conventionalRecommendedBump = require('conventional-recommended-bump')
var conventionalChangelog = require('conventional-changelog')
var path = require('path')
var argv = require('yargs')
.usage('Usage: $0 [options]')
Expand All @@ -10,12 +10,6 @@ var argv = require('yargs')
default: 'CHANGELOG.md',
global: true
})
.option('preset', {
alias: 'p',
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',
default: 'angular',
global: true
})
.option('message', {
alias: 'm',
describe: 'Commit message, replaces %s with new version',
Expand Down Expand Up @@ -48,7 +42,7 @@ var semver = require('semver')
var util = require('util')

conventionalRecommendedBump({
preset: argv.preset
preset: 'angular'
}, function (err, release) {
if (err) {
console.error(chalk.red(err.message))
Expand Down Expand Up @@ -82,7 +76,7 @@ function outputChangelog (argv, cb) {
}
var content = ''
var changelogStream = conventionalChangelog({
preset: argv.preset,
preset: 'standard',
outputUnreleased: true,
pkg: {
path: path.resolve(process.cwd(), './package.json')
Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
"dependencies": {
"chalk": "^1.1.3",
"conventional-changelog": "^1.1.0",
"conventional-changelog-standard": "^1.1.0",
"conventional-recommended-bump": "^0.2.0",
"figures": "^1.5.0",
"fs-access": "^1.0.0",
Expand All @@ -44,4 +45,4 @@
"shelljs": "^0.6.0",
"standard": "^6.0.8"
}
}
}
15 changes: 15 additions & 0 deletions test.js
Original file line number Diff line number Diff line change
Expand Up @@ -78,4 +78,19 @@ describe('cli', function () {
content.should.not.match(/legacy header format/)
})
})

it('handles commit messages longer than 80 characters', function () {
fs.writeFileSync('package.json', JSON.stringify({
version: '1.0.0'
}), 'utf-8')

commit('feat: first commit')
shell.exec('git tag -a v1.0.0 -m "my awesome first release"')
commit('fix: this is my fairly long commit message which is testing whether or not we allow for long commit messages')

shell.exec(cliPath).code.should.equal(0)

var content = fs.readFileSync('CHANGELOG.md', 'utf-8')
content.should.match(/this is my fairly long commit message which is testing whether or not we allow for long commit messages/)
})
})

0 comments on commit c7ccadb

Please sign in to comment.