-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fork conventional-changelog-angular and implement custom bump policy
1. Bump major if commit contains line “bump major” 2. Bump minor if commit contains line “bump minor” 3. Bump patch otherwise
- Loading branch information
Showing
18 changed files
with
1,288 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
### ISC License | ||
|
||
Copyright © [conventional-changelog team](https://github.com/conventional-changelog) | ||
|
||
Permission to use, copy, modify, and/or distribute this software for any | ||
purpose with or without fee is hereby granted, provided that the above | ||
copyright notice and this permission notice appear in all copies. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH | ||
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND | ||
FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, | ||
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM | ||
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR | ||
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR | ||
PERFORMANCE OF THIS SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,104 @@ | ||
# [![NPM version][npm-image]][npm-url] [![Build Status][travis-image]][travis-url] [![Dependency Status][daviddm-image]][daviddm-url] [![Coverage Status][coveralls-image]][coveralls-url] | ||
|
||
> [conventional-changelog](https://github.com/ajoslin/conventional-changelog) [angular](https://github.com/angular/angular) preset | ||
**Issues with the convention itself should be reported on the Angular issue tracker.** | ||
|
||
## Angular Convention | ||
|
||
Angular's [commit message guidelines](https://github.com/angular/angular/blob/master/CONTRIBUTING.md#commit). | ||
|
||
### Examples | ||
|
||
Appears under "Features" header, pencil subheader: | ||
|
||
``` | ||
feat(pencil): add 'graphiteWidth' option | ||
``` | ||
|
||
Appears under "Bug Fixes" header, graphite subheader, with a link to issue #28: | ||
|
||
``` | ||
fix(graphite): stop graphite breaking when width < 0.1 | ||
Closes #28 | ||
``` | ||
|
||
Appears under "Performance Improvements" header, and under "Breaking Changes" with the breaking change explanation: | ||
|
||
``` | ||
perf(pencil): remove graphiteWidth option | ||
BREAKING CHANGE: The graphiteWidth option has been removed. The default graphite width of 10mm is always used for performance reason. | ||
``` | ||
|
||
The following commit and commit `667ecc1` do not appear in the changelog if they are under the same release. If not, the revert commit appears under the "Reverts" header. | ||
|
||
``` | ||
revert: feat(pencil): add 'graphiteWidth' option | ||
This reverts commit 667ecc1654a317a13331b17617d973392f415f02. | ||
``` | ||
|
||
### Commit Message Format | ||
|
||
A commit message consists of a **header**, **body** and **footer**. The header has a **type**, **scope** and **subject**: | ||
|
||
``` | ||
<type>(<scope>): <subject> | ||
<BLANK LINE> | ||
<body> | ||
<BLANK LINE> | ||
<footer> | ||
``` | ||
|
||
The **header** is mandatory and the **scope** of the header is optional. | ||
|
||
### Revert | ||
|
||
If 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. | ||
|
||
### Type | ||
|
||
If the prefix is `feat`, `fix` or `perf`, it will appear in the changelog. However if there is any [BREAKING CHANGE](#footer), the commit will always appear in the changelog. | ||
|
||
Other prefixes are up to your discretion. Suggested prefixes are `build`, `ci`, `docs` ,`style`, `refactor`, and `test` for non-changelog related tasks. | ||
|
||
Details regarding these types can be found in the official [Angular Contributing Guidelines](https://github.com/angular/angular/blob/master/CONTRIBUTING.md#type). | ||
|
||
### Scope | ||
|
||
The scope could be anything specifying place of the commit change. For example `$location`, | ||
`$browser`, `$compile`, `$rootScope`, `ngHref`, `ngClick`, `ngView`, etc... | ||
|
||
### Subject | ||
|
||
The subject contains succinct description of the change: | ||
|
||
- use the imperative, present tense: "change" not "changed" nor "changes" | ||
- don't capitalize first letter | ||
- no dot (.) at the end | ||
|
||
### Body | ||
|
||
Just as in the **subject**, use the imperative, present tense: "change" not "changed" nor "changes". | ||
The body should include the motivation for the change and contrast this with previous behavior. | ||
|
||
### Footer | ||
|
||
The footer should contain any information about **Breaking Changes** and is also the place to | ||
reference GitHub issues that this commit **Closes**. | ||
|
||
**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. | ||
|
||
A detailed explanation can be found in this [document](#commit-message-format). | ||
|
||
[npm-image]: https://badge.fury.io/js/conventional-changelog-angular.svg | ||
[npm-url]: https://npmjs.org/package/conventional-changelog-angular | ||
[travis-image]: https://travis-ci.org/conventional-changelog/conventional-changelog-angular.svg?branch=master | ||
[travis-url]: https://travis-ci.org/conventional-changelog/conventional-changelog-angular | ||
[daviddm-image]: https://david-dm.org/conventional-changelog/conventional-changelog-angular.svg?theme=shields.io | ||
[daviddm-url]: https://david-dm.org/conventional-changelog/conventional-changelog-angular | ||
[coveralls-image]: https://coveralls.io/repos/conventional-changelog/conventional-changelog-angular/badge.svg | ||
[coveralls-url]: https://coveralls.io/r/conventional-changelog/conventional-changelog-angular | ||
[commit-message-format]: https://docs.google.com/document/d/1QrDFcIiPjSLDn3EL15IJygNPiHORgU1_OOAqWjiDU5Y/edit# |
9 changes: 9 additions & 0 deletions
9
modules/conventional-changelog-e2e-tools/conventional-changelog.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
'use strict' | ||
|
||
const Q = require('q') | ||
const parserOpts = require('./parser-opts') | ||
const writerOpts = require('./writer-opts') | ||
|
||
module.exports = Q.all([parserOpts, writerOpts]).spread((parserOpts, writerOpts) => { | ||
return { parserOpts, writerOpts } | ||
}) |
35 changes: 35 additions & 0 deletions
35
modules/conventional-changelog-e2e-tools/conventional-recommended-bump.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
'use strict' | ||
|
||
const parserOpts = require('./parser-opts') | ||
|
||
const levels = { | ||
major: 0, | ||
minor: 1, | ||
patch: 2, | ||
} | ||
|
||
module.exports = { | ||
parserOpts, | ||
|
||
whatBump: (commits) => { | ||
const bumps = commits.map((commit) => { | ||
const bodyLines = (commit.body ?? '').toLowerCase().split('\n').filter(Boolean) | ||
if (bodyLines.includes('bump major')) { | ||
return levels.major | ||
} | ||
if (bodyLines.includes('bump minor')) { | ||
return levels.minor | ||
} | ||
|
||
return levels.patch | ||
}) | ||
|
||
const majorBumps = bumps.filter((bump) => bump === levels.major).length | ||
const minorBumps = bumps.filter((bump) => bump === levels.minor).length | ||
|
||
return { | ||
level: Math.min(...bumps), | ||
reason: `There are ${majorBumps} major bumps and ${minorBumps} minor bumps`, | ||
} | ||
}, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
'use strict' | ||
const Q = require('q') | ||
const conventionalChangelog = require('./conventional-changelog') | ||
const parserOpts = require('./parser-opts') | ||
const recommendedBumpOpts = require('./conventional-recommended-bump') | ||
const writerOpts = require('./writer-opts') | ||
|
||
module.exports = Q.all([conventionalChangelog, parserOpts, recommendedBumpOpts, writerOpts]).spread( | ||
(conventionalChangelog, parserOpts, recommendedBumpOpts, writerOpts) => { | ||
return { conventionalChangelog, parserOpts, recommendedBumpOpts, writerOpts } | ||
} | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
{ | ||
"name": "conventional-changelog-e2e-tools", | ||
"version": "5.0.13", | ||
"description": "conventional-changelog e2e-tools preset", | ||
"main": "index.js", | ||
"private": true, | ||
"scripts": { | ||
"test-windows": "mocha --timeout 30000" | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/conventional-changelog/conventional-changelog.git" | ||
}, | ||
"keywords": [ | ||
"conventional-changelog", | ||
"angular", | ||
"preset" | ||
], | ||
"files": [ | ||
"conventional-changelog.js", | ||
"conventional-recommended-bump.js", | ||
"index.js", | ||
"parser-opts.js", | ||
"writer-opts.js", | ||
"templates" | ||
], | ||
"author": "Steve Mao", | ||
"engines": { | ||
"node": ">=10" | ||
}, | ||
"license": "ISC", | ||
"bugs": { | ||
"url": "https://github.com/conventional-changelog/conventional-changelog/issues" | ||
}, | ||
"homepage": "https://github.com/conventional-changelog/conventional-changelog/tree/master/packages/conventional-changelog-angular#readme", | ||
"dependencies": { | ||
"compare-func": "^2.0.0", | ||
"q": "^1.5.1" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
'use strict' | ||
|
||
module.exports = { | ||
headerPattern: /^(\w*)(?:\((.*)\))?: (.*)$/, | ||
headerCorrespondence: ['type', 'scope', 'subject'], | ||
noteKeywords: ['BREAKING CHANGE'], | ||
revertPattern: /^(?:Revert|revert:)\s"?([\s\S]+?)"?\s*This reverts commit (\w*)\./i, | ||
revertCorrespondence: ['header', 'hash'], | ||
} |
61 changes: 61 additions & 0 deletions
61
modules/conventional-changelog-e2e-tools/templates/commit.hbs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
*{{#if scope}} **{{scope}}:** | ||
{{~/if}} {{#if subject}} | ||
{{~subject}} | ||
{{~else}} | ||
{{~header}} | ||
{{~/if}} | ||
|
||
{{~!-- commit link --}} {{#if @root.linkReferences~}} | ||
([{{shortHash}}]( | ||
{{~#if @root.repository}} | ||
{{~#if @root.host}} | ||
{{~@root.host}}/ | ||
{{~/if}} | ||
{{~#if @root.owner}} | ||
{{~@root.owner}}/ | ||
{{~/if}} | ||
{{~@root.repository}} | ||
{{~else}} | ||
{{~@root.repoUrl}} | ||
{{~/if}}/ | ||
{{~@root.commit}}/{{hash}})) | ||
{{~else}} | ||
{{~shortHash}} | ||
{{~/if}} | ||
|
||
{{~!-- commit references --}} | ||
{{~#if references~}} | ||
, closes | ||
{{~#each references}} {{#if @root.linkReferences~}} | ||
[ | ||
{{~#if this.owner}} | ||
{{~this.owner}}/ | ||
{{~/if}} | ||
{{~this.repository}}#{{this.issue}}]( | ||
{{~#if @root.repository}} | ||
{{~#if @root.host}} | ||
{{~@root.host}}/ | ||
{{~/if}} | ||
{{~#if this.repository}} | ||
{{~#if this.owner}} | ||
{{~this.owner}}/ | ||
{{~/if}} | ||
{{~this.repository}} | ||
{{~else}} | ||
{{~#if @root.owner}} | ||
{{~@root.owner}}/ | ||
{{~/if}} | ||
{{~@root.repository}} | ||
{{~/if}} | ||
{{~else}} | ||
{{~@root.repoUrl}} | ||
{{~/if}}/ | ||
{{~@root.issue}}/{{this.issue}}) | ||
{{~else}} | ||
{{~#if this.owner}} | ||
{{~this.owner}}/ | ||
{{~/if}} | ||
{{~this.repository}}#{{this.issue}} | ||
{{~/if}}{{/each}} | ||
{{~/if}} | ||
|
11 changes: 11 additions & 0 deletions
11
modules/conventional-changelog-e2e-tools/templates/footer.hbs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
{{#if noteGroups}} | ||
{{#each noteGroups}} | ||
|
||
### {{title}} | ||
|
||
{{#each notes}} | ||
* {{#if commit.scope}}**{{commit.scope}}:** {{/if}}{{text}} | ||
{{/each}} | ||
{{/each}} | ||
|
||
{{/if}} |
25 changes: 25 additions & 0 deletions
25
modules/conventional-changelog-e2e-tools/templates/header.hbs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
{{#if isPatch~}} | ||
## | ||
{{~else~}} | ||
# | ||
{{~/if}} {{#if @root.linkCompare~}} | ||
[{{version}}]( | ||
{{~#if @root.repository~}} | ||
{{~#if @root.host}} | ||
{{~@root.host}}/ | ||
{{~/if}} | ||
{{~#if @root.owner}} | ||
{{~@root.owner}}/ | ||
{{~/if}} | ||
{{~@root.repository}} | ||
{{~else}} | ||
{{~@root.repoUrl}} | ||
{{~/if~}} | ||
/compare/{{previousTag}}...{{currentTag}}) | ||
{{~else}} | ||
{{~version}} | ||
{{~/if}} | ||
{{~#if title}} "{{title}}" | ||
{{~/if}} | ||
{{~#if date}} ({{date}}) | ||
{{/if}} |
16 changes: 16 additions & 0 deletions
16
modules/conventional-changelog-e2e-tools/templates/template.hbs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
{{> header}} | ||
|
||
{{#each commitGroups}} | ||
|
||
{{#if title}} | ||
### {{title}} | ||
|
||
{{/if}} | ||
{{#each commits}} | ||
{{> commit root=@root}} | ||
{{/each}} | ||
|
||
{{/each}} | ||
{{> footer}} | ||
|
||
|
5 changes: 5 additions & 0 deletions
5
modules/conventional-changelog-e2e-tools/test/fixtures/_ghe-host.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"repository": "ghe", | ||
"version": "v3.0.0", | ||
"repository": "https://github.internal.example.com/conventional-changelog/internal" | ||
} |
5 changes: 5 additions & 0 deletions
5
modules/conventional-changelog-e2e-tools/test/fixtures/_known-host.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"repository": "known", | ||
"version": "v2.0.0", | ||
"repository": "https://github.com/conventional-changelog/example" | ||
} |
4 changes: 4 additions & 0 deletions
4
modules/conventional-changelog-e2e-tools/test/fixtures/_unknown-host.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
{ | ||
"repository": "http://unknown", | ||
"version": "v2.0.0" | ||
} |
Oops, something went wrong.