conventional-changelog-angular 6.0.0 → 7.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,9 +1,41 @@
1
- # [![NPM version][npm-image]][npm-url] [![Build Status][travis-image]][travis-url] [![Dependency Status][daviddm-image]][daviddm-url] [![Coverage Status][coverage-image]][coverage-url]
1
+ # conventional-changelog-angular
2
2
 
3
- > [conventional-changelog](https://github.com/ajoslin/conventional-changelog) [angular](https://github.com/angular/angular) preset
3
+ [![NPM version][npm]][npm-url]
4
+ [![Node version][node]][node-url]
5
+ [![Dependencies status][deps]][deps-url]
6
+ [![Build status][build]][build-url]
7
+ [![Coverage status][coverage]][coverage-url]
8
+
9
+ [npm]: https://img.shields.io/npm/v/conventional-changelog-angular.svg
10
+ [npm-url]: https://npmjs.com/package/conventional-changelog-angular
11
+
12
+ [node]: https://img.shields.io/node/v/conventional-changelog-angular.svg
13
+ [node-url]: https://nodejs.org
14
+
15
+ [deps]: https://img.shields.io/librariesio/release/npm/conventional-changelog-angular
16
+ [deps-url]: https://libraries.io/npm/conventional-changelog-angular/tree
17
+
18
+ [build]: https://img.shields.io/github/actions/workflow/status/conventional-changelog/conventional-changelog/ci.yaml?branch=master
19
+ [build-url]: https://github.com/conventional-changelog/conventional-changelog/actions
20
+
21
+ [coverage]: https://coveralls.io/repos/github/conventional-changelog/conventional-changelog/badge.svg?branch=master
22
+ [coverage-url]: https://coveralls.io/github/conventional-changelog/conventional-changelog?branch=master
23
+
24
+ [conventional-changelog](https://github.com/conventional-changelog/conventional-changelog) [angular](https://github.com/angular/angular) preset.
4
25
 
5
26
  **Issues with the convention itself should be reported on the Angular issue tracker.**
6
27
 
28
+ ## Install
29
+
30
+ ```bash
31
+ # yarn
32
+ yarn add -D conventional-changelog-angular
33
+ # pnpm
34
+ pnpm add -D conventional-changelog-angular
35
+ # npm
36
+ npm i -D conventional-changelog-angular
37
+ ```
38
+
7
39
  ## Angular Convention
8
40
 
9
41
  Angular's [commit message guidelines](https://github.com/angular/angular/blob/master/CONTRIBUTING.md#commit).
@@ -92,13 +124,3 @@ reference GitHub issues that this commit **Closes**.
92
124
  **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.
93
125
 
94
126
  A detailed explanation can be found in this [document](#commit-message-format).
95
-
96
- [npm-image]: https://badge.fury.io/js/conventional-changelog-angular.svg
97
- [npm-url]: https://npmjs.org/package/conventional-changelog-angular
98
- [travis-image]: https://travis-ci.org/conventional-changelog/conventional-changelog-angular.svg?branch=master
99
- [travis-url]: https://travis-ci.org/conventional-changelog/conventional-changelog-angular
100
- [daviddm-image]: https://david-dm.org/conventional-changelog/conventional-changelog-angular.svg?theme=shields.io
101
- [daviddm-url]: https://david-dm.org/conventional-changelog/conventional-changelog-angular
102
- [coverage-image]: https://coveralls.io/repos/github/conventional-changelog/conventional-changelog/badge.svg?branch=master
103
- [coverage-url]: https://coveralls.io/github/conventional-changelog/conventional-changelog?branch=master
104
- [commit-message-format]: https://docs.google.com/document/d/1QrDFcIiPjSLDn3EL15IJygNPiHORgU1_OOAqWjiDU5Y/edit#
@@ -0,0 +1,10 @@
1
+ 'use strict'
2
+
3
+ function createConventionalChangelogOpts (parserOpts, writerOpts) {
4
+ return {
5
+ parserOpts,
6
+ writerOpts
7
+ }
8
+ }
9
+
10
+ module.exports.createConventionalChangelogOpts = createConventionalChangelogOpts
@@ -0,0 +1,34 @@
1
+ 'use strict'
2
+
3
+ function createConventionalRecommendedBumpOpts (parserOpts) {
4
+ return {
5
+ parserOpts,
6
+
7
+ whatBump (commits) {
8
+ let level = 2
9
+ let breakings = 0
10
+ let features = 0
11
+
12
+ commits.forEach(commit => {
13
+ if (commit.notes.length > 0) {
14
+ breakings += commit.notes.length
15
+ level = 0
16
+ } else if (commit.type === 'feat') {
17
+ features += 1
18
+ if (level === 2) {
19
+ level = 1
20
+ }
21
+ }
22
+ })
23
+
24
+ return {
25
+ level,
26
+ reason: breakings === 1
27
+ ? `There is ${breakings} BREAKING CHANGE and ${features} features`
28
+ : `There are ${breakings} BREAKING CHANGES and ${features} features`
29
+ }
30
+ }
31
+ }
32
+ }
33
+
34
+ module.exports.createConventionalRecommendedBumpOpts = createConventionalRecommendedBumpOpts
package/index.js CHANGED
@@ -1,13 +1,22 @@
1
1
  'use strict'
2
- const conventionalChangelog = require('./conventional-changelog')
3
- const parserOpts = require('./parser-opts')
4
- const recommendedBumpOpts = require('./conventional-recommended-bump')
5
- const writerOpts = require('./writer-opts')
6
-
7
- module.exports = Promise.all([conventionalChangelog, parserOpts, recommendedBumpOpts, writerOpts])
8
- .then(([conventionalChangelog, parserOpts, recommendedBumpOpts, writerOpts]) => ({
9
- conventionalChangelog,
2
+
3
+ const { createParserOpts } = require('./parserOpts')
4
+ const { createWriterOpts } = require('./writerOpts')
5
+ const { createConventionalChangelogOpts } = require('./conventionalChangelog')
6
+ const { createConventionalRecommendedBumpOpts } = require('./conventionalRecommendedBump')
7
+
8
+ async function createPreset () {
9
+ const parserOpts = createParserOpts()
10
+ const writerOpts = await createWriterOpts()
11
+ const recommendedBumpOpts = createConventionalRecommendedBumpOpts(parserOpts)
12
+ const conventionalChangelog = createConventionalChangelogOpts(parserOpts, writerOpts)
13
+
14
+ return {
10
15
  parserOpts,
16
+ writerOpts,
11
17
  recommendedBumpOpts,
12
- writerOpts
13
- }))
18
+ conventionalChangelog
19
+ }
20
+ }
21
+
22
+ module.exports = createPreset
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "conventional-changelog-angular",
3
- "version": "6.0.0",
3
+ "version": "7.0.0",
4
4
  "description": "conventional-changelog angular preset",
5
5
  "main": "index.js",
6
6
  "repository": {
@@ -13,16 +13,16 @@
13
13
  "preset"
14
14
  ],
15
15
  "files": [
16
- "conventional-changelog.js",
17
- "conventional-recommended-bump.js",
16
+ "conventionalChangelog.js",
17
+ "conventionalRecommendedBump.js",
18
18
  "index.js",
19
- "parser-opts.js",
20
- "writer-opts.js",
19
+ "parserOpts.js",
20
+ "writerOpts.js",
21
21
  "templates"
22
22
  ],
23
23
  "author": "Steve Mao",
24
24
  "engines": {
25
- "node": ">=14"
25
+ "node": ">=16"
26
26
  },
27
27
  "license": "ISC",
28
28
  "bugs": {
@@ -31,8 +31,5 @@
31
31
  "homepage": "https://github.com/conventional-changelog/conventional-changelog/tree/master/packages/conventional-changelog-angular#readme",
32
32
  "dependencies": {
33
33
  "compare-func": "^2.0.0"
34
- },
35
- "scripts": {
36
- "test-windows": "mocha --timeout 30000"
37
34
  }
38
35
  }
package/parserOpts.js ADDED
@@ -0,0 +1,17 @@
1
+ 'use strict'
2
+
3
+ function createParserOpts () {
4
+ return {
5
+ headerPattern: /^(\w*)(?:\((.*)\))?: (.*)$/,
6
+ headerCorrespondence: [
7
+ 'type',
8
+ 'scope',
9
+ 'subject'
10
+ ],
11
+ noteKeywords: ['BREAKING CHANGE'],
12
+ revertPattern: /^(?:Revert|revert:)\s"?([\s\S]+?)"?\s*This reverts commit (\w*)\./i,
13
+ revertCorrespondence: ['header', 'hash']
14
+ }
15
+ }
16
+
17
+ module.exports.createParserOpts = createParserOpts
@@ -4,22 +4,24 @@ const compareFunc = require('compare-func')
4
4
  const { readFile } = require('fs').promises
5
5
  const { resolve } = require('path')
6
6
 
7
- module.exports = Promise.all([
8
- readFile(resolve(__dirname, './templates/template.hbs'), 'utf-8'),
9
- readFile(resolve(__dirname, './templates/header.hbs'), 'utf-8'),
10
- readFile(resolve(__dirname, './templates/commit.hbs'), 'utf-8'),
11
- readFile(resolve(__dirname, './templates/footer.hbs'), 'utf-8')
12
- ])
13
- .then(([template, header, commit, footer]) => {
14
- const writerOpts = getWriterOpts()
7
+ async function createWriterOpts () {
8
+ const [template, header, commit, footer] = await Promise.all([
9
+ readFile(resolve(__dirname, './templates/template.hbs'), 'utf-8'),
10
+ readFile(resolve(__dirname, './templates/header.hbs'), 'utf-8'),
11
+ readFile(resolve(__dirname, './templates/commit.hbs'), 'utf-8'),
12
+ readFile(resolve(__dirname, './templates/footer.hbs'), 'utf-8')
13
+ ])
14
+ const writerOpts = getWriterOpts()
15
15
 
16
- writerOpts.mainTemplate = template
17
- writerOpts.headerPartial = header
18
- writerOpts.commitPartial = commit
19
- writerOpts.footerPartial = footer
16
+ writerOpts.mainTemplate = template
17
+ writerOpts.headerPartial = header
18
+ writerOpts.commitPartial = commit
19
+ writerOpts.footerPartial = footer
20
20
 
21
- return writerOpts
22
- })
21
+ return writerOpts
22
+ }
23
+
24
+ module.exports.createWriterOpts = createWriterOpts
23
25
 
24
26
  function getWriterOpts () {
25
27
  return {
@@ -1,10 +0,0 @@
1
- 'use strict'
2
-
3
- const parserOpts = require('./parser-opts')
4
- const writerOpts = require('./writer-opts')
5
-
6
- module.exports = Promise.all([parserOpts, writerOpts])
7
- .then(([parserOpts, writerOpts]) => ({
8
- parserOpts,
9
- writerOpts
10
- }))
@@ -1,32 +0,0 @@
1
- 'use strict'
2
-
3
- const parserOpts = require('./parser-opts')
4
-
5
- module.exports = {
6
- parserOpts,
7
-
8
- whatBump: (commits) => {
9
- let level = 2
10
- let breakings = 0
11
- let features = 0
12
-
13
- commits.forEach(commit => {
14
- if (commit.notes.length > 0) {
15
- breakings += commit.notes.length
16
- level = 0
17
- } else if (commit.type === 'feat') {
18
- features += 1
19
- if (level === 2) {
20
- level = 1
21
- }
22
- }
23
- })
24
-
25
- return {
26
- level: level,
27
- reason: breakings === 1
28
- ? `There is ${breakings} BREAKING CHANGE and ${features} features`
29
- : `There are ${breakings} BREAKING CHANGES and ${features} features`
30
- }
31
- }
32
- }
package/parser-opts.js DELETED
@@ -1,13 +0,0 @@
1
- 'use strict'
2
-
3
- module.exports = {
4
- headerPattern: /^(\w*)(?:\((.*)\))?: (.*)$/,
5
- headerCorrespondence: [
6
- 'type',
7
- 'scope',
8
- 'subject'
9
- ],
10
- noteKeywords: ['BREAKING CHANGE'],
11
- revertPattern: /^(?:Revert|revert:)\s"?([\s\S]+?)"?\s*This reverts commit (\w*)\./i,
12
- revertCorrespondence: ['header', 'hash']
13
- }