1
- const { format} = require ( 'url' ) ;
2
- const { find, merge} = require ( 'lodash' ) ;
3
- const getStream = require ( 'get-stream' ) ;
4
- const intoStream = require ( 'into-stream' ) ;
5
- const parser = require ( 'conventional-commits-parser' ) . sync ;
6
- const writer = require ( 'conventional-changelog-writer' ) ;
7
- const filter = require ( 'conventional-commits-filter' ) ;
8
- const readPkgUp = require ( 'read-pkg-up' ) ;
9
- const debug = require ( 'debug' ) ( 'semantic-release:release-notes-generator' ) ;
10
- const loadChangelogConfig = require ( './lib/load-changelog-config.js' ) ;
11
- const HOSTS_CONFIG = require ( './lib/hosts-config.js' ) ;
1
+ import { format } from 'url' ;
2
+ import { find , merge } from 'lodash-es' ;
3
+ import getStream from 'get-stream' ;
4
+ import intoStream from 'into-stream' ;
5
+ import { sync as parser } from 'conventional-commits-parser' ;
6
+ import writer from 'conventional-changelog-writer' ;
7
+ import filter from 'conventional-commits-filter' ;
8
+ import { readPackageUp } from 'read-pkg-up' ;
9
+ import debugFactory from 'debug' ;
10
+ import loadChangelogConfig from './lib/load-changelog-config.js' ;
11
+ import HOSTS_CONFIG from './lib/hosts-config.js' ;
12
+
13
+ const debug = debugFactory ( 'semantic-release:release-notes-generator' ) ;
12
14
13
15
/**
14
16
* Generate the changelog for all the commits in `options.commits`.
@@ -26,7 +28,7 @@ const HOSTS_CONFIG = require('./lib/hosts-config.js');
26
28
*
27
29
* @returns {String } The changelog for all the commits in `context.commits`.
28
30
*/
29
- async function generateNotes ( pluginConfig , context ) {
31
+ export async function generateNotes ( pluginConfig , context ) {
30
32
const { commits, lastRelease, nextRelease, options, cwd} = context ;
31
33
const repositoryUrl = options . repositoryUrl . replace ( / \. g i t $ / i, '' ) ;
32
34
const { parserOpts, writerOpts} = await loadChangelogConfig ( pluginConfig , context ) ;
@@ -70,7 +72,7 @@ async function generateNotes(pluginConfig, context) {
70
72
linkCompare : currentTag && previousTag ,
71
73
issue,
72
74
commit,
73
- packageData : ( ( await readPkgUp ( { normalize : false , cwd} ) ) || { } ) . packageJson ,
75
+ packageData : ( ( await readPackageUp ( { normalize : false , cwd} ) ) || { } ) . packageJson ,
74
76
} ,
75
77
{ host : hostConfig , linkCompare, linkReferences, commit : commitConfig , issue : issueConfig }
76
78
) ;
@@ -86,7 +88,6 @@ async function generateNotes(pluginConfig, context) {
86
88
debug ( 'issue: %o' , changelogContext . issue ) ;
87
89
debug ( 'commit: %o' , changelogContext . commit ) ;
88
90
91
+ console . log ( { writer} )
89
92
return getStream ( intoStream . object ( parsedCommits ) . pipe ( writer ( changelogContext , writerOpts ) ) ) ;
90
93
}
91
-
92
- module . exports = { generateNotes} ;
0 commit comments