@semantic-release/release-notes-generator 7.1.6 → 7.3.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 +14 -6
- package/index.js +30 -19
- package/lib/load-changelog-config.js +9 -8
- package/package.json +13 -7
package/README.md
CHANGED
|
@@ -53,15 +53,23 @@ With this example:
|
|
|
53
53
|
|
|
54
54
|
### Options
|
|
55
55
|
|
|
56
|
-
| Option
|
|
57
|
-
|
|
58
|
-
| `preset`
|
|
59
|
-
| `config`
|
|
60
|
-
| `parserOpts`
|
|
61
|
-
| `writerOpts`
|
|
56
|
+
| Option | Description | Default |
|
|
57
|
+
|------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------|
|
|
58
|
+
| `preset` | [conventional-changelog](https://github.com/conventional-changelog/conventional-changelog) preset (possible values: [`angular`](https://github.com/conventional-changelog/conventional-changelog/tree/master/packages/conventional-changelog-angular), [`atom`](https://github.com/conventional-changelog/conventional-changelog/tree/master/packages/conventional-changelog-atom), [`codemirror`](https://github.com/conventional-changelog/conventional-changelog/tree/master/packages/conventional-changelog-codemirror), [`ember`](https://github.com/conventional-changelog/conventional-changelog/tree/master/packages/conventional-changelog-ember), [`eslint`](https://github.com/conventional-changelog/conventional-changelog/tree/master/packages/conventional-changelog-eslint), [`express`](https://github.com/conventional-changelog/conventional-changelog/tree/master/packages/conventional-changelog-express), [`jquery`](https://github.com/conventional-changelog/conventional-changelog/tree/master/packages/conventional-changelog-jquery), [`jshint`](https://github.com/conventional-changelog/conventional-changelog/tree/master/packages/conventional-changelog-jshint)), [`conventionalcommits`](https://github.com/conventional-changelog/conventional-changelog/tree/master/packages/conventional-changelog-conventionalcommits). | [`angular`](https://github.com/conventional-changelog/conventional-changelog/tree/master/packages/conventional-changelog-angular) |
|
|
59
|
+
| `config` | NPM package name of a custom [conventional-changelog](https://github.com/conventional-changelog/conventional-changelog) preset. | - |
|
|
60
|
+
| `parserOpts` | Additional [conventional-commits-parser](https://github.com/conventional-changelog/conventional-changelog/tree/master/packages/conventional-commits-parser#conventionalcommitsparseroptions) options that will extends the ones loaded by `preset` or `config`. This is convenient to use a [conventional-changelog](https://github.com/conventional-changelog/conventional-changelog) preset with some customizations without having to create a new module. | - |
|
|
61
|
+
| `writerOpts` | Additional [conventional-commits-writer](https://github.com/conventional-changelog/conventional-changelog/tree/master/packages/conventional-changelog-writer#options) options that will extends the ones loaded by `preset` or `config`. This is convenient to use a [conventional-changelog](https://github.com/conventional-changelog/conventional-changelog) preset with some customizations without having to create a new module. | - |
|
|
62
|
+
| `host` | The host used to generate links to issues and commits. See [conventional-changelog-writer#host](https://github.com/conventional-changelog/conventional-changelog/tree/master/packages/conventional-changelog-writer#host). | The host from the [`repositoryurl` option](https://github.com/semantic-release/semantic-release/blob/master/docs/usage/configuration.md#repositoryurl). |
|
|
63
|
+
| `linkCompare` | Whether to include a link to compare changes since previous release in the release note. | `true` |
|
|
64
|
+
| `linkReferences` | Whether to include a link to issues and commits in the release note. See [conventional-changelog-writer#linkreferences](https://github.com/conventional-changelog/conventional-changelog/tree/master/packages/conventional-changelog-writer#linkreferences). | `true` |
|
|
65
|
+
| `commit` | Keyword used to generate commit links (formatted as `<host>/<owner>/<repository>/<commit>/<commit_sha>`). See [conventional-changelog-writer#commit](https://github.com/conventional-changelog/conventional-changelog/tree/master/packages/conventional-changelog-writer#commit). | `commits` for Bitbucket repositories, `commit` otherwise |
|
|
66
|
+
| `issue` | Keyword used to generate issue links (formatted as `<host>/<owner>/<repository>/<issue>/<issue_number>`). See [conventional-changelog-writer#issue](https://github.com/conventional-changelog/conventional-changelog/tree/master/packages/conventional-changelog-writer#issue). | `issue` for Bitbucket repositories, `issues` otherwise |
|
|
67
|
+
| `presetConfig` | Additional configuration passed to the [conventional-changelog](https://github.com/conventional-changelog/conventional-changelog) preset. Used for example with [conventional-changelog-conventionalcommits](https://github.com/conventional-changelog/conventional-changelog-config-spec/blob/master/versions/2.0.0/README.md). | - |
|
|
62
68
|
|
|
63
69
|
**Notes**: in order to use a `preset` it must be installed (for example to use the [eslint preset](https://github.com/conventional-changelog/conventional-changelog/tree/master/packages/conventional-changelog-eslint) you must install it with `npm install conventional-changelog-eslint -D`)
|
|
64
70
|
|
|
65
71
|
**Note**: `config` will be overwritten by the values of `preset`. You should use either `preset` or `config`, but not both.
|
|
66
72
|
|
|
67
73
|
**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.
|
|
74
|
+
|
|
75
|
+
**Note**: For presets that expects a configuration object, such as [`conventionalcommits`](https://github.com/conventional-changelog/conventional-changelog/tree/master/packages/conventional-changelog-conventionalcommits), the `presetConfig` option **must** be set.
|
package/index.js
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
const {URL, format} = require('url');
|
|
2
|
-
const {find} = require('lodash');
|
|
2
|
+
const {find, merge} = require('lodash');
|
|
3
3
|
const getStream = require('get-stream');
|
|
4
4
|
const intoStream = require('into-stream');
|
|
5
5
|
const parser = require('conventional-commits-parser').sync;
|
|
6
6
|
const writer = require('conventional-changelog-writer');
|
|
7
7
|
const filter = require('conventional-commits-filter');
|
|
8
|
+
const readPkgUp = require('read-pkg-up');
|
|
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');
|
|
@@ -26,7 +27,7 @@ const HOSTS_CONFIG = require('./lib/hosts-config');
|
|
|
26
27
|
* @returns {String} The changelog for all the commits in `context.commits`.
|
|
27
28
|
*/
|
|
28
29
|
async function generateNotes(pluginConfig, context) {
|
|
29
|
-
const {commits, lastRelease, nextRelease, options} = context;
|
|
30
|
+
const {commits, lastRelease, nextRelease, options, cwd} = context;
|
|
30
31
|
const repositoryUrl = options.repositoryUrl.replace(/\.git$/i, '');
|
|
31
32
|
const {parserOpts, writerOpts} = await loadChangelogConfig(pluginConfig, context);
|
|
32
33
|
|
|
@@ -47,24 +48,34 @@ async function generateNotes(pluginConfig, context) {
|
|
|
47
48
|
);
|
|
48
49
|
const previousTag = lastRelease.gitTag || lastRelease.gitHead;
|
|
49
50
|
const currentTag = nextRelease.gitTag || nextRelease.gitHead;
|
|
50
|
-
const
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
51
|
+
const {host: hostConfig, linkCompare, linkReferences, commit: commitConfig, issue: issueConfig} = pluginConfig;
|
|
52
|
+
const changelogContext = merge(
|
|
53
|
+
{
|
|
54
|
+
version: nextRelease.version,
|
|
55
|
+
host: format({protocol, hostname, port}),
|
|
56
|
+
owner,
|
|
57
|
+
repository,
|
|
58
|
+
previousTag,
|
|
59
|
+
currentTag,
|
|
60
|
+
linkCompare: currentTag && previousTag,
|
|
61
|
+
issue,
|
|
62
|
+
commit,
|
|
63
|
+
packageData: ((await readPkgUp({normalize: false, cwd})) || {}).package,
|
|
64
|
+
},
|
|
65
|
+
{host: hostConfig, linkCompare, linkReferences, commit: commitConfig, issue: issueConfig}
|
|
66
|
+
);
|
|
61
67
|
|
|
62
|
-
debug('version: %o',
|
|
63
|
-
debug('host: %o', hostname);
|
|
64
|
-
debug('owner: %o', owner);
|
|
65
|
-
debug('repository: %o', repository);
|
|
66
|
-
debug('previousTag: %o', previousTag);
|
|
67
|
-
debug('currentTag: %o', currentTag);
|
|
68
|
+
debug('version: %o', changelogContext.version);
|
|
69
|
+
debug('host: %o', changelogContext.hostname);
|
|
70
|
+
debug('owner: %o', changelogContext.owner);
|
|
71
|
+
debug('repository: %o', changelogContext.repository);
|
|
72
|
+
debug('previousTag: %o', changelogContext.previousTag);
|
|
73
|
+
debug('currentTag: %o', changelogContext.currentTag);
|
|
74
|
+
debug('host: %o', changelogContext.host);
|
|
75
|
+
debug('host: %o', changelogContext.host);
|
|
76
|
+
debug('linkReferences: %o', changelogContext.linkReferences);
|
|
77
|
+
debug('issue: %o', changelogContext.issue);
|
|
78
|
+
debug('commit: %o', changelogContext.commit);
|
|
68
79
|
|
|
69
80
|
return getStream(intoStream.object(parsedCommits).pipe(writer(changelogContext, writerOpts)));
|
|
70
81
|
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
const {promisify} = require('util');
|
|
2
|
+
const {isPlainObject} = require('lodash');
|
|
2
3
|
const importFrom = require('import-from');
|
|
3
4
|
const conventionalChangelogAngular = require('conventional-changelog-angular');
|
|
4
5
|
|
|
@@ -16,7 +17,7 @@ const conventionalChangelogAngular = require('conventional-changelog-angular');
|
|
|
16
17
|
*
|
|
17
18
|
* @return {Promise<Object>} a `Promise` that resolve to the `conventional-changelog-core` config.
|
|
18
19
|
*/
|
|
19
|
-
module.exports = async ({preset, config, parserOpts, writerOpts}, {cwd}) => {
|
|
20
|
+
module.exports = async ({preset, config, parserOpts, writerOpts, presetConfig}, {cwd}) => {
|
|
20
21
|
let loadedConfig;
|
|
21
22
|
|
|
22
23
|
if (preset) {
|
|
@@ -28,14 +29,14 @@ module.exports = async ({preset, config, parserOpts, writerOpts}, {cwd}) => {
|
|
|
28
29
|
loadedConfig = conventionalChangelogAngular;
|
|
29
30
|
}
|
|
30
31
|
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
32
|
+
loadedConfig = await (typeof loadedConfig === 'function'
|
|
33
|
+
? isPlainObject(presetConfig)
|
|
34
|
+
? loadedConfig(presetConfig)
|
|
35
|
+
: promisify(loadedConfig)()
|
|
36
|
+
: loadedConfig);
|
|
36
37
|
|
|
37
38
|
return {
|
|
38
|
-
parserOpts:
|
|
39
|
-
writerOpts:
|
|
39
|
+
parserOpts: {...loadedConfig.parserOpts, ...parserOpts},
|
|
40
|
+
writerOpts: {...loadedConfig.writerOpts, ...writerOpts},
|
|
40
41
|
};
|
|
41
42
|
};
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@semantic-release/release-notes-generator",
|
|
3
3
|
"description": "semantic-release plugin to generate changelog content with conventional-changelog",
|
|
4
|
-
"version": "7.
|
|
4
|
+
"version": "7.3.0",
|
|
5
5
|
"author": "Pierre Vanduynslager (https://twitter.com/@pvdlg_)",
|
|
6
6
|
"bugs": {
|
|
7
7
|
"url": "https://github.com/semantic-release/release-notes-generator/issues"
|
|
@@ -22,23 +22,29 @@
|
|
|
22
22
|
"conventional-commits-parser": "^3.0.0",
|
|
23
23
|
"debug": "^4.0.0",
|
|
24
24
|
"get-stream": "^5.0.0",
|
|
25
|
-
"import-from": "^
|
|
25
|
+
"import-from": "^3.0.0",
|
|
26
26
|
"into-stream": "^5.0.0",
|
|
27
|
-
"lodash": "^4.17.4"
|
|
27
|
+
"lodash": "^4.17.4",
|
|
28
|
+
"read-pkg-up": "^6.0.0"
|
|
28
29
|
},
|
|
29
30
|
"devDependencies": {
|
|
30
|
-
"ava": "^
|
|
31
|
+
"ava": "^2.0.0",
|
|
31
32
|
"codecov": "^3.0.0",
|
|
32
|
-
"commitizen": "^
|
|
33
|
+
"commitizen": "^4.0.0",
|
|
33
34
|
"conventional-changelog-atom": "^2.0.0",
|
|
35
|
+
"conventional-changelog-conventionalcommits": "^4.1.0",
|
|
34
36
|
"conventional-changelog-ember": "^2.0.0",
|
|
35
37
|
"conventional-changelog-eslint": "^3.0.0",
|
|
36
38
|
"conventional-changelog-express": "^2.0.0",
|
|
37
39
|
"conventional-changelog-jshint": "^2.0.0",
|
|
38
40
|
"cz-conventional-changelog": "^2.0.0",
|
|
39
|
-
"escape-string-regexp": "^
|
|
40
|
-
"
|
|
41
|
+
"escape-string-regexp": "^2.0.0",
|
|
42
|
+
"fs-extra": "^8.0.1",
|
|
43
|
+
"nyc": "^14.0.0",
|
|
44
|
+
"proxyquire": "^2.1.0",
|
|
41
45
|
"semantic-release": "^15.0.0",
|
|
46
|
+
"sinon": "^7.3.2",
|
|
47
|
+
"tempy": "^0.3.0",
|
|
42
48
|
"xo": "^0.24.0"
|
|
43
49
|
},
|
|
44
50
|
"engines": {
|