@semantic-release/release-notes-generator 6.1.1 → 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/index.js +20 -14
- package/lib/load-changelog-config.js +12 -7
- package/package.json +4 -1
package/index.js
CHANGED
|
@@ -13,21 +13,27 @@ const HOSTS_CONFIG = require('./lib/hosts-config');
|
|
|
13
13
|
/**
|
|
14
14
|
* Generate the changelog for all the commits in `options.commits`.
|
|
15
15
|
*
|
|
16
|
-
* @param {Object}
|
|
16
|
+
* @param {Object} pluginConfig The plugin configuration.
|
|
17
17
|
* @param {String} pluginConfig.preset conventional-changelog preset ('angular', 'atom', 'codemirror', 'ember', 'eslint', 'express', 'jquery', 'jscs', 'jshint').
|
|
18
|
-
* @param {String} pluginConfig.config
|
|
19
|
-
* @param {Object} pluginConfig.parserOpts
|
|
20
|
-
* @param {Object} pluginConfig.writerOpts
|
|
21
|
-
* @param {Object}
|
|
22
|
-
* @param {Array<Object>}
|
|
23
|
-
* @param {Object}
|
|
24
|
-
* @param {Object}
|
|
25
|
-
* @param {Object}
|
|
18
|
+
* @param {String} pluginConfig.config Requierable npm package with a custom conventional-changelog preset
|
|
19
|
+
* @param {Object} pluginConfig.parserOpts Additional `conventional-changelog-parser` options that will overwrite ones loaded by `preset` or `config`.
|
|
20
|
+
* @param {Object} pluginConfig.writerOpts Additional `conventional-changelog-writer` options that will overwrite ones loaded by `preset` or `config`.
|
|
21
|
+
* @param {Object} context The semantic-release context.
|
|
22
|
+
* @param {Array<Object>} context.commits The commits to analyze.
|
|
23
|
+
* @param {Object} context.lastRelease The 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} context.nextRelease The 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} context.options.repositoryUrl The git repository URL.
|
|
26
26
|
*
|
|
27
|
-
* @returns {String}
|
|
27
|
+
* @returns {String} The changelog for all the commits in `context.commits`.
|
|
28
28
|
*/
|
|
29
|
-
async function releaseNotesGenerator(pluginConfig,
|
|
30
|
-
const {
|
|
29
|
+
async function releaseNotesGenerator(pluginConfig, context) {
|
|
30
|
+
const {
|
|
31
|
+
commits,
|
|
32
|
+
lastRelease,
|
|
33
|
+
nextRelease,
|
|
34
|
+
options: {repositoryUrl},
|
|
35
|
+
} = context;
|
|
36
|
+
const {parserOpts, writerOpts} = await loadChangelogConfig(pluginConfig, context);
|
|
31
37
|
|
|
32
38
|
const {resource: hostname, port, name: repository, owner, protocols} = gitUrlParse(repositoryUrl);
|
|
33
39
|
const protocol = protocols.includes('https') ? 'https' : protocols.includes('http') ? 'http' : 'https';
|
|
@@ -42,7 +48,7 @@ async function releaseNotesGenerator(pluginConfig, {commits, lastRelease, nextRe
|
|
|
42
48
|
);
|
|
43
49
|
const previousTag = lastRelease.gitTag || lastRelease.gitHead;
|
|
44
50
|
const currentTag = nextRelease.gitTag || nextRelease.gitHead;
|
|
45
|
-
const
|
|
51
|
+
const changelogContext = {
|
|
46
52
|
version: nextRelease.version,
|
|
47
53
|
host: url.format({protocol, hostname, port}),
|
|
48
54
|
owner,
|
|
@@ -61,7 +67,7 @@ async function releaseNotesGenerator(pluginConfig, {commits, lastRelease, nextRe
|
|
|
61
67
|
debug('previousTag: %o', previousTag);
|
|
62
68
|
debug('currentTag: %o', currentTag);
|
|
63
69
|
|
|
64
|
-
return getStream(intoStream.obj(parsedCommits).pipe(writer(
|
|
70
|
+
return getStream(intoStream.obj(parsedCommits).pipe(writer(changelogContext, writerOpts)));
|
|
65
71
|
}
|
|
66
72
|
|
|
67
73
|
module.exports = releaseNotesGenerator;
|
|
@@ -5,20 +5,25 @@ const conventionalChangelogAngular = require('conventional-changelog-angular');
|
|
|
5
5
|
/**
|
|
6
6
|
* Load `conventional-changelog-parser` options. Handle presets that return either a `Promise<Array>` or a `Promise<Function>`.
|
|
7
7
|
*
|
|
8
|
-
* @param {Object}
|
|
9
|
-
* @param {
|
|
10
|
-
* @param {
|
|
11
|
-
* @param {Object}
|
|
8
|
+
* @param {Object} pluginConfig The plugin configuration.
|
|
9
|
+
* @param {Object} pluginConfig.preset conventional-changelog preset ('angular', 'atom', 'codemirror', 'ember', 'eslint', 'express', 'jquery', 'jscs', 'jshint')
|
|
10
|
+
* @param {string} pluginConfig.config Requierable npm package with a custom conventional-changelog preset
|
|
11
|
+
* @param {Object} pluginConfig.parserOpts Additionnal `conventional-changelog-parser` options that will overwrite ones loaded by `preset` or `config`.
|
|
12
|
+
* @param {Object} pluginConfig.writerOpts Additionnal `conventional-changelog-writer` options that will overwrite ones loaded by `preset` or `config`.
|
|
13
|
+
* @param {Object} context The semantic-release context.
|
|
14
|
+
* @param {Array<Object>} context.commits The commits to analyze.
|
|
15
|
+
* @param {String} context.cwd The current working directory.
|
|
16
|
+
*
|
|
12
17
|
* @return {Promise<Object>} a `Promise` that resolve to the `conventional-changelog-core` config.
|
|
13
18
|
*/
|
|
14
|
-
module.exports = async ({preset, config, parserOpts, writerOpts}) => {
|
|
19
|
+
module.exports = async ({preset, config, parserOpts, writerOpts}, {cwd}) => {
|
|
15
20
|
let loadedConfig;
|
|
16
21
|
|
|
17
22
|
if (preset) {
|
|
18
23
|
const presetPackage = `conventional-changelog-${preset.toLowerCase()}`;
|
|
19
|
-
loadedConfig = importFrom.silent(__dirname, presetPackage) || importFrom(
|
|
24
|
+
loadedConfig = importFrom.silent(__dirname, presetPackage) || importFrom(cwd, presetPackage);
|
|
20
25
|
} else if (config) {
|
|
21
|
-
loadedConfig = importFrom.silent(__dirname, config) || importFrom(
|
|
26
|
+
loadedConfig = importFrom.silent(__dirname, config) || importFrom(cwd, config);
|
|
22
27
|
} else {
|
|
23
28
|
loadedConfig = conventionalChangelogAngular;
|
|
24
29
|
}
|
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": "
|
|
4
|
+
"version": "7.0.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"
|
|
@@ -74,6 +74,9 @@
|
|
|
74
74
|
],
|
|
75
75
|
"all": true
|
|
76
76
|
},
|
|
77
|
+
"peerDependencies": {
|
|
78
|
+
"semantic-release": ">=15.8.0 <16.0.0"
|
|
79
|
+
},
|
|
77
80
|
"prettier": {
|
|
78
81
|
"printWidth": 120,
|
|
79
82
|
"trailingComma": "es5"
|