8
8
import * as fs from "fs" ;
9
9
import { basename } from "path" ;
10
10
import { spawnSync , execSync } from "child_process" ;
11
- import { Octokit } from "@octokit/core " ;
11
+ import { Octokit } from "@octokit/rest " ;
12
12
import printDiff from "print-diff" ;
13
13
import { generateChangelogFrom } from "../lib/changelog.js" ;
14
14
import { packages } from "./createTypesPackages.mjs" ;
@@ -36,8 +36,7 @@ for (const dirName of fs.readdirSync(generatedDir)) {
36
36
. readdirSync ( packageDir )
37
37
. filter ( ( f ) => f . endsWith ( ".d.ts" ) ) ;
38
38
39
- /** @type {string[] } */
40
- let releaseNotes = [ ] ;
39
+ let releaseNotes = "" ;
41
40
42
41
// Look through each .d.ts file included in a package to
43
42
// determine if anything has changed
@@ -63,10 +62,10 @@ for (const dirName of fs.readdirSync(generatedDir)) {
63
62
console . log ( `Comparing ${ file } from ${ olderVersion } , to now:` ) ;
64
63
printDiff ( oldFile , generatedDTSContent ) ;
65
64
66
- const title = `\n## \`${ file } \`\n` ;
65
+ const title = `\n## \`${ file } \`\n\n ` ;
67
66
const notes = generateChangelogFrom ( oldFile , generatedDTSContent ) ;
68
- releaseNotes . push ( title ) ;
69
- releaseNotes . push ( notes . trim ( ) === "" ? "No changes" : notes ) ;
67
+ releaseNotes = title ;
68
+ releaseNotes += notes . trim ( ) === "" ? "No changes" : notes ;
70
69
71
70
upload = upload || oldFile !== generatedDTSContent ;
72
71
} catch ( error ) {
@@ -106,7 +105,7 @@ Assuming that this means we need to upload this package.`);
106
105
}
107
106
108
107
console . log ( "\n# Release notes:" ) ;
109
- console . log ( releaseNotes . join ( "\n" ) , "\n\n" ) ;
108
+ console . log ( releaseNotes , "\n\n" ) ;
110
109
}
111
110
// Warn if we did a dry run.
112
111
if ( ! process . env . NODE_AUTH_TOKEN ) {
@@ -124,7 +123,7 @@ async function createRelease(tag, body) {
124
123
const octokit = new Octokit ( { auth : authToken } ) ;
125
124
126
125
try {
127
- await octokit . request ( "POST / repos/{owner}/{repo}/releases" , {
126
+ await octokit . repos . createRelease ( {
128
127
owner : "microsoft" ,
129
128
repo : "TypeScript-DOM-lib-generator" ,
130
129
tag_name : tag ,
0 commit comments