File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ import type { ChangelogFormatter } from '../packages/bumpy/src/core/changelog.ts' ;
2+
3+ const formatter : ChangelogFormatter = ( ctx ) => {
4+ const { release, changesets, date } = ctx ;
5+ const lines : string [ ] = [ ] ;
6+ lines . push ( `## 🐸 ${ release . newVersion } ` ) ;
7+ lines . push ( '' ) ;
8+ lines . push ( `_${ date } _` ) ;
9+ lines . push ( '' ) ;
10+
11+ const relevantChangesets = changesets . filter ( ( cs ) => release . changesets . includes ( cs . id ) ) ;
12+
13+ if ( relevantChangesets . length > 0 ) {
14+ for ( const cs of relevantChangesets ) {
15+ if ( cs . summary ) {
16+ const summaryLines = cs . summary . split ( '\n' ) ;
17+ lines . push ( `- ${ summaryLines [ 0 ] } ` ) ;
18+ for ( let i = 1 ; i < summaryLines . length ; i ++ ) {
19+ if ( summaryLines [ i ] ! . trim ( ) ) {
20+ lines . push ( ` ${ summaryLines [ i ] } ` ) ;
21+ }
22+ }
23+ }
24+ }
25+ }
26+
27+ if ( release . isDependencyBump && relevantChangesets . length === 0 ) {
28+ lines . push ( '- Updated dependencies' ) ;
29+ }
30+
31+ if ( release . isCascadeBump && ! release . isDependencyBump && relevantChangesets . length === 0 ) {
32+ lines . push ( '- Version bump via cascade rule' ) ;
33+ }
34+
35+ lines . push ( '' ) ;
36+ return lines . join ( '\n' ) ;
37+ } ;
38+
39+ export default formatter ;
Original file line number Diff line number Diff line change 11{
22 "baseBranch" : " main" ,
3- "changelog" : " default "
3+ "changelog" : " ./changelog-formatter.ts "
44}
You can’t perform that action at this time.
0 commit comments