@@ -24,6 +24,7 @@ const validTypes = [
24
24
]
25
25
const validPreIds = [ 'alpha' , 'beta' , 'rc' ]
26
26
27
+ const includeChoresFlag = '--chores'
27
28
const isNextBranch = branch => / ^ n e x t \/ v \d + \. ( \d + \. ) ? x $ / . test ( branch )
28
29
const isSupportBranch = branch => / ^ v \d + \. x $ / . test ( branch )
29
30
@@ -236,7 +237,7 @@ const formatList = (header, list) => {
236
237
*
237
238
* Output markdown at the beginning of the CHANGELOG.md file
238
239
*/
239
- const generateChangelog = async ( type , tagName ) => {
240
+ const generateChangelog = async ( type , tagName , includeChores ) => {
240
241
const [ day , month , year ] = new Date ( ) . toUTCString ( ) . split ( ' ' ) . slice ( 1 , 4 )
241
242
const date = `${ month } ${ day . replace ( / ^ 0 / , '' ) } , ${ year } `
242
243
const file = 'CHANGELOG.md'
@@ -274,8 +275,8 @@ const generateChangelog = async (type, tagName) => {
274
275
features . push ( item )
275
276
} else if ( / ^ f i x [ ( ! : ] / . test ( message ) ) {
276
277
fixes . push ( item )
277
- } else if ( / ^ c h o r e ( \( .+ ?\) ) ? ! : / . test ( message ) ) {
278
- // only include breaking chores
278
+ } else if ( ( includeChores ? / ^ c h o r e [ ( ! : ] / : / ^ c h o r e ( \( .+ ?\) ) ? ! : / ) . test ( message ) ) {
279
+ // only include breaking chores if !includeChores
279
280
item . message = `Chore: ${ shortMessage } `
280
281
chores . push ( item )
281
282
}
@@ -314,7 +315,7 @@ const generateChangelog = async (type, tagName) => {
314
315
315
316
if ( ! notes . trim ( ) && ! chores . length && ! features . length && ! fixes . length ) {
316
317
console . error (
317
- ' \nNo fixes, features, or chores since last release and no notes given. Exiting.\n'
318
+ ` \nNo fixes, features, or chores since last release and no notes given. Maybe you meant to include the " ${ includeChoresFlag } " flag. Exiting.\n`
318
319
)
319
320
process . exit ( 1 )
320
321
}
@@ -632,7 +633,7 @@ const returnToBranch = async (branch, tagName) => {
632
633
* If type is 'pre<major|minor|patch>', also pass a preId of 'alpha', 'beta', or
633
634
* 'rc'
634
635
*/
635
- const run = async ( type , preId ) => {
636
+ const run = async ( [ type , preId ] , flags ) => {
636
637
assertValidArgs ( type , preId )
637
638
638
639
const isPrerelease = type . startsWith ( 'pre' )
@@ -659,7 +660,7 @@ const run = async (type, preId) => {
659
660
660
661
// start modifying things
661
662
const tagName = await incrementVersion ( packages , type , preId )
662
- const changelogBody = await generateChangelog ( type , tagName )
663
+ const changelogBody = await generateChangelog ( type , tagName , flags . includes ( includeChoresFlag ) )
663
664
664
665
await commitChanges ( tagName )
665
666
@@ -674,4 +675,11 @@ const run = async (type, preId) => {
674
675
logPackageLinks ( packages )
675
676
}
676
677
677
- run ( ...process . argv . slice ( 2 ) )
678
+ const { args, flags } = process . argv . slice ( 2 ) . reduce ( ( buckets , argOrFlag ) => {
679
+ const bucket = argOrFlag . startsWith ( '-' ) ? buckets . flags : buckets . args
680
+ bucket . push ( argOrFlag )
681
+
682
+ return buckets
683
+ } , { args : [ ] , flags : [ ] } )
684
+
685
+ run ( args , flags )
0 commit comments