1 | import conventionalChangelogCore from 'conventional-changelog-core'
|
2 | import { loadPreset } from 'conventional-changelog-preset-loader'
|
3 |
|
4 | export default function conventionalChangelog (options, context, gitRawCommitsOpts, parserOpts, writerOpts) {
|
5 | options.warn = options.warn || function () {}
|
6 |
|
7 | if (options.preset) {
|
8 | try {
|
9 | options.config = loadPreset(options.preset)
|
10 | } catch (err) {
|
11 | if (typeof options.preset === 'object') {
|
12 | options.warn(`Preset: "${options.preset.name}" ${err.message}`)
|
13 | } else if (typeof options.preset === 'string') {
|
14 | options.warn(`Preset: "${options.preset}" ${err.message}`)
|
15 | } else {
|
16 | options.warn(`Preset: ${err.message}`)
|
17 | }
|
18 | }
|
19 | }
|
20 |
|
21 | return conventionalChangelogCore(options, context, gitRawCommitsOpts, parserOpts, writerOpts)
|
22 | }
|