@@ -21,10 +21,6 @@ const changesFile = path.join(changesDirectory, `${packageJson.version}.json`)
21
21
nodefs . mkdirSync ( nextReleaseDirectory , { recursive : true } )
22
22
23
23
const changeFiles = nodefs . readdirSync ( nextReleaseDirectory )
24
- if ( changeFiles . length === 0 ) {
25
- console . warn ( 'no changes to release (missing .changes/ directory)' )
26
- process . exit ( )
27
- }
28
24
try {
29
25
nodefs . accessSync ( changesFile )
30
26
console . log ( `error: changelog data file already exists: ${ changesFile } ` )
@@ -45,21 +41,25 @@ for (const changeFile of changeFiles) {
45
41
changelog . entries . push ( file )
46
42
}
47
43
48
- changelog . entries . sort ( ( x : { type : string } , y : { type : string } ) => x . type . localeCompare ( y . type ) )
49
-
50
44
// Write changelog file
51
45
nodefs . writeFileSync ( changesFile , JSON . stringify ( changelog , undefined , '\t' ) )
52
46
const fileData = nodefs . readFileSync ( path . join ( cwd , 'CHANGELOG.md' ) )
53
47
let 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
+ }
56
56
}
57
57
58
58
append += '\n' + fileData . toString ( )
59
59
nodefs . writeFileSync ( 'CHANGELOG.md' , append )
60
60
61
61
child_process . execSync ( `git add ${ changesDirectory } ` )
62
- child_process . execSync ( `git rm -rf ${ nextReleaseDirectory } ` )
62
+ child_process . execSync ( `git rm -rf --ignore-unmatch ${ nextReleaseDirectory } ` )
63
63
child_process . execSync ( 'git add CHANGELOG.md' )
64
64
65
65
console . log ( changesFile )
0 commit comments