@semantic-release/release-notes-generator 6.0.10 → 6.1.1

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
@@ -11,7 +11,7 @@ Customizable release-notes-generator plugin for [semantic-release](https://githu
11
11
 
12
12
  ## Options
13
13
 
14
- By default `release-notes-generator` uses the `angular` format described in [Angular convention](https://github.com/conventional-changelog/conventional-changelog/blob/master/packages/conventional-changelog-angular/convention.md).
14
+ By default `release-notes-generator` uses the `angular` format described in [Angular convention](https://github.com/conventional-changelog/conventional-changelog/tree/master/packages/conventional-changelog-angular).
15
15
 
16
16
  Additional options can be set within the plugin definition in `package.json` to use a different commit format and to customize it:
17
17
 
@@ -38,7 +38,9 @@ Additional options can be set within the plugin definition in `package.json` to
38
38
  | `parserOpts` | Additional [conventional-commits-parser](https://github.com/conventional-changelog/conventional-changelog/tree/master/packages/conventional-commits-parser#conventionalcommitsparseroptions) options that will extends ones loaded by `preset` or `config`. See [Parser options](#parser-options). | - |
39
39
  | `writerOpts` | Additional [conventional-commits-writer](https://github.com/conventional-changelog/conventional-changelog/tree/master/packages/conventional-changelog-writer#options) options that will extends ones loaded by `preset` or `config`. See [Writer options](#writer-options). | - |
40
40
 
41
- **NOTE:** `options.config` will be overwritten by the values of preset. You should use either `preset` or `config`, but not both. Individual properties of `parserOpts` and `writerOpts` will overwrite ones loaded with `preset` or `config`.
41
+ **Note**: `config` will be overwritten by the values of `preset`. You should use either `preset` or `config`, but not both.
42
+
43
+ **Note**: Individual properties of `parserOpts` and `writerOpts` will override ones loaded with an explicitly set `preset` or `config`. If `preset` or `config` are not set, only the properties set in `parserOpts` and `writerOpts` will be used.
42
44
 
43
45
  ### Parser Options
44
46
 
package/index.js CHANGED
@@ -3,25 +3,28 @@ const {find} = require('lodash');
3
3
  const getStream = require('get-stream');
4
4
  const intoStream = require('into-stream');
5
5
  const gitUrlParse = require('git-url-parse');
6
- const conventionalCommitsParser = require('conventional-commits-parser').sync;
7
- const conventionalChangelogWriter = require('conventional-changelog-writer');
6
+ const parser = require('conventional-commits-parser').sync;
7
+ const writer = require('conventional-changelog-writer');
8
+ const filter = require('conventional-commits-filter');
8
9
  const debug = require('debug')('semantic-release:release-notes-generator');
9
10
  const loadChangelogConfig = require('./lib/load-changelog-config');
10
11
  const HOSTS_CONFIG = require('./lib/hosts-config');
11
12
 
12
13
  /**
13
- * Generate the changelog for all the commits since the last release.
14
+ * Generate the changelog for all the commits in `options.commits`.
14
15
  *
15
- * @param {Object} [pluginConfig={}] semantic-release configuration
16
- * @param {string} pluginConfig.preset conventional-changelog preset ('angular', 'atom', 'codemirror', 'ember', 'eslint', 'express', 'jquery', 'jscs', 'jshint')
17
- * @param {string} pluginConfig.config requierable npm package with a custom conventional-changelog preset
16
+ * @param {Object} [pluginConfig={}] semantic-release configuration.
17
+ * @param {String} pluginConfig.preset conventional-changelog preset ('angular', 'atom', 'codemirror', 'ember', 'eslint', 'express', 'jquery', 'jscs', 'jshint').
18
+ * @param {String} pluginConfig.config requierable npm package with a custom conventional-changelog preset
18
19
  * @param {Object} pluginConfig.parserOpts additional `conventional-changelog-parser` options that will overwrite ones loaded by `preset` or `config`.
19
20
  * @param {Object} pluginConfig.writerOpts additional `conventional-changelog-writer` options that will overwrite ones loaded by `preset` or `config`.
20
- * @param {Object} options semantic-release options
21
- * @param {Array<Object>} options.commits array of commits, each containing `hash` and `message`
22
- * @param {Object>} options.lastRelease last release with `gitHead` corresponding to the commit hash used to make the last release and `gitTag` corresponding to the git tag associated with `gitHead`
23
- * @param {Object>} options.nextRelease next release with `gitHead` corresponding to the commit hash used to make the release, the release `version` and `gitTag` corresponding to the git tag associated with `gitHead`
24
- * @param {Object} options.options.repositoryUrl git repository URL
21
+ * @param {Object} options semantic-release options.
22
+ * @param {Array<Object>} options.commits array of commits, each containing `hash` and `message`.
23
+ * @param {Object} options.lastRelease last release with `gitHead` corresponding to the commit hash used to make the last release and `gitTag` corresponding to the git tag associated with `gitHead`.
24
+ * @param {Object} options.nextRelease next release with `gitHead` corresponding to the commit hash used to make the release, the release `version` and `gitTag` corresponding to the git tag associated with `gitHead`.
25
+ * @param {Object} options.options.repositoryUrl git repository URL.
26
+ *
27
+ * @returns {String} the changelog for all the commits in `options.commits`.
25
28
  */
26
29
  async function releaseNotesGenerator(pluginConfig, {commits, lastRelease, nextRelease, options: {repositoryUrl}}) {
27
30
  const {parserOpts, writerOpts} = await loadChangelogConfig(pluginConfig);
@@ -31,10 +34,12 @@ async function releaseNotesGenerator(pluginConfig, {commits, lastRelease, nextRe
31
34
 
32
35
  const {issue, commit, referenceActions, issuePrefixes} =
33
36
  find(HOSTS_CONFIG, conf => conf.hostname === hostname) || HOSTS_CONFIG.default;
34
- const parsedCommits = commits.map(rawCommit => ({
35
- ...rawCommit,
36
- ...conventionalCommitsParser(rawCommit.message, {referenceActions, issuePrefixes, ...parserOpts}),
37
- }));
37
+ const parsedCommits = filter(
38
+ commits.map(rawCommit => ({
39
+ ...rawCommit,
40
+ ...parser(rawCommit.message, {referenceActions, issuePrefixes, ...parserOpts}),
41
+ }))
42
+ );
38
43
  const previousTag = lastRelease.gitTag || lastRelease.gitHead;
39
44
  const currentTag = nextRelease.gitTag || nextRelease.gitHead;
40
45
  const context = {
@@ -56,7 +61,7 @@ async function releaseNotesGenerator(pluginConfig, {commits, lastRelease, nextRe
56
61
  debug('previousTag: %o', previousTag);
57
62
  debug('currentTag: %o', currentTag);
58
63
 
59
- return getStream(intoStream.obj(parsedCommits).pipe(conventionalChangelogWriter(context, writerOpts)));
64
+ return getStream(intoStream.obj(parsedCommits).pipe(writer(context, writerOpts)));
60
65
  }
61
66
 
62
67
  module.exports = releaseNotesGenerator;
@@ -1,6 +1,5 @@
1
1
  const {promisify} = require('util');
2
2
  const importFrom = require('import-from');
3
- const {mergeWith} = require('lodash');
4
3
  const conventionalChangelogAngular = require('conventional-changelog-angular');
5
4
 
6
5
  /**
@@ -13,14 +12,14 @@ const conventionalChangelogAngular = require('conventional-changelog-angular');
13
12
  * @return {Promise<Object>} a `Promise` that resolve to the `conventional-changelog-core` config.
14
13
  */
15
14
  module.exports = async ({preset, config, parserOpts, writerOpts}) => {
16
- let loadedConfig = {};
15
+ let loadedConfig;
17
16
 
18
17
  if (preset) {
19
18
  const presetPackage = `conventional-changelog-${preset.toLowerCase()}`;
20
19
  loadedConfig = importFrom.silent(__dirname, presetPackage) || importFrom(process.cwd(), presetPackage);
21
20
  } else if (config) {
22
21
  loadedConfig = importFrom.silent(__dirname, config) || importFrom(process.cwd(), config);
23
- } else if (!parserOpts || !writerOpts) {
22
+ } else {
24
23
  loadedConfig = conventionalChangelogAngular;
25
24
  }
26
25
 
@@ -30,12 +29,8 @@ module.exports = async ({preset, config, parserOpts, writerOpts}) => {
30
29
  loadedConfig = await loadedConfig;
31
30
  }
32
31
 
33
- return mergeWith(
34
- {},
35
- !preset && !config && parserOpts ? {parserOpts} : {parserOpts: loadedConfig.parserOpts},
36
- {parserOpts},
37
- !preset && !config && writerOpts ? {writerOpts} : {writerOpts: loadedConfig.writerOpts},
38
- {writerOpts},
39
- (value, source) => (Array.isArray(value) ? source : undefined)
40
- );
32
+ return {
33
+ parserOpts: !preset && !config && parserOpts ? parserOpts : {...loadedConfig.parserOpts, ...parserOpts},
34
+ writerOpts: !preset && !config && writerOpts ? writerOpts : {...loadedConfig.writerOpts, ...writerOpts},
35
+ };
41
36
  };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@semantic-release/release-notes-generator",
3
3
  "description": "Customizable release-notes-generator plugin for semantic-release",
4
- "version": "6.0.10",
4
+ "version": "6.1.1",
5
5
  "author": "Pierre Vanduynslager (https://twitter.com/@pvdlg_)",
6
6
  "bugs": {
7
7
  "url": "https://github.com/semantic-release/release-notes-generator/issues"
@@ -16,12 +16,13 @@
16
16
  "Gregor Martynus (https://twitter.com/gr2m)"
17
17
  ],
18
18
  "dependencies": {
19
- "conventional-changelog-angular": "^3.0.6",
20
- "conventional-changelog-writer": "^3.0.9",
21
- "conventional-commits-parser": "^2.1.7",
19
+ "conventional-changelog-angular": "^5.0.0",
20
+ "conventional-changelog-writer": "^4.0.0",
21
+ "conventional-commits-filter": "^2.0.0",
22
+ "conventional-commits-parser": "^3.0.0",
22
23
  "debug": "^3.1.0",
23
24
  "get-stream": "^3.0.0",
24
- "git-url-parse": "^9.0.0",
25
+ "git-url-parse": "^10.0.1",
25
26
  "import-from": "^2.1.0",
26
27
  "into-stream": "^3.1.0",
27
28
  "lodash": "^4.17.4"
@@ -30,16 +31,16 @@
30
31
  "ava": "^0.25.0",
31
32
  "codecov": "^3.0.0",
32
33
  "commitizen": "^2.9.6",
33
- "conventional-changelog-atom": "^0.2.8",
34
- "conventional-changelog-ember": "^0.3.11",
35
- "conventional-changelog-eslint": "^1.0.9",
36
- "conventional-changelog-express": "^0.3.6",
37
- "conventional-changelog-jshint": "^0.3.8",
34
+ "conventional-changelog-atom": "^2.0.0",
35
+ "conventional-changelog-ember": "^2.0.0",
36
+ "conventional-changelog-eslint": "^3.0.0",
37
+ "conventional-changelog-express": "^2.0.0",
38
+ "conventional-changelog-jshint": "^2.0.0",
38
39
  "cz-conventional-changelog": "^2.0.0",
39
40
  "escape-string-regexp": "^1.0.5",
40
- "nyc": "^11.1.0",
41
+ "nyc": "^12.0.1",
41
42
  "semantic-release": "^15.0.0",
42
- "xo": "^0.20.0"
43
+ "xo": "^0.21.0"
43
44
  },
44
45
  "engines": {
45
46
  "node": ">=8.3"
@@ -74,7 +75,8 @@
74
75
  "all": true
75
76
  },
76
77
  "prettier": {
77
- "printWidth": 120
78
+ "printWidth": 120,
79
+ "trailingComma": "es5"
78
80
  },
79
81
  "publishConfig": {
80
82
  "access": "public",