@@ -22,7 +22,6 @@ import type {
22
22
CommitGroup ,
23
23
GeneratedContext
24
24
} from 'conventional-changelog-writer'
25
- import type { ICommit } from 'conventional-commits-parser'
26
25
import dateformat from 'dateformat'
27
26
import type mri from 'mri'
28
27
import {
@@ -38,6 +37,16 @@ import semver from 'semver'
38
37
import tempfile from 'tempfile'
39
38
import pkg from '../package.json' assert { type : 'json' }
40
39
40
+ /**
41
+ * Parsed commit with additional fields.
42
+ *
43
+ * @extends {Commit }
44
+ */
45
+ interface CommitEnhanced extends Commit {
46
+ raw : Commit
47
+ version ?: string
48
+ }
49
+
41
50
/**
42
51
* CLI flags.
43
52
*/
@@ -235,11 +244,11 @@ sade('changelog', true)
235
244
*
236
245
* @see https://github.com/conventional-changelog/conventional-changelog/tree/master/packages/conventional-changelog-writer#commitssort
237
246
*
238
- * @param {ICommit } a - Commit object
239
- * @param {ICommit } b - Commit object to compare to `b`
247
+ * @param {Commit } a - Commit object
248
+ * @param {Commit } b - Commit object to compare to `b`
240
249
* @return {number } Compare result
241
250
*/
242
- commitsSort ( a : ICommit , b : ICommit ) : number {
251
+ commitsSort ( a : Commit , b : Commit ) : number {
243
252
/**
244
253
* Compare result for {@linkcode b.committerDate} and
245
254
* {@linkcode a.committerDate}.
@@ -269,32 +278,32 @@ sade('changelog', true)
269
278
*
270
279
* @param {GeneratedContext } context - Generated changelog context
271
280
* @param {Options } options - `conventional-changelog-core` options
272
- * @param {ICommit [] } commits - Commits for release
273
- * @param {ICommit | undefined } key - Release commit
281
+ * @param {CommitEnhanced [] } commits - Commits for release
282
+ * @param {CommitEnhanced? } key - Release commit
274
283
* @return {GeneratedContext } Final changelog context
275
284
*/
276
285
finalizeContext (
277
286
context : GeneratedContext ,
278
287
options : Options ,
279
- commits : ICommit [ ] ,
280
- key : ICommit | undefined
288
+ commits : CommitEnhanced [ ] ,
289
+ key ?: CommitEnhanced
281
290
) : GeneratedContext {
282
291
const { gitSemverTags = [ ] , isPatch, linkCompare, version } = context
283
292
let { currentTag, previousTag } = context
284
293
285
294
/**
286
295
* First commit in release.
287
296
*
288
- * @const {ICommit | undefined } first_commit
297
+ * @const {CommitEnhanced? } first_commit
289
298
*/
290
- const first_commit : ICommit | undefined = commits . at ( 0 )
299
+ const first_commit : CommitEnhanced | undefined = commits . at ( 0 )
291
300
292
301
/**
293
302
* Last commit in release.
294
303
*
295
- * @const {ICommit | undefined } last_commit
304
+ * @const {CommitEnhanced? } last_commit
296
305
*/
297
- const last_commit : ICommit | undefined = commits . at ( - 1 )
306
+ const last_commit : CommitEnhanced | undefined = commits . at ( - 1 )
298
307
299
308
// set current and previous tags
300
309
if ( key && ( ! currentTag || ! previousTag ) ) {
0 commit comments