@@ -21,10 +21,6 @@ const changesFile = path.join(changesDirectory, `${packageJson.version}.json`)
2121nodefs . mkdirSync ( nextReleaseDirectory , { recursive : true } )
2222
2323const changeFiles = nodefs . readdirSync ( nextReleaseDirectory )
24- if ( changeFiles . length === 0 ) {
25- console . warn ( 'no changes to release (missing .changes/ directory)' )
26- process . exit ( )
27- }
2824try {
2925 nodefs . accessSync ( changesFile )
3026 console . log ( `error: changelog data file already exists: ${ changesFile } ` )
@@ -45,21 +41,25 @@ for (const changeFile of changeFiles) {
4541 changelog . entries . push ( file )
4642}
4743
48- changelog . entries . sort ( ( x : { type : string } , y : { type : string } ) => x . type . localeCompare ( y . type ) )
49-
5044// Write changelog file
5145nodefs . writeFileSync ( changesFile , JSON . stringify ( changelog , undefined , '\t' ) )
5246const fileData = nodefs . readFileSync ( path . join ( cwd , 'CHANGELOG.md' ) )
5347let append = `## ${ packageJson . version } ${ timestamp } \n\n`
54- for ( const file of changelog . entries ) {
55- append += `- **${ file . type } ** ${ file . description } \n`
48+ if ( changelog . entries . length === 0 ) {
49+ console . warn ( 'no changes to release (missing .changes/ directory)' )
50+ append += '- Miscellaneous non-user-facing changes\n'
51+ } else {
52+ changelog . entries . sort ( ( x : { type : string } , y : { type : string } ) => x . type . localeCompare ( y . type ) )
53+ for ( const file of changelog . entries ) {
54+ append += `- **${ file . type } ** ${ file . description } \n`
55+ }
5656}
5757
5858append += '\n' + fileData . toString ( )
5959nodefs . writeFileSync ( 'CHANGELOG.md' , append )
6060
6161child_process . execSync ( `git add ${ changesDirectory } ` )
62- child_process . execSync ( `git rm -rf ${ nextReleaseDirectory } ` )
62+ child_process . execSync ( `git rm -rf --ignore-unmatch ${ nextReleaseDirectory } ` )
6363child_process . execSync ( 'git add CHANGELOG.md' )
6464
6565console . log ( changesFile )
0 commit comments