Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: creating highly configurable preset, based on conventionalcommi…
…ts.org (#421)
- Loading branch information
Showing
21 changed files
with
803 additions
and
8 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
15 changes: 15 additions & 0 deletions
15
packages/conventional-changelog-conventionalcommits/LICENSE.md
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. |
12 changes: 12 additions & 0 deletions
12
packages/conventional-changelog-conventionalcommits/README.md
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 @@ | ||
# [![Build Status][travis-image]][travis-url] [![Coverage Status][coveralls-image]][coveralls-url] | ||
|
||
## conventionalcommits.org convention | ||
|
||
A concrete implementation of the specification described at | ||
[conventionalcommits.org](https://conventionalcommits.org/) for automated | ||
CHANGELOG generation and version management. | ||
|
||
[travis-image]: https://travis-ci.org/conventional-changelog/conventional-changelog.svg?branch=master | ||
[travis-url]: https://travis-ci.org/conventional-changelog/conventional-changelog | ||
[coveralls-image]: https://coveralls.io/repos/conventional-changelog/conventional-changelog/badge.svg | ||
[coveralls-url]: https://coveralls.io/r/conventional-changelog/conventional-changelog |
12 changes: 12 additions & 0 deletions
12
packages/conventional-changelog-conventionalcommits/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,12 @@ | ||
'use strict' | ||
|
||
const Q = require(`q`) | ||
const parserOpts = require(`./parser-opts`) | ||
const writerOpts = require(`./writer-opts`) | ||
|
||
module.exports = function (config) { | ||
return Q.all([parserOpts, writerOpts]) | ||
.spread((parserOpts, writerOpts) => { | ||
return { parserOpts, writerOpts } | ||
}) | ||
} |
34 changes: 34 additions & 0 deletions
34
packages/conventional-changelog-conventionalcommits/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,34 @@ | ||
'use strict' | ||
|
||
const parserOpts = require(`./parser-opts`) | ||
|
||
module.exports = function (config) { | ||
return { | ||
parserOpts: parserOpts(config), | ||
|
||
whatBump: (commits) => { | ||
let level = 2 | ||
let breakings = 0 | ||
let features = 0 | ||
|
||
commits.forEach(commit => { | ||
if (commit.notes.length > 0) { | ||
breakings += commit.notes.length | ||
level = 0 | ||
} else if (commit.type === `feat`) { | ||
features += 1 | ||
if (level === 2) { | ||
level = 1 | ||
} | ||
} | ||
}) | ||
|
||
return { | ||
level: level, | ||
reason: breakings === 1 | ||
? `There is ${breakings} BREAKING CHANGE and ${features} features` | ||
: `There are ${breakings} BREAKING CHANGES and ${features} features` | ||
} | ||
} | ||
} | ||
} |
17 changes: 17 additions & 0 deletions
17
packages/conventional-changelog-conventionalcommits/index.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,17 @@ | ||
'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 = function (config) { | ||
return Q.all([ | ||
conventionalChangelog(config), | ||
parserOpts(config), | ||
recommendedBumpOpts(config), | ||
writerOpts(config) | ||
]).spread((conventionalChangelog, parserOpts, recommendedBumpOpts, writerOpts) => { | ||
return { conventionalChangelog, parserOpts, recommendedBumpOpts, writerOpts } | ||
}) | ||
} |
39 changes: 39 additions & 0 deletions
39
packages/conventional-changelog-conventionalcommits/package.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,39 @@ | ||
{ | ||
"name": "conventional-changelog-conventionalcommits", | ||
"version": "1.0.0", | ||
"description": "conventional-changelog conventionalcommits.org preset", | ||
"main": "index.js", | ||
"scripts": { | ||
"test-windows": "mocha --timeout 30000" | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/conventional-changelog/conventional-changelog.git" | ||
}, | ||
"keywords": [ | ||
"conventional-changelog", | ||
"conventionalcommits.org", | ||
"preset" | ||
], | ||
"files": [ | ||
"conventional-changelog.js", | ||
"conventional-recommended-bump.js", | ||
"index.js", | ||
"parser-opts.js", | ||
"writer-opts.js", | ||
"templates" | ||
], | ||
"author": "Ben Coe", | ||
"engines": { | ||
"node": ">=10.0.0" | ||
This comment has been minimized.
Sorry, something went wrong. |
||
}, | ||
"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": "^1.3.1", | ||
"q": "^1.5.1" | ||
} | ||
} |
15 changes: 15 additions & 0 deletions
15
packages/conventional-changelog-conventionalcommits/parser-opts.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,15 @@ | ||
'use strict' | ||
|
||
module.exports = function (config) { | ||
return { | ||
headerPattern: /^(\w*)(?:\((.*)\))?: (.*)$/, | ||
headerCorrespondence: [ | ||
`type`, | ||
`scope`, | ||
`subject` | ||
], | ||
noteKeywords: [`BREAKING CHANGE`], | ||
revertPattern: /^revert:\s([\s\S]*?)\s*This reverts commit (\w*)\./, | ||
revertCorrespondence: [`header`, `hash`] | ||
} | ||
} |
30 changes: 30 additions & 0 deletions
30
packages/conventional-changelog-conventionalcommits/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,30 @@ | ||
*{{#if scope}} **{{scope}}:** | ||
{{~/if}} {{#if subject}} | ||
{{~subject}} | ||
{{~else}} | ||
{{~header}} | ||
{{~/if}} | ||
|
||
{{~!-- commit link --}} {{#if @root.linkReferences~}} | ||
([{{hash}}]({{commitUrlFormat}})) | ||
{{~else}} | ||
{{~hash}} | ||
{{~/if}} | ||
|
||
{{~!-- commit references --}} | ||
{{~#if references~}} | ||
, closes | ||
{{~#each references}} {{#if @root.linkReferences~}} | ||
[ | ||
{{~#if this.owner}} | ||
{{~this.owner}}/ | ||
{{~/if}} | ||
{{~this.repository}}#{{this.issue}}]({{issueUrlFormat}}) | ||
{{~else}} | ||
{{~#if this.owner}} | ||
{{~this.owner}}/ | ||
{{~/if}} | ||
{{~this.repository}}#{{this.issue}} | ||
{{~/if}}{{/each}} | ||
{{~/if}} | ||
|
11 changes: 11 additions & 0 deletions
11
packages/conventional-changelog-conventionalcommits/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}} |
13 changes: 13 additions & 0 deletions
13
packages/conventional-changelog-conventionalcommits/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,13 @@ | ||
{{#if isPatch~}} | ||
## | ||
{{~else~}} | ||
# | ||
{{~/if}} {{#if @root.linkCompare~}} | ||
[{{version}}]({{compareUrlFormat}}) | ||
{{~else}} | ||
{{~version}} | ||
{{~/if}} | ||
{{~#if title}} "{{title}}" | ||
{{~/if}} | ||
{{~#if date}} ({{date}}) | ||
{{/if}} |
16 changes: 16 additions & 0 deletions
16
packages/conventional-changelog-conventionalcommits/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
packages/conventional-changelog-conventionalcommits/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
packages/conventional-changelog-conventionalcommits/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
packages/conventional-changelog-conventionalcommits/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": "unknown", | ||
"version": "v2.0.0" | ||
} |
Oops, something went wrong.
The parent package.json only requires version >=6.9.0.
Requiring version 10.0.0 or higher causes builds with node version less than this to break.