conventional-changelog-conventionalcommits 4.2.2 → 4.4.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/CHANGELOG.md CHANGED
@@ -3,6 +3,51 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ # [4.4.0](https://github.com/conventional-changelog/conventional-changelog/compare/conventional-changelog-conventionalcommits@4.3.1...conventional-changelog-conventionalcommits@4.4.0) (2020-08-12)
7
+
8
+
9
+ ### Features
10
+
11
+ * **templates:** if hash is nullish, do not display in CHANGELOG ([#664](https://github.com/conventional-changelog/conventional-changelog/issues/664)) ([f10256c](https://github.com/conventional-changelog/conventional-changelog/commit/f10256c635687de0a85c4db2bf06292902924f77))
12
+
13
+
14
+
15
+
16
+
17
+ ## [4.3.1](https://github.com/conventional-changelog/conventional-changelog/compare/conventional-changelog-conventionalcommits@4.3.0...conventional-changelog-conventionalcommits@4.3.1) (2020-06-20)
18
+
19
+
20
+ ### Bug Fixes
21
+
22
+ * **deps:** update dependency compare-func to v2 ([#647](https://github.com/conventional-changelog/conventional-changelog/issues/647)) ([de4f630](https://github.com/conventional-changelog/conventional-changelog/commit/de4f6309403ca0d46b7c6235052f4dca61ea15bc))
23
+ * pass config to parserOpts and writerOpts ([73c7a1b](https://github.com/conventional-changelog/conventional-changelog/commit/73c7a1b92c2a47c498f42972acbffa156172a341))
24
+
25
+
26
+
27
+
28
+
29
+ # [4.3.0](https://github.com/conventional-changelog/conventional-changelog/compare/conventional-changelog-conventionalcommits@4.2.3...conventional-changelog-conventionalcommits@4.3.0) (2020-05-08)
30
+
31
+
32
+ ### Features
33
+
34
+ * add support for 'feature' as alias for 'feat' ([#582](https://github.com/conventional-changelog/conventional-changelog/issues/582)) ([94c40f7](https://github.com/conventional-changelog/conventional-changelog/commit/94c40f755e6c329311d89a47c634b91cf0276da3))
35
+
36
+
37
+
38
+
39
+
40
+ ## [4.2.3](https://github.com/conventional-changelog/conventional-changelog/compare/conventional-changelog-conventionalcommits@4.2.2...conventional-changelog-conventionalcommits@4.2.3) (2019-11-07)
41
+
42
+
43
+ ### Bug Fixes
44
+
45
+ * revertPattern match default git revert format ([#545](https://github.com/conventional-changelog/conventional-changelog/issues/545)) ([fe449f8](https://github.com/conventional-changelog/conventional-changelog/commit/fe449f899567574a36d1819b313e2caa899052ff))
46
+
47
+
48
+
49
+
50
+
6
51
  ## [4.2.2](https://github.com/conventional-changelog/conventional-changelog/compare/conventional-changelog-conventionalcommits@4.2.1...conventional-changelog-conventionalcommits@4.2.2) (2019-10-24)
7
52
 
8
53
 
package/README.md CHANGED
@@ -6,6 +6,40 @@ A concrete implementation of the specification described at
6
6
  [conventionalcommits.org](https://conventionalcommits.org/) for automated
7
7
  CHANGELOG generation and version management.
8
8
 
9
+
10
+ ## Indirect Usage (as preset)
11
+
12
+ Use the [Conventional Changelog CLI Quick Start](https://github.com/conventional-changelog/conventional-changelog/tree/master/packages/conventional-changelog-cli#quick-start) with the `-p conventionalcommits` option.
13
+
14
+ ## Direct Usage (as a base preset so you can customize it)
15
+
16
+ If you want to use this package directly and pass options, you can use the [Conventional Changelog CLI Quick Start](https://github.com/conventional-changelog/conventional-changelog/tree/master/packages/conventional-changelog-cli#quick-start) and with the `--config` or `-n` parameter, pass a js config that looks like this
17
+ ```
18
+ 'use strict'
19
+ const config = require('conventional-changelog-conventionalcommits')
20
+
21
+ module.exports = config({
22
+ "issuePrefixes": ["TEST-"],
23
+ "issueUrlFormat": "myBugTracker.com/{prefix}{id}"
24
+ })
25
+ ```
26
+
27
+ or json config like that:
28
+ ```
29
+ {
30
+ "options": {
31
+ "preset": {
32
+ "name": "conventionalchangelog",
33
+ "issuePrefixes": ["TEST-"],
34
+ "issueUrlFormat": "myBugTracker.com/{prefix}{id}"
35
+ }
36
+ }
37
+ }
38
+ ```
39
+ This last json config way passes the `preset` object to the `conventional-changelog-preset-loader` package, that in turn, passes this same `preset` object as the config for the `conventional-changelog-conventionalcommits`.
40
+
41
+
42
+
9
43
  See [conventional-changelog-config-spec](https://github.com/conventional-changelog/conventional-changelog-config-spec) for available
10
44
  configuration options.
11
45
 
@@ -1,11 +1,11 @@
1
1
  'use strict'
2
2
 
3
- const Q = require(`q`)
4
- const parserOpts = require(`./parser-opts`)
5
- const writerOpts = require(`./writer-opts`)
3
+ const Q = require('q')
4
+ const parserOpts = require('./parser-opts')
5
+ const writerOpts = require('./writer-opts')
6
6
 
7
7
  module.exports = function (config) {
8
- return Q.all([parserOpts, writerOpts])
8
+ return Q.all([parserOpts(config), writerOpts(config)])
9
9
  .spread((parserOpts, writerOpts) => {
10
10
  return { parserOpts, writerOpts }
11
11
  })
@@ -1,7 +1,7 @@
1
1
  'use strict'
2
2
 
3
3
  const addBangNotes = require('./add-bang-notes')
4
- const parserOpts = require(`./parser-opts`)
4
+ const parserOpts = require('./parser-opts')
5
5
 
6
6
  module.exports = function (config) {
7
7
  return {
@@ -20,7 +20,7 @@ module.exports = function (config) {
20
20
  if (commit.notes.length > 0) {
21
21
  breakings += commit.notes.length
22
22
  level = 0
23
- } else if (commit.type === `feat`) {
23
+ } else if (commit.type === 'feat' || commit.type === 'feature') {
24
24
  features += 1
25
25
  if (level === 2) {
26
26
  level = 1
package/index.js CHANGED
@@ -1,10 +1,10 @@
1
1
  'use strict'
2
- const Q = require(`q`)
3
- const _ = require(`lodash`)
4
- const conventionalChangelog = require(`./conventional-changelog`)
5
- const parserOpts = require(`./parser-opts`)
6
- const recommendedBumpOpts = require(`./conventional-recommended-bump`)
7
- const writerOpts = require(`./writer-opts`)
2
+ const Q = require('q')
3
+ const _ = require('lodash')
4
+ const conventionalChangelog = require('./conventional-changelog')
5
+ const parserOpts = require('./parser-opts')
6
+ const recommendedBumpOpts = require('./conventional-recommended-bump')
7
+ const writerOpts = require('./writer-opts')
8
8
 
9
9
  module.exports = function (parameter) {
10
10
  // parameter passed can be either a config object or a callback function
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "conventional-changelog-conventionalcommits",
3
- "version": "4.2.2",
3
+ "version": "4.4.0",
4
4
  "description": "conventional-changelog conventionalcommits.org preset",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -26,7 +26,7 @@
26
26
  ],
27
27
  "author": "Ben Coe",
28
28
  "engines": {
29
- "node": ">=6.9.0"
29
+ "node": ">=10"
30
30
  },
31
31
  "license": "ISC",
32
32
  "bugs": {
@@ -34,9 +34,9 @@
34
34
  },
35
35
  "homepage": "https://github.com/conventional-changelog/conventional-changelog/tree/master/packages/conventional-changelog-angular#readme",
36
36
  "dependencies": {
37
- "compare-func": "^1.3.1",
37
+ "compare-func": "^2.0.0",
38
38
  "lodash": "^4.17.15",
39
39
  "q": "^1.5.1"
40
40
  },
41
- "gitHead": "e865af4df8d06795cebc7af09364ade19119e089"
41
+ "gitHead": "be1246c68f5dc4e6f28996129951a75bbf1cf307"
42
42
  }
package/parser-opts.js CHANGED
@@ -6,13 +6,13 @@ module.exports = function (config) {
6
6
  headerPattern: /^(\w*)(?:\((.*)\))?!?: (.*)$/,
7
7
  breakingHeaderPattern: /^(\w*)(?:\((.*)\))?!: (.*)$/,
8
8
  headerCorrespondence: [
9
- `type`,
10
- `scope`,
11
- `subject`
9
+ 'type',
10
+ 'scope',
11
+ 'subject'
12
12
  ],
13
- noteKeywords: [`BREAKING CHANGE`],
14
- revertPattern: /^revert:\s([\s\S]*?)\s*This reverts commit (\w*)\./,
15
- revertCorrespondence: [`header`, `hash`],
13
+ noteKeywords: ['BREAKING CHANGE'],
14
+ revertPattern: /^(?:Revert|revert:)\s"?([\s\S]+?)"?\s*This reverts commit (\w*)\./i,
15
+ revertCorrespondence: ['header', 'hash'],
16
16
  issuePrefixes: config.issuePrefixes
17
17
  }
18
18
  }
@@ -5,11 +5,11 @@
5
5
  {{~header}}
6
6
  {{~/if}}
7
7
 
8
- {{~!-- commit link --}} {{#if @root.linkReferences~}}
8
+ {{~!-- commit link --}}{{~#if hash}} {{#if @root.linkReferences~}}
9
9
  ([{{shortHash}}]({{commitUrlFormat}}))
10
10
  {{~else}}
11
11
  {{~shortHash}}
12
- {{~/if}}
12
+ {{~/if}}{{~/if}}
13
13
 
14
14
  {{~!-- commit references --}}
15
15
  {{~#if references~}}
package/writer-opts.js CHANGED
@@ -1,10 +1,10 @@
1
1
  'use strict'
2
2
 
3
3
  const addBangNotes = require('./add-bang-notes')
4
- const compareFunc = require(`compare-func`)
5
- const Q = require(`q`)
6
- const readFile = Q.denodeify(require(`fs`).readFile)
7
- const resolve = require(`path`).resolve
4
+ const compareFunc = require('compare-func')
5
+ const Q = require('q')
6
+ const readFile = Q.denodeify(require('fs').readFile)
7
+ const resolve = require('path').resolve
8
8
 
9
9
  /**
10
10
  * Handlebar partials for various property substitutions based on commit context.
@@ -34,10 +34,10 @@ module.exports = function (config) {
34
34
  })
35
35
 
36
36
  return Q.all([
37
- readFile(resolve(__dirname, `./templates/template.hbs`), `utf-8`),
38
- readFile(resolve(__dirname, `./templates/header.hbs`), `utf-8`),
39
- readFile(resolve(__dirname, `./templates/commit.hbs`), `utf-8`),
40
- readFile(resolve(__dirname, `./templates/footer.hbs`), `utf-8`)
37
+ readFile(resolve(__dirname, './templates/template.hbs'), 'utf-8'),
38
+ readFile(resolve(__dirname, './templates/header.hbs'), 'utf-8'),
39
+ readFile(resolve(__dirname, './templates/commit.hbs'), 'utf-8'),
40
+ readFile(resolve(__dirname, './templates/footer.hbs'), 'utf-8')
41
41
  ])
42
42
  .spread((template, header, commit, footer) => {
43
43
  const writerOpts = getWriterOpts(config)
@@ -65,7 +65,7 @@ function getWriterOpts (config) {
65
65
  transform: (commit, context) => {
66
66
  let discard = true
67
67
  const issues = []
68
- const typeKey = (commit.type || '').toLowerCase()
68
+ const typeKey = (commit.revert ? 'revert' : (commit.type || '')).toLowerCase()
69
69
 
70
70
  // adds additional breaking change notes
71
71
  // for the special case, test(system)!: hello world, where there is
@@ -73,7 +73,7 @@ function getWriterOpts (config) {
73
73
  addBangNotes(commit)
74
74
 
75
75
  commit.notes.forEach(note => {
76
- note.title = `BREAKING CHANGES`
76
+ note.title = 'BREAKING CHANGES'
77
77
  discard = false
78
78
  })
79
79
 
@@ -83,19 +83,19 @@ function getWriterOpts (config) {
83
83
 
84
84
  if (typesLookup[typeKey]) commit.type = typesLookup[typeKey].section
85
85
 
86
- if (commit.scope === `*`) {
87
- commit.scope = ``
86
+ if (commit.scope === '*') {
87
+ commit.scope = ''
88
88
  }
89
89
 
90
- if (typeof commit.hash === `string`) {
90
+ if (typeof commit.hash === 'string') {
91
91
  commit.shortHash = commit.hash.substring(0, 7)
92
92
  }
93
93
 
94
- if (typeof commit.subject === `string`) {
94
+ if (typeof commit.subject === 'string') {
95
95
  // Issue URLs.
96
96
  config.issuePrefixes.join('|')
97
- let issueRegEx = '(' + config.issuePrefixes.join('|') + ')' + '([0-9]+)'
98
- let re = new RegExp(issueRegEx, 'g')
97
+ const issueRegEx = '(' + config.issuePrefixes.join('|') + ')' + '([0-9]+)'
98
+ const re = new RegExp(issueRegEx, 'g')
99
99
 
100
100
  commit.subject = commit.subject.replace(re, (_, prefix, issue) => {
101
101
  issues.push(prefix + issue)
@@ -137,7 +137,7 @@ function getWriterOpts (config) {
137
137
 
138
138
  return commit
139
139
  },
140
- groupBy: `type`,
140
+ groupBy: 'type',
141
141
  // the groupings of commit messages, e.g., Features vs., Bug Fixes, are
142
142
  // sorted based on their probable importance:
143
143
  commitGroupsSort: (a, b) => {
@@ -150,8 +150,8 @@ function getWriterOpts (config) {
150
150
  return 1
151
151
  }
152
152
  },
153
- commitsSort: [`scope`, `subject`],
154
- noteGroupsSort: `title`,
153
+ commitsSort: ['scope', 'subject'],
154
+ noteGroupsSort: 'title',
155
155
  notesSort: compareFunc
156
156
  }
157
157
  }
@@ -161,6 +161,7 @@ function defaultConfig (config) {
161
161
  config = config || {}
162
162
  config.types = config.types || [
163
163
  { type: 'feat', section: 'Features' },
164
+ { type: 'feature', section: 'Features' },
164
165
  { type: 'fix', section: 'Bug Fixes' },
165
166
  { type: 'perf', section: 'Performance Improvements' },
166
167
  { type: 'revert', section: 'Reverts' },