@@ -45,7 +45,7 @@ for (const dirName of fs.readdirSync(generatedDir)) {
45
45
. readdirSync ( packageDir )
46
46
. filter ( ( f ) => f . endsWith ( ".d.ts" ) ) ;
47
47
48
- let releaseNotes = "" ;
48
+ const releaseNotes = [ ] ;
49
49
50
50
// Look through each .d.ts file included in a package to
51
51
// determine if anything has changed
@@ -67,10 +67,10 @@ for (const dirName of fs.readdirSync(generatedDir)) {
67
67
if ( oldFile !== generatedDTSContent )
68
68
printDiff ( oldFile , generatedDTSContent ) ;
69
69
70
- const title = `\n ## \`${ file } \`\n\n ` ;
70
+ const title = `## \`${ file } \`` ;
71
71
const notes = generateChangelogFrom ( oldFile , generatedDTSContent ) ;
72
- releaseNotes = title ;
73
- releaseNotes += notes . trim ( ) === "" ? "No changes" : notes ;
72
+ releaseNotes . push ( title ) ;
73
+ releaseNotes . push ( notes . trim ( ) === "" ? "No changes" : notes ) ;
74
74
75
75
upload = upload || oldFile !== generatedDTSContent ;
76
76
} catch ( error ) {
@@ -98,7 +98,10 @@ Assuming that this means we need to upload this package.`);
98
98
} else {
99
99
console . log ( publish . stdout ?. toString ( ) ) ;
100
100
101
- await createRelease ( `${ pkgJSON . name } @${ pkgJSON . version } ` , releaseNotes ) ;
101
+ await createRelease (
102
+ `${ pkgJSON . name } @${ pkgJSON . version } ` ,
103
+ releaseNotes . join ( "\n\n" )
104
+ ) ;
102
105
}
103
106
} else {
104
107
console . log (
@@ -109,8 +112,8 @@ Assuming that this means we need to upload this package.`);
109
112
110
113
uploaded . push ( dirName ) ;
111
114
112
- console . log ( "\n# Release notes:" ) ;
113
- console . log ( releaseNotes , "\n\n" ) ;
115
+ console . log ( "\n# Release notes:\n " ) ;
116
+ console . log ( releaseNotes . join ( "\n\n" ) , "\n\n" ) ;
114
117
}
115
118
}
116
119
console . log ( "" ) ;
@@ -152,10 +155,11 @@ async function createRelease(tag, body) {
152
155
153
156
function verify ( ) {
154
157
const authToken = process . env . GITHUB_TOKEN || process . env . GITHUB_API_TOKEN ;
155
- if ( ! authToken )
158
+ if ( ! authToken ) {
156
159
throw new Error (
157
160
"There isn't an ENV var set up for creating a GitHub release, expected GITHUB_TOKEN."
158
161
) ;
162
+ }
159
163
}
160
164
161
165
/** @param {string } filepath */
0 commit comments