Skip to content

Commit

Permalink
feat: use conventionalcommits as base preset
Browse files Browse the repository at this point in the history
BREAKING CHANGE: switch base preset from angular to conventionalcommits
  • Loading branch information
sheerlox committed Jun 3, 2023
1 parent 5989f40 commit b4d4703
Show file tree
Hide file tree
Showing 5 changed files with 34 additions and 19 deletions.
21 changes: 10 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,10 @@
[conventional-changelog](https://github.com/conventional-changelog/conventional-changelog) preset built from a list of [conventional commit types](src/types.js) (similar to [conventional-commit-types](https://github.com/commitizen/conventional-commit-types)).
Also provides [release rules](https://github.com/semantic-release/commit-analyzer#releaserules) configuration for [@semantic-release/commit-analyzer](https://github.com/semantic-release/commit-analyzer#releaserules).

Commit types originally from:
Commit types _originally_ from:

- [Angular Git Commit Message Conventions](https://github.com/angular/angular/blob/master/CONTRIBUTING.md#type)
- [commitizen/cz-conventional-changelog](https://github.com/commitizen/cz-conventional-changelog)
- [conventional-commit-types](https://github.com/commitizen/conventional-commit-types)
- [Conventional Commits](https://www.conventionalcommits.org/en/v1.0.0)
- [commitizen/conventional-commit-types](https://github.com/commitizen/conventional-commit-types)

## Install

Expand Down Expand Up @@ -94,13 +93,13 @@ Aliases allow to have additional commit types (in a tool like [commitizen](https

For example the [commitizen](https://github.com/commitizen/cz-cli) CLI can present the choice `initial` and the final commit message will be 'feat: Initial commit 🎉'

| Commit Type | Maps to | Title | Description | Emoji |
| :----------------: | ------- | ----------------- | ------------------------------- | :---: |
| `initial` | `feat` | Initial | Initial commit | 🎉 |
| `dependencies` | `fix` | Dependencies | Update dependencies | ⬆️ |
| `peerDependencies` | `fix` | Peer dependencies | Update peer dependencies | ⬆️ |
| `devDependencies` | `chore` | Dev dependencies | Update development dependencies | ⬆️ |
| `metadata` | `fix` | Metadata | Update metadata (package.json) | 📦 |
| Commit Type | Maps to | Title | Description | Emoji |
| :---------: | ------- | ----------------- | ------------------------------- | :---: |
| `initial` | `feat` | Initial | Initial commit | 🎉 |
| `deps` | `fix` | Dependencies | Update dependencies | ⬆️ |
| `devdeps` | `chore` | Dev dependencies | Update development dependencies | ⬆️ |
| `peerdeps` | `fix` | Peer dependencies | Update peer dependencies | ⬆️ |
| `metadata` | `fix` | Metadata | Update metadata (package.json) | 📦 |

## Related

Expand Down
5 changes: 3 additions & 2 deletions index.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
'use strict';

const _ = require('lodash');
const conventionalChangelogAngular = require('conventional-changelog-angular');
const conventionalChangelogConventionalCommits =
require('conventional-changelog-conventionalcommits')();
const commitGroupsSort = require('./lib/commit-groups-compare');
const transform = require('./lib/commit-transform');

/**
* @type {Promise<Object>} preset with `parserOpts` and `writerOpts`.
*/
module.exports = conventionalChangelogAngular.then((preset) =>
module.exports = conventionalChangelogConventionalCommits.then((preset) =>
_.merge(preset, {
writerOpts: { transform, commitGroupsSort, groupBy: 'groupType' },
})
Expand Down
23 changes: 19 additions & 4 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
"node": ">=16"
},
"dependencies": {
"conventional-changelog-angular": "^5.0.13",
"conventional-changelog-conventionalcommits": "5.0.0",
"lodash": "^4.17.21"
},
"devDependencies": {
Expand Down
2 changes: 1 addition & 1 deletion test/preset.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ test.serial(
}
);

t.regex(log, /### Breaking changes/);
t.regex(log, /### Breaking changes/);
t.regex(log, /### Fix title/);
t.regex(log, /\* \*\*scope1:\*\* First fix/);
t.regex(log, /### Feature title/);
Expand Down

0 comments on commit b4d4703

Please sign in to comment.